Compare commits

...

2 Commits

Author SHA1 Message Date
Jonathan Jenne
775418fb7a 15-08-2023 2023-08-15 12:40:49 +02:00
Jonathan Jenne
3fa731fe5f 14-08-2023 2023-08-14 16:48:21 +02:00
7 changed files with 143 additions and 38 deletions

View File

@ -24,6 +24,8 @@
Public Property SQLQueryFetch As String = "" Public Property SQLQueryFetch As String = ""
Public Property OutputDirectory As String = "" Public Property OutputDirectory As String = ""
Public Property AddDateSubDirectory As Boolean = False
Public Property TimerIntervalMin As Integer = 0 Public Property TimerIntervalMin As Integer = 0
Public Property Debug As Boolean = False Public Property Debug As Boolean = False

View File

@ -19,6 +19,7 @@ Public MustInherit Class BaseModule
Public MustOverride Function TestConfigIsComplete() As Boolean Implements ISync.TestConfigIsComplete Public MustOverride Function TestConfigIsComplete() As Boolean Implements ISync.TestConfigIsComplete
Public Event OnLogEntry As EventHandler(Of String) Implements ISync.OnLogEntry 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) Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pConfig As Config)
MyBase.New(pLogConfig) MyBase.New(pLogConfig)
@ -64,6 +65,24 @@ Public MustInherit Class BaseModule
Return StringEx.ConvertTextToSlug(oName) & oExtension Return StringEx.ConvertTextToSlug(oName) & oExtension
End Function End Function
Friend Function GetFinalFileName(pFileName As String, pId As String) As String
Dim oExtension = Path.GetExtension(pFileName)
Return pId & oExtension
End Function
Friend Function GetFinalFilePath(pFileName As String) As String
If Config.AddDateSubDirectory Then
Dim oSubPath = FileEx.CreateDateDirectory(Config.OutputDirectory)
If oSubPath Is Nothing Then
Throw New ApplicationException("Output sub path could not be created!")
End If
Logger.Debug("Subdirectory [{0}] created.", oSubPath)
Return Path.Combine(oSubPath, pFileName)
Else
Return Path.Combine(Config.OutputDirectory, pFileName)
End If
End Function
Friend Function CopyFileToOutputPath(pFileContents As Byte(), pFilePath As String) As Boolean Friend Function CopyFileToOutputPath(pFileContents As Byte(), pFilePath As String) As Boolean
Try Try
Using oStream As New MemoryStream(pFileContents) Using oStream As New MemoryStream(pFileContents)
@ -118,4 +137,8 @@ Public MustInherit Class BaseModule
Friend Sub AddDivider() Friend Sub AddDivider()
RaiseEvent OnLogEntry(Me, "---") RaiseEvent OnLogEntry(Me, "---")
End Sub End Sub
Friend Sub RaiseFileProcessed(pFilePath As String)
RaiseEvent OnFileProcessed(Me, pFilePath)
End Sub
End Class End Class

View File

@ -8,4 +8,5 @@ Public Interface ISync
Function TestConfigIsComplete() As Boolean Function TestConfigIsComplete() As Boolean
Event OnLogEntry As EventHandler(Of String) Event OnLogEntry As EventHandler(Of String)
Event OnFileProcessed As EventHandler(Of String)
End Interface End Interface

View File

