15-08-2023
This commit is contained in:
parent
3fa731fe5f
commit
775418fb7a
@ -19,6 +19,7 @@ Public MustInherit Class BaseModule
|
||||
Public MustOverride Function TestConfigIsComplete() As Boolean Implements ISync.TestConfigIsComplete
|
||||
|
||||
Public Event OnLogEntry As EventHandler(Of String) Implements ISync.OnLogEntry
|
||||
Public Event OnFileProcessed As EventHandler(Of String) Implements ISync.OnFileProcessed
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pConfig As Config)
|
||||
MyBase.New(pLogConfig)
|
||||
@ -136,4 +137,8 @@ Public MustInherit Class BaseModule
|
||||
Friend Sub AddDivider()
|
||||
RaiseEvent OnLogEntry(Me, "---")
|
||||
End Sub
|
||||
|
||||
Friend Sub RaiseFileProcessed(pFilePath As String)
|
||||
RaiseEvent OnFileProcessed(Me, pFilePath)
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
@ -8,4 +8,5 @@ Public Interface ISync
|
||||
Function TestConfigIsComplete() As Boolean
|
||||
|
||||
Event OnLogEntry As EventHandler(Of String)
|
||||
Event OnFileProcessed As EventHandler(Of String)
|
||||
End Interface
|
||||
|
||||
@ -53,6 +53,8 @@ Namespace Sharepoint
|
||||
Dim oSQL = String.Format(Config.SQLQueryExport, oDocument.Id, oFileName)
|
||||
Await Database.ExecuteNonQueryAsync(oSQL)
|
||||
|
||||
RaiseFileProcessed(oFilePath)
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
AddWarnEntry("Error while running Sync: " & ex.Message)
|
||||
|
||||
@ -65,6 +65,8 @@ Namespace slt
|
||||
Dim oSQL = String.Format(Config.SQLQueryExport, oDocument.ExtDocId, oFileName)
|
||||
Await Database.ExecuteNonQueryAsync(oSQL)
|
||||
|
||||
RaiseFileProcessed(oFilePath)
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
AddWarnEntry("Error while running Sync: " & ex.Message)
|
||||
|
||||
50
Connectors.Form/frmMain.Designer.vb
generated
50
Connectors.Form/frmMain.Designer.vb
generated
@ -31,6 +31,7 @@
|
||||
Me.btnSyncStart = New DevExpress.XtraBars.BarButtonItem()
|
||||
Me.btnStopSync = New DevExpress.XtraBars.BarButtonItem()
|
||||
Me.BarButtonItem1 = New DevExpress.XtraBars.BarButtonItem()
|
||||
Me.btnForceSync = New DevExpress.XtraBars.BarButtonItem()
|
||||
Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage()
|
||||
Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
|
||||
Me.RibbonPageGroup2 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
|
||||
@ -39,7 +40,9 @@
|
||||
Me.TrayMenu = New System.Windows.Forms.ContextMenuStrip(Me.components)
|
||||
Me.btnToggleWindow = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.btnExit = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.btnForceSync = New DevExpress.XtraBars.BarButtonItem()
|
||||
Me.RibbonStatusBar1 = New DevExpress.XtraBars.Ribbon.RibbonStatusBar()
|
||||
Me.txtFilesProcessed = New DevExpress.XtraBars.BarStaticItem()
|
||||
Me.txtErrorsOccurred = New DevExpress.XtraBars.BarStaticItem()
|
||||
CType(Me.ListBoxControl1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.TrayMenu.SuspendLayout()
|
||||
@ -57,9 +60,9 @@
|
||||
'
|
||||
Me.RibbonControl1.CommandLayout = DevExpress.XtraBars.Ribbon.CommandLayout.Simplified
|
||||
Me.RibbonControl1.ExpandCollapseItem.Id = 0
|
||||
Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.btnSyncStart, Me.btnStopSync, Me.BarButtonItem1, Me.btnForceSync})
|
||||
Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.btnSyncStart, Me.btnStopSync, Me.BarButtonItem1, Me.btnForceSync, Me.txtFilesProcessed, Me.txtErrorsOccurred})
|
||||
Me.RibbonControl1.Location = New System.Drawing.Point(0, 0)
|
||||
Me.RibbonControl1.MaxItemId = 5
|
||||
Me.RibbonControl1.MaxItemId = 7
|
||||
Me.RibbonControl1.Name = "RibbonControl1"
|
||||
Me.RibbonControl1.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1})
|
||||
Me.RibbonControl1.ShowApplicationButton = DevExpress.Utils.DefaultBoolean.[False]
|
||||
@ -68,6 +71,7 @@
|
||||
Me.RibbonControl1.ShowPageHeadersMode = DevExpress.XtraBars.Ribbon.ShowPageHeadersMode.Hide
|
||||
Me.RibbonControl1.ShowToolbarCustomizeItem = False
|
||||
Me.RibbonControl1.Size = New System.Drawing.Size(632, 63)
|
||||
Me.RibbonControl1.StatusBar = Me.RibbonStatusBar1
|
||||
Me.RibbonControl1.Toolbar.ShowCustomizeItem = False
|
||||
'
|
||||
'btnSyncStart
|
||||
@ -92,6 +96,14 @@
|
||||
Me.BarButtonItem1.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonItem1.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
|
||||
Me.BarButtonItem1.Name = "BarButtonItem1"
|
||||
'
|
||||
'btnForceSync
|
||||
'
|
||||
Me.btnForceSync.Caption = "Sync Auslösen"
|
||||
Me.btnForceSync.Enabled = False
|
||||
Me.btnForceSync.Id = 4
|
||||
Me.btnForceSync.ImageOptions.SvgImage = CType(resources.GetObject("btnForceSync.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
|
||||
Me.btnForceSync.Name = "btnForceSync"
|
||||
'
|
||||
'RibbonPage1
|
||||
'
|
||||
Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroup2})
|
||||
@ -120,7 +132,7 @@
|
||||
'
|
||||
Me.TrayIcon.ContextMenuStrip = Me.TrayMenu
|
||||
Me.TrayIcon.Icon = CType(resources.GetObject("TrayIcon.Icon"), System.Drawing.Icon)
|
||||
Me.TrayIcon.Text = "sltSync"
|
||||
Me.TrayIcon.Text = "Connector"
|
||||
Me.TrayIcon.Visible = True
|
||||
'
|
||||
'TrayMenu
|
||||
@ -141,24 +153,39 @@
|
||||
Me.btnExit.Size = New System.Drawing.Size(184, 22)
|
||||
Me.btnExit.Text = "Beenden"
|
||||
'
|
||||
'btnForceSync
|
||||
'RibbonStatusBar1
|
||||
'
|
||||
Me.btnForceSync.Caption = "Sync Auslösen"
|
||||
Me.btnForceSync.Enabled = False
|
||||
Me.btnForceSync.Id = 4
|
||||
Me.btnForceSync.ImageOptions.SvgImage = CType(resources.GetObject("btnForceSync.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
|
||||
Me.btnForceSync.Name = "btnForceSync"
|
||||
Me.RibbonStatusBar1.ItemLinks.Add(Me.txtFilesProcessed)
|
||||
Me.RibbonStatusBar1.ItemLinks.Add(Me.txtErrorsOccurred)
|
||||
Me.RibbonStatusBar1.Location = New System.Drawing.Point(0, 254)
|
||||
Me.RibbonStatusBar1.Name = "RibbonStatusBar1"
|
||||
Me.RibbonStatusBar1.Ribbon = Me.RibbonControl1
|
||||
Me.RibbonStatusBar1.Size = New System.Drawing.Size(632, 24)
|
||||
'
|
||||
'txtFilesProcessed
|
||||
'
|
||||
Me.txtFilesProcessed.Caption = "Keine Dateien"
|
||||
Me.txtFilesProcessed.Id = 5
|
||||
Me.txtFilesProcessed.Name = "txtFilesProcessed"
|
||||
'
|
||||
'txtErrorsOccurred
|
||||
'
|
||||
Me.txtErrorsOccurred.Caption = "Keine Dateien"
|
||||
Me.txtErrorsOccurred.Id = 6
|
||||
Me.txtErrorsOccurred.Name = "txtErrorsOccurred"
|
||||
'
|
||||
'frmMain
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.ClientSize = New System.Drawing.Size(632, 278)
|
||||
Me.Controls.Add(Me.RibbonStatusBar1)
|
||||
Me.Controls.Add(Me.ListBoxControl1)
|
||||
Me.Controls.Add(Me.RibbonControl1)
|
||||
Me.IconOptions.SvgImage = CType(resources.GetObject("frmMain.IconOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
|
||||
Me.Name = "frmMain"
|
||||
Me.Ribbon = Me.RibbonControl1
|
||||
Me.StatusBar = Me.RibbonStatusBar1
|
||||
Me.Text = "Sync"
|
||||
CType(Me.ListBoxControl1, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
@ -182,6 +209,9 @@
|
||||
Friend WithEvents btnToggleWindow As ToolStripMenuItem
|
||||
Friend WithEvents btnExit As ToolStripMenuItem
|
||||
Friend WithEvents btnForceSync As DevExpress.XtraBars.BarButtonItem
|
||||
Friend WithEvents txtFilesProcessed As DevExpress.XtraBars.BarStaticItem
|
||||
Friend WithEvents txtErrorsOccurred As DevExpress.XtraBars.BarStaticItem
|
||||
Friend WithEvents RibbonStatusBar1 As DevExpress.XtraBars.Ribbon.RibbonStatusBar
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.Runtime.Remoting.Messaging
|
||||
Imports DevExpress.XtraEditors.ViewInfo
|
||||
Imports DigitalData.Modules.Config
|
||||
Imports DigitalData.Modules.Database
|
||||
@ -11,6 +12,25 @@ Partial Public Class frmMain
|
||||
Private Database As MSSQLServer
|
||||
Private Sync As ISync
|
||||
|
||||
Private FilesProcessed As Integer = 0
|
||||
Private ErrorsOccurred As Integer = 0
|
||||
|
||||
Public Enum LogLevel
|
||||
Info
|
||||
Warning
|
||||
[Error]
|
||||
End Enum
|
||||
|
||||
Private Class LogLine
|
||||
Public Message As String
|
||||
Public Level As LogLevel
|
||||
Public CreatedWhen As Date = Now
|
||||
|
||||
Public Overrides Function ToString() As String
|
||||
Return $"{CreatedWhen.ToShortDateString} {CreatedWhen.ToShortTimeString} {Message}"
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Public Sub New()
|
||||
InitializeComponent()
|
||||
End Sub
|
||||
@ -31,6 +51,7 @@ Partial Public Class frmMain
|
||||
|
||||
' Load Form Title from Module
|
||||
Text = Sync.Name
|
||||
TrayIcon.Text = Sync.Name
|
||||
|
||||
If Sync Is Nothing Then
|
||||
AddWarnEntry("ActiveModule '{0}' is not implemented!", ConfigManager.Config.ActiveModule)
|
||||
@ -60,7 +81,7 @@ Partial Public Class frmMain
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
AddWarnEntry($"Error while loading the application: {ex.Message}")
|
||||
AddErrorEntry($"Error while loading the application: {ex.Message}")
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
@ -128,17 +149,43 @@ Partial Public Class frmMain
|
||||
|
||||
Private Sub AddInfoEntry(pMessage As String, ParamArray pArgs As Object())
|
||||
Logger.Info(pMessage, pArgs)
|
||||
ListBoxControl1.Items.Add(Now & " " & String.Format(pMessage, pArgs))
|
||||
|
||||
Dim oItem = New LogLine With {
|
||||
.Message = String.Format(pMessage, pArgs),
|
||||
.Level = LogLevel.Info
|
||||
}
|
||||
|
||||
ListBoxControl1.Items.Add(oItem)
|
||||
ListBoxControl1.MakeItemVisible(ListBoxControl1.Items.Count - 1)
|
||||
End Sub
|
||||
|
||||
Private Sub AddWarnEntry(pMessage As String, ParamArray pArgs As Object())
|
||||
Logger.Info(pMessage, pArgs)
|
||||
ListBoxControl1.Items.Add(String.Format(pMessage, pArgs))
|
||||
|
||||
Dim oItem = New LogLine With {
|
||||
.Message = String.Format(pMessage, pArgs),
|
||||
.Level = LogLevel.Warning
|
||||
}
|
||||
|
||||
ListBoxControl1.Items.Add(oItem)
|
||||
End Sub
|
||||
|
||||
Private Sub AddErrorEntry(pMessage As String, ParamArray pArgs As Object())
|
||||
Logger.Info(pMessage, pArgs)
|
||||
|
||||
Dim oItem = New LogLine With {
|
||||
.Message = String.Format(pMessage, pArgs),
|
||||
.Level = LogLevel.Error
|
||||
}
|
||||
|
||||
ListBoxControl1.Items.Add(oItem)
|
||||
End Sub
|
||||
|
||||
Private Sub AddDivider()
|
||||
ListBoxControl1.Items.Add("=====================================")
|
||||
ListBoxControl1.Items.Add(New LogLine With {
|
||||
.Message = "-------------------------------------",
|
||||
.Level = LogLevel.Info
|
||||
})
|
||||
End Sub
|
||||
|
||||
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
|
||||
@ -185,4 +232,17 @@ Partial Public Class frmMain
|
||||
Await Sync.Run()
|
||||
btnForceSync.Enabled = True
|
||||
End Sub
|
||||
|
||||
Private Sub ListBoxControl1_DrawItem(sender As Object, e As DevExpress.XtraEditors.ListBoxDrawItemEventArgs) Handles ListBoxControl1.DrawItem
|
||||
Dim oItem As LogLine = DirectCast(e.Item, LogLine)
|
||||
|
||||
Select Case oItem.Level
|
||||
Case LogLevel.Warning
|
||||
e.Appearance.ForeColor = Color.DarkOrange
|
||||
e.Appearance.FontStyleDelta = FontStyle.Bold
|
||||
Case LogLevel.Error
|
||||
e.Appearance.ForeColor = Color.DarkRed
|
||||
e.Appearance.FontStyleDelta = FontStyle.Bold
|
||||
End Select
|
||||
End Sub
|
||||
End Class
|
||||
Loading…
x
Reference in New Issue
Block a user