Torna al Thread

Public Class StartApplicationHelper Public Shared Property IsReady As Boolean = False Public Shared Event NotifyEvent As ValueEnterEventHandler Public Shared Sub Start() If System.Windows.Application.Current Is Nothing Then Try Dim myApp As Application = New Application myApp.ShutdownMode = ShutdownMode.OnExplicitShutdown myApp.InitializeComponent() IsReady= True Catch ex As Exception MessageBox.Show(ex.Message) End Try End If End Sub Public Shared Sub Shutdown() If System.Windows.Application.Current IsNot Nothing Then System.Windows.Application.Current.Shutdown() IsReady = False End If End Sub Public Shared Sub DispatchEvent(ByVal eve As String) If IsReady Then EventDispatcherService.DispatchEvent(eve, New EventDispatcherDataChildWin(String.Empty, Nothing, Nothing, False)) End Sub Public Shared Sub DispatchResult(ByVal res As Object) RaiseEvent NotifyEvent(Nothing, New ValueEnterEventArgs(res)) End Sub End Class
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5