MS24112015_2
This commit is contained in:
113
Global_Indexer/frmSplash.vb
Normal file
113
Global_Indexer/frmSplash.vb
Normal file
@@ -0,0 +1,113 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.Diagnostics
|
||||
Public NotInheritable Class frmSplash
|
||||
|
||||
'TODO: Dieses Formular kann einfach als Begrüßungsbildschirm für die Anwendung festgelegt werden, indem Sie zur Registerkarte "Anwendung"
|
||||
' des Projekt-Designers wechseln (Menü "Projekt", Option "Eigenschaften").
|
||||
Private InitSteps As Integer = 4
|
||||
Private bw As New BackgroundWorker()
|
||||
|
||||
Private Sub frmSplash_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
|
||||
'Richten Sie den Dialogtext zur Laufzeit gemäß den Assemblyinformationen der Anwendung ein.
|
||||
|
||||
'TODO: Die Assemblyinformationen der Anwendung im Bereich "Anwendung" des Dialogfelds für die
|
||||
' Projekteigenschaften (im Menü "Projekt") anpassen.
|
||||
|
||||
'Anwendungstitel
|
||||
If My.Application.Info.Title <> "" Then
|
||||
ApplicationTitle.Text = My.Application.Info.Title
|
||||
Else
|
||||
'Wenn der Anwendungstitel fehlt, Anwendungsnamen ohne Erweiterung verwenden
|
||||
ApplicationTitle.Text = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName)
|
||||
End If
|
||||
|
||||
'Verwenden Sie zum Formatieren der Versionsinformationen den Text, der zur Entwurfszeit in der Versionskontrolle festgelegt wurde, als
|
||||
' Formatierungszeichenfolge. Dies ermöglicht ggf. eine effektive Lokalisierung.
|
||||
' Build- und Revisionsinformationen können durch Verwendung des folgenden Codes und durch Ändern
|
||||
' des Entwurfszeittexts der Versionskontrolle in "Version {0}.{1:00}.{2}.{3}" oder einen ähnlichen Text eingeschlossen werden. Weitere Informationen erhalten Sie unter
|
||||
' String.Format() in der Hilfe.
|
||||
'
|
||||
' Version.Text = System.String.Format(Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor, My.Application.Info.Version.Build, My.Application.Info.Version.Revision)
|
||||
|
||||
Version.Text = String.Format("Version {0}", My.Application.Info.Version.ToString)
|
||||
|
||||
'Copyrightinformationen
|
||||
Copyright.Text = My.Application.Info.Copyright & " " & My.Application.Info.CompanyName
|
||||
Me.BringToFront()
|
||||
|
||||
Dim p As Process
|
||||
Dim RunCount = 0
|
||||
For Each p In Process.GetProcesses
|
||||
If p.ProcessName.Contains("lobal_Indexe") Then
|
||||
RunCount += 1
|
||||
End If
|
||||
Next
|
||||
'If RunCount = 2 Then
|
||||
' MsgBox("Application already running. " & "GLOBIX will be closed!", MsgBoxStyle.Exclamation)
|
||||
' My.Settings.AppTerminate = True
|
||||
' My.Settings.Save()
|
||||
' Me.Close()
|
||||
'Else
|
||||
' InitProgram()
|
||||
'End If
|
||||
|
||||
InitProgram()
|
||||
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub InitProgram()
|
||||
bw.WorkerReportsProgress = True
|
||||
AddHandler bw.DoWork, AddressOf bw_DoWork
|
||||
AddHandler bw.ProgressChanged, AddressOf bw_ProgressChanged
|
||||
AddHandler bw.RunWorkerCompleted, AddressOf bw_RunWorkerCompleted
|
||||
|
||||
bw.RunWorkerAsync()
|
||||
End Sub
|
||||
|
||||
Private Function CalcProgress(_step As Integer)
|
||||
Return _step * (100 / InitSteps)
|
||||
End Function
|
||||
|
||||
<STAThread()> _
|
||||
Private Sub bw_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs)
|
||||
Dim Init = New ClassInit()
|
||||
|
||||
bw.ReportProgress(CalcProgress(1), "Initialize Logging")
|
||||
Init.InitLogger()
|
||||
|
||||
System.Threading.Thread.Sleep(600)
|
||||
|
||||
bw.ReportProgress(CalcProgress(2), "Initialize Database")
|
||||
Init.InitDatabase()
|
||||
|
||||
System.Threading.Thread.Sleep(600)
|
||||
bw.ReportProgress(CalcProgress(3), "Initialize UserConfiguration")
|
||||
Init.InitUserLogin()
|
||||
|
||||
System.Threading.Thread.Sleep(600)
|
||||
|
||||
bw.ReportProgress(CalcProgress(4), "Initialize windream-Settings")
|
||||
Init.InitBasics()
|
||||
|
||||
System.Threading.Thread.Sleep(500)
|
||||
End Sub
|
||||
|
||||
Private Sub bw_ProgressChanged(sender As Object, e As System.ComponentModel.ProgressChangedEventArgs)
|
||||
pbStatus.Value = e.ProgressPercentage
|
||||
lblStatus.Text = e.UserState.ToString()
|
||||
End Sub
|
||||
|
||||
Private Sub bw_RunWorkerCompleted(sender As Object, e As System.ComponentModel.RunWorkerCompletedEventArgs)
|
||||
' Bei Fehler MsgBox anzeigen und Programm beenden
|
||||
If e.Error IsNot Nothing Then
|
||||
MsgBox(e.Error.Message, MsgBoxStyle.Critical, "Unexpected error in Initializing application")
|
||||
Application.Exit()
|
||||
End If
|
||||
|
||||
' Wenn kein Fehler, Splashscreen schließen
|
||||
Me.Close()
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user