@ -10,8 +10,6 @@ Namespace Sharepoint
Inherits BaseModule Inherits BaseModule
Implements ISync Implements ISync
Private Const STRING1_PLACEHOLDER = "[String1]"
Public Overrides Property Name As String = "Sharepoint Sync" Public Overrides Property Name As String = "Sharepoint Sync"
Public Overrides Property IsLoggedIn As Boolean Public Overrides Property IsLoggedIn As Boolean
@ -45,33 +43,24 @@ Namespace Sharepoint
Logger.Info("ExtDocId: [{0}]", oDocument.Id) Logger.Info("ExtDocId: [{0}]", oDocument.Id)
Dim oFileName = ConvertFilenameToSlug(oDocument.Name) Dim oFileName = ConvertFilenameToSlug(oDocument.Name)
Dim oSubPath = FileEx.CreateDateDirectory(Config.OutputDirectory) Dim oTempFileName = GetFinalFileName(oDocument.Name, oDocument.Id)
If oSubPath Is Nothing Then Dim oFilePath = GetFinalFilePath(oTempFileName)
Throw New ApplicationException("Output sub path could not be created!")
End If
Dim oFilePath = Path.Combine(oSubPath, oFileName)
Logger.Debug("Subdirectory [{0}] created.", oSubPath)
If CopyFileToOutputPath(oDocument.Data, oFilePath) = False Then If CopyFileToOutputPath(oDocument.Data, oFilePath) = False Then
Throw New ApplicationException("File could not be created in output path!") Throw New ApplicationException("File could not be created in output path!")
End If End If
Dim oSQL = String.Format(Config.SQLQueryExport, oDocument.Id, oFileName) Dim oSQL = String.Format(Config.SQLQueryExport, oDocument.Id, oFileName)
If oSQL.Contains(STRING1_PLACEHOLDER) Then
oSQL.Replace(STRING1_PLACEHOLDER, oDocument.Path)
End If
Await Database.ExecuteNonQueryAsync(oSQL) Await Database.ExecuteNonQueryAsync(oSQL)
RaiseFileProcessed(oFilePath)
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) Logger.Error(ex)
AddWarnEntry("Error while running Sync: " & ex.Message) AddWarnEntry("Error while running Sync: " & ex.Message)
End Try End Try
Next Next
'TODO
AddInfoEntry("Finished Sync.") AddInfoEntry("Finished Sync.")
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) Logger.Error(ex)

View File

@ -53,14 +53,10 @@ Namespace slt
AddInfoEntry("Document: [{0}]", oDocument.Name) AddInfoEntry("Document: [{0}]", oDocument.Name)
Logger.Info("ExtDocId: [{0}]", oDocument.ExtDocId) Logger.Info("ExtDocId: [{0}]", oDocument.ExtDocId)
Dim oDocumentName = GetFilenameWithExtension(oDocument.Name, oDocument.DocMimeType) Dim oDocumentName = GetFilenameWithExtension(oDocument.ExtDocId, oDocument.DocMimeType)
Dim oFileName = ConvertFilenameToSlug(oDocumentName) Dim oFileName = ConvertFilenameToSlug(oDocumentName)
Dim oSubPath = FileEx.CreateDateDirectory(Config.OutputDirectory) Dim oTempFileName = GetFinalFileName(oFileName, oDocument.ExtDocId)
If oSubPath Is Nothing Then Dim oFilePath = GetFinalFilePath(oFileName)
Throw New ApplicationException("Output sub path could not be created!")
End If
Dim oFilePath = Path.Combine(oSubPath, oFileName)
Logger.Debug("Subdirectory [{0}] created.", oSubPath)
If CopyFileToOutputPath(oDocument.Data, oFilePath) = False Then If CopyFileToOutputPath(oDocument.Data, oFilePath) = False Then
Throw New ApplicationException("File could not be created in output path!") Throw New ApplicationException("File could not be created in output path!")
@ -69,6 +65,8 @@ Namespace slt
Dim oSQL = String.Format(Config.SQLQueryExport, oDocument.ExtDocId, oFileName) Dim oSQL = String.Format(Config.SQLQueryExport, oDocument.ExtDocId, oFileName)
Await Database.ExecuteNonQueryAsync(oSQL) Await Database.ExecuteNonQueryAsync(oSQL)
RaiseFileProcessed(oFilePath)
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) Logger.Error(ex)
AddWarnEntry("Error while running Sync: " & ex.Message) AddWarnEntry("Error while running Sync: " & ex.Message)

View File

