-
Notifications
You must be signed in to change notification settings - Fork 7
/
Program.vb
47 lines (40 loc) · 2.4 KB
/
Program.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Imports System
Imports System.Configuration
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.AuditTrail
Imports System.Globalization
Imports DevExpress.ExpressApp.Win.EasyTest
Namespace MainDemo.Win
Public Class Program
Shared Private Sub winApplication_CustomizeFormattingCulture(ByVal sender As Object, ByVal e As CustomizeFormattingCultureEventArgs)
e.FormattingCulture = CultureInfo.GetCultureInfo("en-US")
End Sub
<STAThread>
Public Shared Sub Main(ByVal arguments As String())
Dim winApplication As MainDemoWinApplication = New MainDemoWinApplication()
EasyTestRemotingRegistration.Register()
AddHandler winApplication.CustomizeFormattingCulture, New EventHandler(Of CustomizeFormattingCultureEventArgs)(AddressOf winApplication_CustomizeFormattingCulture)
Try
AddHandler AuditTrailService.Instance.QueryCurrentUserName, New QueryCurrentUserNameEventHandler(AddressOf Instance_QueryCurrentUserName)
AddHandler winApplication.LastLogonParametersReading, New EventHandler(Of LastLogonParametersReadingEventArgs)(AddressOf winApplication_LastLogonParametersReading)
If ConfigurationManager.ConnectionStrings("ConnectionString") IsNot Nothing Then
winApplication.ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
End If
DevExpress.ExpressApp.Xpo.InMemoryDataStoreProvider.Register()
winApplication.ConnectionString = DevExpress.ExpressApp.Xpo.InMemoryDataStoreProvider.ConnectionString
winApplication.Setup()
winApplication.Start()
Catch e As Exception
winApplication.HandleException(e)
End Try
End Sub
Private Shared Sub winApplication_LastLogonParametersReading(ByVal sender As Object, ByVal e As LastLogonParametersReadingEventArgs)
If String.IsNullOrEmpty(e.SettingsStorage.LoadOption("", "UserName")) Then
e.SettingsStorage.SaveOption("", "UserName", "Sam")
End If
End Sub
Private Shared Sub Instance_QueryCurrentUserName(ByVal sender As Object, ByVal e As QueryCurrentUserNameEventArgs)
e.CurrentUserName = System.Security.Principal.WindowsIdentity.GetCurrent().Name
End Sub
End Class
End Namespace