137 lines
5.3 KiB
VB.net
137 lines
5.3 KiB
VB.net
Imports DevExpress.XtraBars.Docking2010
|
|
Imports System.ComponentModel
|
|
Imports DigitalData.GUIs.ClientSuite.ClassLayout
|
|
Imports System.IO
|
|
Imports DigitalData.Modules.Logging
|
|
Imports DigitalData.Modules.License
|
|
|
|
Public Class frmMain
|
|
Private _Logger As Logger
|
|
Private _Timer As ClassTimer
|
|
|
|
Public Sub New()
|
|
' Dieser Aufruf ist für den Designer erforderlich.
|
|
InitializeComponent()
|
|
|
|
' Assign My.MainForm before everything else
|
|
My.MainForm = Me
|
|
|
|
' Initialize Main Timer
|
|
_Timer = New ClassTimer(My.LogConfig)
|
|
|
|
' Show splashscreen
|
|
frmSplash.ShowDialog()
|
|
End Sub
|
|
|
|
Private Sub FrmMain_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
LabelCurrentUser.Caption = My.Application.User.UserName
|
|
LabelCurrentMachine.Caption = My.Application.User.MachineName
|
|
LabelCurrentVersion.Caption = My.Application.Info.Version.ToString
|
|
LabelCurrentLanguage.Caption = My.Application.User.Language
|
|
|
|
Dim oDashboard = New frmDashboard()
|
|
oDashboard.MdiParent = DocumentManager.MdiParent
|
|
oDashboard.Show()
|
|
|
|
' --- Process Manager Panel ---
|
|
Dim oDataTable = New DataTable("PMDocuments")
|
|
Dim oDocNameColumn = New DataColumn("DocName", GetType(String))
|
|
oDataTable.Columns.Add(oDocNameColumn)
|
|
|
|
Dim oRow = oDataTable.NewRow()
|
|
oRow.Item("DocName") = "test1.xlsx"
|
|
|
|
oDataTable.Rows.Add(oRow)
|
|
|
|
ProcessManagerWidget.DataSource = oDataTable
|
|
AddHandler ProcessManagerWidget.RowDoubleClicked, Sub(RowView As DataRowView)
|
|
MsgBox($"Clicked on Document {RowView.Row.Item("DocName")}")
|
|
End Sub
|
|
|
|
|
|
LoadLayout()
|
|
End Sub
|
|
|
|
Private Sub FrmMain_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
|
|
SaveLayout()
|
|
End Sub
|
|
|
|
Private Sub LoadLayout()
|
|
Dim oLayoutPathForDockManager As String = GetLayoutPath(LayoutName.LayoutMain, LayoutComponent.DockManager)
|
|
Dim oLayoutPathForDocumentManager As String = GetLayoutPath(LayoutName.LayoutMain, LayoutComponent.DocumentManager)
|
|
|
|
If IO.File.Exists(oLayoutPathForDockManager) Then
|
|
DockManager.RestoreLayoutFromXml(oLayoutPathForDockManager)
|
|
End If
|
|
|
|
If IO.File.Exists(oLayoutPathForDocumentManager) Then
|
|
DocumentManager.View.RestoreLayoutFromXml(oLayoutPathForDocumentManager)
|
|
End If
|
|
End Sub
|
|
Private Sub SaveLayout()
|
|
Dim oLayoutPathForDockManager As String = GetLayoutPath(LayoutName.LayoutMain, LayoutComponent.DockManager)
|
|
Dim oLayoutPathForDocumentManager As String = GetLayoutPath(LayoutName.LayoutMain, LayoutComponent.DocumentManager)
|
|
Dim oDirectory As String = Path.GetDirectoryName(oLayoutPathForDockManager)
|
|
|
|
If Not Directory.Exists(oDirectory) Then
|
|
Directory.CreateDirectory(oDirectory)
|
|
End If
|
|
|
|
DockManager.SaveLayoutToXml(oLayoutPathForDockManager)
|
|
DocumentManager.View.SaveLayoutToXml(oLayoutPathForDocumentManager)
|
|
End Sub
|
|
|
|
Private Sub BarButtonUserSettings_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonUserSettings.ItemClick
|
|
Dim frm As New frmConfigUser()
|
|
frm.MdiParent = DocumentManager.MdiParent
|
|
frm.Show()
|
|
End Sub
|
|
|
|
Private Sub BarButtonDashboard_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonDashboard.ItemClick
|
|
Dim frm As New frmDashboard()
|
|
frm.MdiParent = DocumentManager.MdiParent
|
|
frm.Show()
|
|
End Sub
|
|
|
|
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
|
|
Dim frm As New frmFileTest()
|
|
frm.MdiParent = DocumentManager.MdiParent
|
|
frm.Show()
|
|
End Sub
|
|
|
|
Private Sub BarButtonEntityDesigner_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonEntityDesigner.ItemClick
|
|
Dim frm As New frmEntityDesigner()
|
|
frm.MdiParent = DocumentManager.MdiParent
|
|
frm.Show()
|
|
|
|
RibbonPageCategoryEntityDesigner.Visible = True
|
|
End Sub
|
|
|
|
Private Sub BarButtonConnectionSettings_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonConnectionSettings.ItemClick
|
|
Dim frm As New frmConfigService()
|
|
frm.MdiParent = DocumentManager.MdiParent
|
|
frm.Show()
|
|
End Sub
|
|
|
|
Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick
|
|
Dim oUser1 = LicenseCreator.NewUser(UserType.PowerUser, 5)
|
|
Dim oUser2 = LicenseCreator.NewUser(UserType.WriteOnly, 5, Date.Now)
|
|
Dim oUsers As New List(Of LicenseModuleUser)
|
|
oUsers.Add(oUser1)
|
|
oUsers.Add(oUser2)
|
|
|
|
Dim oModule = LicenseCreator.NewModule("EDMI", oUsers)
|
|
Dim oModules As New List(Of LicenseModule)
|
|
oModules.Add(oModule)
|
|
|
|
Dim oLicense = LicenseCreator.NewLicense(oModules)
|
|
|
|
Dim oLicenseFile As New LicenseFile(My.LogConfig, "E:\")
|
|
oLicenseFile.SaveFile(oLicense)
|
|
|
|
Dim oSerializer As New Xml.Serialization.XmlSerializer(GetType(LicenseSchema))
|
|
Dim oLicense2 As LicenseSchema
|
|
|
|
oLicense2 = oLicenseFile.LoadFile()
|
|
End Sub
|
|
End Class |