@ -31,6 +31,7 @@
Me.btnSyncStart = New DevExpress.XtraBars.BarButtonItem() Me.btnSyncStart = New DevExpress.XtraBars.BarButtonItem()
Me.btnStopSync = New DevExpress.XtraBars.BarButtonItem() Me.btnStopSync = New DevExpress.XtraBars.BarButtonItem()
Me.BarButtonItem1 = New DevExpress.XtraBars.BarButtonItem() Me.BarButtonItem1 = New DevExpress.XtraBars.BarButtonItem()
Me.btnForceSync = New DevExpress.XtraBars.BarButtonItem()
Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage() Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage()
Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.RibbonPageGroup2 = 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.TrayMenu = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.btnToggleWindow = New System.Windows.Forms.ToolStripMenuItem() Me.btnToggleWindow = New System.Windows.Forms.ToolStripMenuItem()
Me.btnExit = 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.ListBoxControl1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.TrayMenu.SuspendLayout() Me.TrayMenu.SuspendLayout()
@ -57,9 +60,9 @@
' '
Me.RibbonControl1.CommandLayout = DevExpress.XtraBars.Ribbon.CommandLayout.Simplified Me.RibbonControl1.CommandLayout = DevExpress.XtraBars.Ribbon.CommandLayout.Simplified
Me.RibbonControl1.ExpandCollapseItem.Id = 0 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.Location = New System.Drawing.Point(0, 0)
Me.RibbonControl1.MaxItemId = 5 Me.RibbonControl1.MaxItemId = 7
Me.RibbonControl1.Name = "RibbonControl1" Me.RibbonControl1.Name = "RibbonControl1"
Me.RibbonControl1.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1}) Me.RibbonControl1.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1})
Me.RibbonControl1.ShowApplicationButton = DevExpress.Utils.DefaultBoolean.[False] Me.RibbonControl1.ShowApplicationButton = DevExpress.Utils.DefaultBoolean.[False]
@ -68,6 +71,7 @@
Me.RibbonControl1.ShowPageHeadersMode = DevExpress.XtraBars.Ribbon.ShowPageHeadersMode.Hide Me.RibbonControl1.ShowPageHeadersMode = DevExpress.XtraBars.Ribbon.ShowPageHeadersMode.Hide
Me.RibbonControl1.ShowToolbarCustomizeItem = False Me.RibbonControl1.ShowToolbarCustomizeItem = False
Me.RibbonControl1.Size = New System.Drawing.Size(632, 63) Me.RibbonControl1.Size = New System.Drawing.Size(632, 63)
Me.RibbonControl1.StatusBar = Me.RibbonStatusBar1
Me.RibbonControl1.Toolbar.ShowCustomizeItem = False Me.RibbonControl1.Toolbar.ShowCustomizeItem = False
' '
'btnSyncStart 'btnSyncStart
@ -92,6 +96,14 @@
Me.BarButtonItem1.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonItem1.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) Me.BarButtonItem1.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonItem1.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
Me.BarButtonItem1.Name = "BarButtonItem1" 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 'RibbonPage1
' '
Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroup2}) Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroup2})
@ -120,7 +132,7 @@
' '
Me.TrayIcon.ContextMenuStrip = Me.TrayMenu Me.TrayIcon.ContextMenuStrip = Me.TrayMenu
Me.TrayIcon.Icon = CType(resources.GetObject("TrayIcon.Icon"), System.Drawing.Icon) Me.TrayIcon.Icon = CType(resources.GetObject("TrayIcon.Icon"), System.Drawing.Icon)
Me.TrayIcon.Text = "sltSync" Me.TrayIcon.Text = "Connector"
Me.TrayIcon.Visible = True Me.TrayIcon.Visible = True
' '
'TrayMenu 'TrayMenu
@ -141,24 +153,39 @@
Me.btnExit.Size = New System.Drawing.Size(184, 22) Me.btnExit.Size = New System.Drawing.Size(184, 22)
Me.btnExit.Text = "Beenden" Me.btnExit.Text = "Beenden"
' '
'btnForceSync 'RibbonStatusBar1
' '
Me.btnForceSync.Caption = "Sync Auslösen" Me.RibbonStatusBar1.ItemLinks.Add(Me.txtFilesProcessed)
Me.btnForceSync.Enabled = False Me.RibbonStatusBar1.ItemLinks.Add(Me.txtErrorsOccurred)
Me.btnForceSync.Id = 4 Me.RibbonStatusBar1.Location = New System.Drawing.Point(0, 254)
Me.btnForceSync.ImageOptions.SvgImage = CType(resources.GetObject("btnForceSync.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) Me.RibbonStatusBar1.Name = "RibbonStatusBar1"
Me.btnForceSync.Name = "btnForceSync" 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 'frmMain
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(632, 278) Me.ClientSize = New System.Drawing.Size(632, 278)
Me.Controls.Add(Me.RibbonStatusBar1)
Me.Controls.Add(Me.ListBoxControl1) Me.Controls.Add(Me.ListBoxControl1)
Me.Controls.Add(Me.RibbonControl1) Me.Controls.Add(Me.RibbonControl1)
Me.IconOptions.SvgImage = CType(resources.GetObject("frmMain.IconOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) Me.IconOptions.SvgImage = CType(resources.GetObject("frmMain.IconOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
Me.Name = "frmMain" Me.Name = "frmMain"
Me.Ribbon = Me.RibbonControl1 Me.Ribbon = Me.RibbonControl1
Me.StatusBar = Me.RibbonStatusBar1
Me.Text = "Sync" Me.Text = "Sync"
CType(Me.ListBoxControl1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.ListBoxControl1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).EndInit()
@ -182,6 +209,9 @@
Friend WithEvents btnToggleWindow As ToolStripMenuItem Friend WithEvents btnToggleWindow As ToolStripMenuItem
Friend WithEvents btnExit As ToolStripMenuItem Friend WithEvents btnExit As ToolStripMenuItem
Friend WithEvents btnForceSync As DevExpress.XtraBars.BarButtonItem 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 #End Region

View File

@ -1,4 +1,5 @@
Imports System.ComponentModel Imports System.ComponentModel
Imports System.Runtime.Remoting.Messaging
Imports DevExpress.XtraEditors.ViewInfo Imports DevExpress.XtraEditors.ViewInfo
Imports DigitalData.Modules.Config Imports DigitalData.Modules.Config
Imports DigitalData.Modules.Database Imports DigitalData.Modules.Database
@ -11,6 +12,25 @@ Partial Public Class frmMain
Private Database As MSSQLServer Private Database As MSSQLServer
Private Sync As ISync 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() Public Sub New()
InitializeComponent() InitializeComponent()
End Sub End Sub
@ -24,7 +44,6 @@ Partial Public Class frmMain
AddInfoEntry("Application started.") AddInfoEntry("Application started.")
AddInfoEntry("Version: {0}", Application.ProductVersion) AddInfoEntry("Version: {0}", Application.ProductVersion)
AddInfoEntry("Timer Interval: {0} min", ConfigManager.Config.TimerIntervalMin.ToString)
AddDivider() AddDivider()
Database = New MSSQLServer(LogConfig, ConfigManager.Config.ConnectionString) Database = New MSSQLServer(LogConfig, ConfigManager.Config.ConnectionString)
@ -32,6 +51,7 @@ Partial Public Class frmMain
' Load Form Title from Module ' Load Form Title from Module
Text = Sync.Name Text = Sync.Name
TrayIcon.Text = Sync.Name
If Sync Is Nothing Then If Sync Is Nothing Then
AddWarnEntry("ActiveModule '{0}' is not implemented!", ConfigManager.Config.ActiveModule) AddWarnEntry("ActiveModule '{0}' is not implemented!", ConfigManager.Config.ActiveModule)
@ -52,13 +72,16 @@ Partial Public Class frmMain
End If End If
If ConfigManager.Config.TimerIntervalMin > 0 Then If ConfigManager.Config.TimerIntervalMin > 0 Then
AddInfoEntry("Timer Interval: {0} min", ConfigManager.Config.TimerIntervalMin.ToString)
SyncTimer.Interval = ConfigManager.Config.TimerIntervalMin * 60 * 1_000 SyncTimer.Interval = ConfigManager.Config.TimerIntervalMin * 60 * 1_000
StartTimer() StartTimer()
Else
AddInfoEntry("Timer Interval: Off", ConfigManager.Config.TimerIntervalMin.ToString)
End If End If
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) Logger.Error(ex)
AddWarnEntry($"Error while loading the application: {ex.Message}") AddErrorEntry($"Error while loading the application: {ex.Message}")
End Try End Try
End Sub End Sub
@ -126,17 +149,43 @@ Partial Public Class frmMain
Private Sub AddInfoEntry(pMessage As String, ParamArray pArgs As Object()) Private Sub AddInfoEntry(pMessage As String, ParamArray pArgs As Object())
Logger.Info(pMessage, pArgs) 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) ListBoxControl1.MakeItemVisible(ListBoxControl1.Items.Count - 1)
End Sub End Sub
Private Sub AddWarnEntry(pMessage As String, ParamArray pArgs As Object()) Private Sub AddWarnEntry(pMessage As String, ParamArray pArgs As Object())
Logger.Info(pMessage, pArgs) 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 End Sub
Private Sub AddDivider() Private Sub AddDivider()
ListBoxControl1.Items.Add("=====================================") ListBoxControl1.Items.Add(New LogLine With {
.Message = "-------------------------------------",
.Level = LogLevel.Info
})
End Sub End Sub
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
@ -183,4 +232,17 @@ Partial Public Class frmMain
Await Sync.Run() Await Sync.Run()
btnForceSync.Enabled = True btnForceSync.Enabled = True
End Sub End Sub
End Class
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