Files
Nuvolar/momoERP.Win.HA/Program.vb
T
2018-04-17 17:35:54 +02:00

125 lines
5.0 KiB
VB.net

Imports System
Imports System.Configuration
Imports System.Windows.Forms
Imports DevExpress.Persistent.Base
Imports DevExpress.ExpressApp
Imports DevExpress.ExpressApp.Security
Imports DevExpress.ExpressApp.Win
Imports Nuvolar.Module.Win
Imports DevExpress.Persistent.AuditTrail
Imports Microsoft.VisualBasic
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.ExpressApp.Model.Core
Imports DevExpress.ExpressApp.Model
Imports Nuvolar.Module
Friend NotInheritable Class Program
Private Sub New()
End Sub
<STAThread()> _
Public Shared Sub Main(ByVal arguments() As String)
#If EASYTEST Then
DevExpress.ExpressApp.EasyTest.WinAdapter.RemotingRegistration.Register(4100)
#End If
Application.EnableVisualStyles()
Application.SetCompatibleTextRenderingDefault(False)
EditModelPermission.AlwaysGranted = System.Diagnostics.Debugger.IsAttached
'-- Eredeti kód
'Dim _application As NuvolarWindowsFormsApplication_DB = New NuvolarWindowsFormsApplication_DB()
'If (Not ConfigurationManager.ConnectionStrings.Item("ConnectionString") Is Nothing) Then
' _application.ConnectionString = ConfigurationManager.ConnectionStrings.Item("ConnectionString").ConnectionString
'End If
'If System.Diagnostics.Debugger.IsAttached Then
' _application.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways
'End If
'Try
' Dim timeStampStrategy As IAuditTimestampStrategy = New Nuvolar.Module.TimeStamp
' AuditTrailService.Instance.TimestampStrategy = timeStampStrategy
' _application.Setup()
' _application.Start()
'Catch e As Exception
' _application.HandleException(e)
'End Try
'-- Új kód
Do
Dim winApplication As NuvolarWindowsFormsApplication
If LogOnDB.NewApplication Is Nothing Then
winApplication = NuvolarWindowsFormsApplication.CreateApplication()
Else
winApplication = CType(LogOnDB.NewApplication, NuvolarWindowsFormsApplication)
LogOnDB.NewApplication = Nothing
End If
Try
'AddHandler Application.Idle, AddressOf Application_Idle
AddHandler AuditTrailService.Instance.SaveAuditTrailData, AddressOf Instance_SaveAuditTrailData
AddHandler winApplication.CreateCustomUserModelDifferenceStore, AddressOf winApplication_CreateCustomUserModelDifferenceStore
AddHandler winApplication.LastLogonParametersWriting, AddressOf winApplication_LastLogonParametersWriting
winApplication.DelayedViewItemsInitialization = True
winApplication.SplashScreen = New DevExpress.ExpressApp.Win.Utils.DXSplashScreen
AuditTrailService.Instance.ObjectAuditingMode = ObjectAuditingMode.Lightweight
winApplication.Setup()
winApplication.Start()
If WinChangeDatabaseHelper.AuthenticatedUserLogonFailed Then
WinChangeDatabaseHelper.SkipLogonDialog = False
winApplication.Start()
End If
Catch e As Exception
winApplication.HandleException(e)
End Try
winApplication.Dispose()
Loop While LogOnDB.NewApplication IsNot Nothing
'-- Új kód vége
End Sub
Shared Sub winApplication_CreateCustomUserModelDifferenceStore(ByVal sender As Object, ByVal e As CreateCustomModelDifferenceStoreEventArgs)
Dim userDiffs As New UserStore(CType(sender, WinApplication))
e.Store = userDiffs
e.Handled = True
End Sub
Private Shared Sub Instance_SaveAuditTrailData(sender As Object, e As SaveAuditTrailDataEventArgs)
If GLOBAL_HAS_Audit = False Then
e.Handled = True
End If
End Sub
Shared Sub winApplication_LastLogonParametersWriting(ByVal sender As Object, ByVal e As LastLogonParametersWritingEventArgs)
'If (CType(e.LogonObject, AuthenticationStandardLogonParameters)).UserName <> "SysAdmin" Then
e.SettingsStorage.SaveOption("", "UserName", (CType(e.LogonObject, AuthenticationStandardLogonParameters)).UserName)
e.SettingsStorage.SaveOption("", "DBConnection", GLOBAL_SQLDatabase)
e.SettingsStorage.SaveOption("", "SQLServer", GLOBAL_SQLServer)
e.SettingsStorage.SaveOption("", "Company", GLOBAL_Company)
Select Case GLOBAL_SQLType
Case eSQLType.MSSQL
e.SettingsStorage.SaveOption("", "SQLType", "MSSQL")
Case eSQLType.MySQL
e.SettingsStorage.SaveOption("", "SQLType", "MySQL")
Case eSQLType.PostgreSQL
e.SettingsStorage.SaveOption("", "SQLType", "PostgreSQL")
End Select
e.Handled = True
End Sub
Private Shared Sub Application_Idle(sender As Object, e As EventArgs)
End Sub
End Class