diff --git a/ClipboardWatcher/frmMatch.vb b/ClipboardWatcher/frmMatch.vb index 9251d594..88760bdc 100644 --- a/ClipboardWatcher/frmMatch.vb +++ b/ClipboardWatcher/frmMatch.vb @@ -207,7 +207,7 @@ Public Class frmMatch Dim oNameSlug = Language.Utils.ConvertTextToSlug(Profile.Name) Dim oSearchGuids = Searches.Select(Function(s) s.Guid).ToArray Dim oWindowGuid = $"{Profile.Guid}-{oNameSlug}-{String.Join("-", oSearchGuids)}" - Dim oParams = New ResultListParams() With { + Dim oParams = New DocumentResultParams() With { .WindowGuid = oWindowGuid } @@ -246,24 +246,24 @@ Public Class frmMatch Dim oShouldOpenAgain As Boolean = False Dim oThisForm = New List(Of IResultForm) From {sender} - If TypeOf sender Is frmResult Then - For Each oForm As IResultForm In OpenForms - ' Determine if frmProfileMatch should be shown - If oForm.ShouldReturnToMatchForm Then - oShouldOpenAgain = True - End If - Next - End If + 'If TypeOf sender Is frmResult Then + ' For Each oForm As IResultForm In OpenForms + ' ' Determine if frmProfileMatch should be shown + ' If oForm.ShouldReturnToMatchForm Then + ' oShouldOpenAgain = True + ' End If + ' Next + 'End If - ' If frmProfileMatch should be shown, close all windows of this profile - If oShouldOpenAgain Then - For Each oForm As Form In OpenForms.Except(oThisForm) - ' Remove the Handler to prevent a loop - RemoveHandler oForm.FormClosed, AddressOf ProfileResultForm_Closed - oForm.Close() - Next + '' If frmProfileMatch should be shown, close all windows of this profile + 'If oShouldOpenAgain Then + ' For Each oForm As Form In OpenForms.Except(oThisForm) + ' ' Remove the Handler to prevent a loop + ' RemoveHandler oForm.FormClosed, AddressOf ProfileResultForm_Closed + ' oForm.Close() + ' Next - Show() - End If + ' Show() + 'End If End Sub End Class diff --git a/Common/Base/ClassMessageBox.vb b/Common/Base/ClassMessageBox.vb new file mode 100644 index 00000000..287a23de --- /dev/null +++ b/Common/Base/ClassMessageBox.vb @@ -0,0 +1,67 @@ +Imports System.Reflection +Imports System.Windows.Forms +Imports DigitalData.Modules.Logging + +Namespace Base + Public Class ClassMessageBox + Private _Logger As Logger + Private _Form As Form + + Private Const UNKNOWN_METHOD = "Unknown Method" + Private Const UNKNOWN_FORM = "Unknown Form" + + Public Sub New(Logger As Logger, Form As Form) + _Logger = Logger + _Form = Form + End Sub + + Public Sub ShowErrorMessage(Exception As Exception) + _Logger.Error(Exception) + MsgBox(GetMessage(Exception), MsgBoxStyle.Critical, _Form.Text) + End Sub + + Private Function GetMessage(Exception As Exception) As String + Dim oTargetSite = Exception.TargetSite + Dim oMethodName = GetMethodName(Exception) + Dim oFormName = GetFormName(Exception) + Dim oMessage As String = String.Empty + + oMessage &= $"Form: {oFormName}{vbNewLine}" + oMessage &= $"Method: {oMethodName}{vbNewLine}" + + If Not String.IsNullOrEmpty(Exception.StackTrace) Then + oMessage &= $"Message: {Exception.Message}{vbNewLine}{vbNewLine}" + End If + + If Not String.IsNullOrEmpty(Exception.StackTrace) Then + oMessage &= $"Stacktrace: {Exception.StackTrace}{vbNewLine}" + End If + + oMessage &= $"{vbNewLine}" + oMessage &= $"Please report this error to error@digitaldata.works" + + Return oMessage + End Function + + Private Function GetMethodName(Exception As Exception) As String + Dim oMethodName = Exception.TargetSite?.ReflectedType?.Name + + If oMethodName Is Nothing Then + Return UNKNOWN_METHOD + Else + Return oMethodName + End If + End Function + + Private Function GetFormName(Exception As Exception) As String + Dim oFormName = Exception.TargetSite?.ReflectedType?.ReflectedType?.Name + + If oFormName Is Nothing Then + Return UNKNOWN_FORM + Else + Return oFormName + End If + End Function + End Class + +End Namespace diff --git a/Common/Common.vbproj b/Common/Common.vbproj index 6462d855..0f1da2c6 100644 --- a/Common/Common.vbproj +++ b/Common/Common.vbproj @@ -85,17 +85,13 @@ - - + + + + frmDocumentResultList.vb - - Form - - - frmResult.vb - - + Form @@ -117,12 +113,9 @@ - + frmDocumentResultList.vb - - frmResult.vb - VbMyResourcesResXFileCodeGenerator diff --git a/Common/DocumentResultConfig.vb b/Common/DocumentResultList/DocumentResultConfig.vb similarity index 100% rename from Common/DocumentResultConfig.vb rename to Common/DocumentResultList/DocumentResultConfig.vb diff --git a/Common/DocumentResultList/DocumentResultParams.vb b/Common/DocumentResultList/DocumentResultParams.vb new file mode 100644 index 00000000..dc7b0869 --- /dev/null +++ b/Common/DocumentResultList/DocumentResultParams.vb @@ -0,0 +1,12 @@ +Public Class DocumentResultParams + ''' + ''' WindowGuid is used to save layout data + ''' + Public WindowGuid As String + Public Results As New List(Of DocumentResult) +End Class + +Public Class DocumentResult + Public Title As String + Public Datatable As DataTable +End Class diff --git a/Common/frmDocumentResultList.Designer.vb b/Common/DocumentResultList/frmDocumentResultList.Designer.vb similarity index 100% rename from Common/frmDocumentResultList.Designer.vb rename to Common/DocumentResultList/frmDocumentResultList.Designer.vb diff --git a/Common/frmDocumentResultList.resx b/Common/DocumentResultList/frmDocumentResultList.resx similarity index 100% rename from Common/frmDocumentResultList.resx rename to Common/DocumentResultList/frmDocumentResultList.resx diff --git a/Common/frmDocumentResultList.vb b/Common/DocumentResultList/frmDocumentResultList.vb similarity index 99% rename from Common/frmDocumentResultList.vb rename to Common/DocumentResultList/frmDocumentResultList.vb index efd55c49..83489ed5 100644 --- a/Common/frmDocumentResultList.vb +++ b/Common/DocumentResultList/frmDocumentResultList.vb @@ -20,7 +20,7 @@ Public Class frmDocumentResultList Private _IsLoading As Boolean = True - Public Sub New(LogConfig As LogConfig, Environment As Environment, Params As ResultListParams) + Public Sub New(LogConfig As LogConfig, Environment As Environment, Params As DocumentResultParams) ' Dieser Aufruf ist für den Designer erforderlich. InitializeComponent() diff --git a/Common/ResultListParams.vb b/Common/ResultListParams.vb index e6e569b0..8d945c1e 100644 --- a/Common/ResultListParams.vb +++ b/Common/ResultListParams.vb @@ -1,12 +1,12 @@ -Public Class ResultListParams +Public Class DataResultListParams ''' ''' WindowGuid is used to save layout data ''' Public WindowGuid As String - Public Results As New List(Of DocumentResult) + Public Results As New List(Of DataResult) End Class -Public Class DocumentResult +Public Class DataResult Public Title As String Public Datatable As DataTable -End Class +End Class \ No newline at end of file diff --git a/Common/frmResult.Designer.vb b/Common/frmResult.Designer.vb deleted file mode 100644 index e11478ba..00000000 --- a/Common/frmResult.Designer.vb +++ /dev/null @@ -1,335 +0,0 @@ - _ -Partial Class frmResult - Inherits DevExpress.XtraEditors.XtraForm - - 'Form overrides dispose to clean up the component list. - _ - Protected Overrides Sub Dispose(ByVal disposing As Boolean) - If disposing AndAlso components IsNot Nothing Then - components.Dispose() - End If - MyBase.Dispose(disposing) - End Sub - - 'Required by the Windows Form Designer - Private components As System.ComponentModel.IContainer - - 'NOTE: The following procedure is required by the Windows Form Designer - 'It can be modified using the Windows Form Designer. - 'Do not modify it using the code editor. - _ - Private Sub InitializeComponent() - Me.components = New System.ComponentModel.Container() - Me.XtraTabControl = New DevExpress.XtraTab.XtraTabControl() - Me.XtraTabPage1 = New DevExpress.XtraTab.XtraTabPage() - Me.GridControl1 = New DevExpress.XtraGrid.GridControl() - Me.GridView1 = New DevExpress.XtraGrid.Views.Grid.GridView() - Me.BarManager1 = New DevExpress.XtraBars.BarManager(Me.components) - Me.Bar2 = New DevExpress.XtraBars.Bar() - Me.BarButtonItem1 = New DevExpress.XtraBars.BarButtonItem() - Me.Bar3 = New DevExpress.XtraBars.Bar() - Me.LabelStatus = New DevExpress.XtraBars.BarStaticItem() - Me.barDockControlTop = New DevExpress.XtraBars.BarDockControl() - Me.barDockControlBottom = New DevExpress.XtraBars.BarDockControl() - Me.barDockControlLeft = New DevExpress.XtraBars.BarDockControl() - Me.barDockControlRight = New DevExpress.XtraBars.BarDockControl() - Me.XtraTabPage2 = New DevExpress.XtraTab.XtraTabPage() - Me.GridControl2 = New DevExpress.XtraGrid.GridControl() - Me.GridView2 = New DevExpress.XtraGrid.Views.Grid.GridView() - Me.XtraTabPage3 = New DevExpress.XtraTab.XtraTabPage() - Me.GridControl3 = New DevExpress.XtraGrid.GridControl() - Me.GridView3 = New DevExpress.XtraGrid.Views.Grid.GridView() - Me.XtraTabPage4 = New DevExpress.XtraTab.XtraTabPage() - Me.GridControl4 = New DevExpress.XtraGrid.GridControl() - Me.GridView4 = New DevExpress.XtraGrid.Views.Grid.GridView() - Me.XtraTabPage5 = New DevExpress.XtraTab.XtraTabPage() - Me.GridControl5 = New DevExpress.XtraGrid.GridControl() - Me.GridView5 = New DevExpress.XtraGrid.Views.Grid.GridView() - CType(Me.XtraTabControl, System.ComponentModel.ISupportInitialize).BeginInit() - Me.XtraTabControl.SuspendLayout() - Me.XtraTabPage1.SuspendLayout() - CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.GridView1, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.BarManager1, System.ComponentModel.ISupportInitialize).BeginInit() - Me.XtraTabPage2.SuspendLayout() - CType(Me.GridControl2, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.GridView2, System.ComponentModel.ISupportInitialize).BeginInit() - Me.XtraTabPage3.SuspendLayout() - CType(Me.GridControl3, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.GridView3, System.ComponentModel.ISupportInitialize).BeginInit() - Me.XtraTabPage4.SuspendLayout() - CType(Me.GridControl4, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.GridView4, System.ComponentModel.ISupportInitialize).BeginInit() - Me.XtraTabPage5.SuspendLayout() - CType(Me.GridControl5, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.GridView5, System.ComponentModel.ISupportInitialize).BeginInit() - Me.SuspendLayout() - ' - 'XtraTabControl - ' - Me.XtraTabControl.Dock = System.Windows.Forms.DockStyle.Fill - Me.XtraTabControl.Location = New System.Drawing.Point(0, 20) - Me.XtraTabControl.Name = "XtraTabControl" - Me.XtraTabControl.SelectedTabPage = Me.XtraTabPage1 - Me.XtraTabControl.Size = New System.Drawing.Size(796, 483) - Me.XtraTabControl.TabIndex = 0 - Me.XtraTabControl.TabPages.AddRange(New DevExpress.XtraTab.XtraTabPage() {Me.XtraTabPage1, Me.XtraTabPage2, Me.XtraTabPage3, Me.XtraTabPage4, Me.XtraTabPage5}) - ' - 'XtraTabPage1 - ' - Me.XtraTabPage1.Controls.Add(Me.GridControl1) - Me.XtraTabPage1.Name = "XtraTabPage1" - Me.XtraTabPage1.Size = New System.Drawing.Size(790, 455) - Me.XtraTabPage1.Text = "XtraTabPage1" - ' - 'GridControl1 - ' - Me.GridControl1.Dock = System.Windows.Forms.DockStyle.Fill - Me.GridControl1.Location = New System.Drawing.Point(0, 0) - Me.GridControl1.MainView = Me.GridView1 - Me.GridControl1.MenuManager = Me.BarManager1 - Me.GridControl1.Name = "GridControl1" - Me.GridControl1.Size = New System.Drawing.Size(790, 455) - Me.GridControl1.TabIndex = 0 - Me.GridControl1.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridView1}) - ' - 'GridView1 - ' - Me.GridView1.GridControl = Me.GridControl1 - Me.GridView1.Name = "GridView1" - ' - 'BarManager1 - ' - Me.BarManager1.Bars.AddRange(New DevExpress.XtraBars.Bar() {Me.Bar2, Me.Bar3}) - Me.BarManager1.DockControls.Add(Me.barDockControlTop) - Me.BarManager1.DockControls.Add(Me.barDockControlBottom) - Me.BarManager1.DockControls.Add(Me.barDockControlLeft) - Me.BarManager1.DockControls.Add(Me.barDockControlRight) - Me.BarManager1.Form = Me - Me.BarManager1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.BarButtonItem1, Me.LabelStatus}) - Me.BarManager1.MainMenu = Me.Bar2 - Me.BarManager1.MaxItemId = 2 - Me.BarManager1.StatusBar = Me.Bar3 - ' - 'Bar2 - ' - Me.Bar2.BarName = "Hauptmenü" - Me.Bar2.DockCol = 0 - Me.Bar2.DockRow = 0 - Me.Bar2.DockStyle = DevExpress.XtraBars.BarDockStyle.Top - Me.Bar2.LinksPersistInfo.AddRange(New DevExpress.XtraBars.LinkPersistInfo() {New DevExpress.XtraBars.LinkPersistInfo(Me.BarButtonItem1)}) - Me.Bar2.OptionsBar.DisableClose = True - Me.Bar2.OptionsBar.DrawBorder = False - Me.Bar2.OptionsBar.UseWholeRow = True - Me.Bar2.Text = "Hauptmenü" - ' - 'BarButtonItem1 - ' - Me.BarButtonItem1.Caption = "Zurück zur Profilauswahl" - Me.BarButtonItem1.Id = 0 - Me.BarButtonItem1.Name = "BarButtonItem1" - ' - 'Bar3 - ' - Me.Bar3.BarName = "Statusleiste" - Me.Bar3.CanDockStyle = DevExpress.XtraBars.BarCanDockStyle.Bottom - Me.Bar3.DockCol = 0 - Me.Bar3.DockRow = 0 - Me.Bar3.DockStyle = DevExpress.XtraBars.BarDockStyle.Bottom - Me.Bar3.LinksPersistInfo.AddRange(New DevExpress.XtraBars.LinkPersistInfo() {New DevExpress.XtraBars.LinkPersistInfo(Me.LabelStatus)}) - Me.Bar3.OptionsBar.AllowQuickCustomization = False - Me.Bar3.OptionsBar.DrawDragBorder = False - Me.Bar3.OptionsBar.UseWholeRow = True - Me.Bar3.Text = "Statusleiste" - ' - 'LabelStatus - ' - Me.LabelStatus.Caption = "Status" - Me.LabelStatus.Id = 1 - Me.LabelStatus.Name = "LabelStatus" - ' - 'barDockControlTop - ' - Me.barDockControlTop.CausesValidation = False - Me.barDockControlTop.Dock = System.Windows.Forms.DockStyle.Top - Me.barDockControlTop.Location = New System.Drawing.Point(0, 0) - Me.barDockControlTop.Manager = Me.BarManager1 - Me.barDockControlTop.Size = New System.Drawing.Size(796, 20) - ' - 'barDockControlBottom - ' - Me.barDockControlBottom.CausesValidation = False - Me.barDockControlBottom.Dock = System.Windows.Forms.DockStyle.Bottom - Me.barDockControlBottom.Location = New System.Drawing.Point(0, 503) - Me.barDockControlBottom.Manager = Me.BarManager1 - Me.barDockControlBottom.Size = New System.Drawing.Size(796, 25) - ' - 'barDockControlLeft - ' - Me.barDockControlLeft.CausesValidation = False - Me.barDockControlLeft.Dock = System.Windows.Forms.DockStyle.Left - Me.barDockControlLeft.Location = New System.Drawing.Point(0, 20) - Me.barDockControlLeft.Manager = Me.BarManager1 - Me.barDockControlLeft.Size = New System.Drawing.Size(0, 483) - ' - 'barDockControlRight - ' - Me.barDockControlRight.CausesValidation = False - Me.barDockControlRight.Dock = System.Windows.Forms.DockStyle.Right - Me.barDockControlRight.Location = New System.Drawing.Point(796, 20) - Me.barDockControlRight.Manager = Me.BarManager1 - Me.barDockControlRight.Size = New System.Drawing.Size(0, 483) - ' - 'XtraTabPage2 - ' - Me.XtraTabPage2.Controls.Add(Me.GridControl2) - Me.XtraTabPage2.Name = "XtraTabPage2" - Me.XtraTabPage2.Size = New System.Drawing.Size(790, 455) - Me.XtraTabPage2.Text = "XtraTabPage2" - ' - 'GridControl2 - ' - Me.GridControl2.Dock = System.Windows.Forms.DockStyle.Fill - Me.GridControl2.Location = New System.Drawing.Point(0, 0) - Me.GridControl2.MainView = Me.GridView2 - Me.GridControl2.MenuManager = Me.BarManager1 - Me.GridControl2.Name = "GridControl2" - Me.GridControl2.Size = New System.Drawing.Size(790, 455) - Me.GridControl2.TabIndex = 0 - Me.GridControl2.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridView2}) - ' - 'GridView2 - ' - Me.GridView2.GridControl = Me.GridControl2 - Me.GridView2.Name = "GridView2" - ' - 'XtraTabPage3 - ' - Me.XtraTabPage3.Controls.Add(Me.GridControl3) - Me.XtraTabPage3.Name = "XtraTabPage3" - Me.XtraTabPage3.Size = New System.Drawing.Size(790, 455) - Me.XtraTabPage3.Text = "XtraTabPage3" - ' - 'GridControl3 - ' - Me.GridControl3.Dock = System.Windows.Forms.DockStyle.Fill - Me.GridControl3.Location = New System.Drawing.Point(0, 0) - Me.GridControl3.MainView = Me.GridView3 - Me.GridControl3.MenuManager = Me.BarManager1 - Me.GridControl3.Name = "GridControl3" - Me.GridControl3.Size = New System.Drawing.Size(790, 455) - Me.GridControl3.TabIndex = 0 - Me.GridControl3.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridView3}) - ' - 'GridView3 - ' - Me.GridView3.GridControl = Me.GridControl3 - Me.GridView3.Name = "GridView3" - ' - 'XtraTabPage4 - ' - Me.XtraTabPage4.Controls.Add(Me.GridControl4) - Me.XtraTabPage4.Name = "XtraTabPage4" - Me.XtraTabPage4.Size = New System.Drawing.Size(790, 455) - Me.XtraTabPage4.Text = "XtraTabPage4" - ' - 'GridControl4 - ' - Me.GridControl4.Dock = System.Windows.Forms.DockStyle.Fill - Me.GridControl4.Location = New System.Drawing.Point(0, 0) - Me.GridControl4.MainView = Me.GridView4 - Me.GridControl4.MenuManager = Me.BarManager1 - Me.GridControl4.Name = "GridControl4" - Me.GridControl4.Size = New System.Drawing.Size(790, 455) - Me.GridControl4.TabIndex = 0 - Me.GridControl4.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridView4}) - ' - 'GridView4 - ' - Me.GridView4.GridControl = Me.GridControl4 - Me.GridView4.Name = "GridView4" - ' - 'XtraTabPage5 - ' - Me.XtraTabPage5.Controls.Add(Me.GridControl5) - Me.XtraTabPage5.Name = "XtraTabPage5" - Me.XtraTabPage5.Size = New System.Drawing.Size(790, 455) - Me.XtraTabPage5.Text = "XtraTabPage5" - ' - 'GridControl5 - ' - Me.GridControl5.Dock = System.Windows.Forms.DockStyle.Fill - Me.GridControl5.Location = New System.Drawing.Point(0, 0) - Me.GridControl5.MainView = Me.GridView5 - Me.GridControl5.MenuManager = Me.BarManager1 - Me.GridControl5.Name = "GridControl5" - Me.GridControl5.Size = New System.Drawing.Size(790, 455) - Me.GridControl5.TabIndex = 0 - Me.GridControl5.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridView5}) - ' - 'GridView5 - ' - Me.GridView5.GridControl = Me.GridControl5 - Me.GridView5.Name = "GridView5" - ' - 'frmResult - ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) - Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(796, 528) - Me.Controls.Add(Me.XtraTabControl) - Me.Controls.Add(Me.barDockControlLeft) - Me.Controls.Add(Me.barDockControlRight) - Me.Controls.Add(Me.barDockControlBottom) - Me.Controls.Add(Me.barDockControlTop) - Me.Name = "frmResult" - Me.Text = "Ergebnis" - CType(Me.XtraTabControl, System.ComponentModel.ISupportInitialize).EndInit() - Me.XtraTabControl.ResumeLayout(False) - Me.XtraTabPage1.ResumeLayout(False) - CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.BarManager1, System.ComponentModel.ISupportInitialize).EndInit() - Me.XtraTabPage2.ResumeLayout(False) - CType(Me.GridControl2, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.GridView2, System.ComponentModel.ISupportInitialize).EndInit() - Me.XtraTabPage3.ResumeLayout(False) - CType(Me.GridControl3, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.GridView3, System.ComponentModel.ISupportInitialize).EndInit() - Me.XtraTabPage4.ResumeLayout(False) - CType(Me.GridControl4, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.GridView4, System.ComponentModel.ISupportInitialize).EndInit() - Me.XtraTabPage5.ResumeLayout(False) - CType(Me.GridControl5, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.GridView5, System.ComponentModel.ISupportInitialize).EndInit() - Me.ResumeLayout(False) - Me.PerformLayout() - - End Sub - - Friend WithEvents XtraTabControl As DevExpress.XtraTab.XtraTabControl - Friend WithEvents XtraTabPage1 As DevExpress.XtraTab.XtraTabPage - Friend WithEvents XtraTabPage2 As DevExpress.XtraTab.XtraTabPage - Friend WithEvents BarManager1 As DevExpress.XtraBars.BarManager - Friend WithEvents Bar2 As DevExpress.XtraBars.Bar - Friend WithEvents Bar3 As DevExpress.XtraBars.Bar - Friend WithEvents barDockControlTop As DevExpress.XtraBars.BarDockControl - Friend WithEvents barDockControlBottom As DevExpress.XtraBars.BarDockControl - Friend WithEvents barDockControlLeft As DevExpress.XtraBars.BarDockControl - Friend WithEvents barDockControlRight As DevExpress.XtraBars.BarDockControl - Friend WithEvents BarButtonItem1 As DevExpress.XtraBars.BarButtonItem - Friend WithEvents GridControl1 As DevExpress.XtraGrid.GridControl - Friend WithEvents GridView1 As DevExpress.XtraGrid.Views.Grid.GridView - Friend WithEvents GridControl2 As DevExpress.XtraGrid.GridControl - Friend WithEvents GridView2 As DevExpress.XtraGrid.Views.Grid.GridView - Friend WithEvents XtraTabPage3 As DevExpress.XtraTab.XtraTabPage - Friend WithEvents GridControl3 As DevExpress.XtraGrid.GridControl - Friend WithEvents GridView3 As DevExpress.XtraGrid.Views.Grid.GridView - Friend WithEvents XtraTabPage4 As DevExpress.XtraTab.XtraTabPage - Friend WithEvents GridControl4 As DevExpress.XtraGrid.GridControl - Friend WithEvents GridView4 As DevExpress.XtraGrid.Views.Grid.GridView - Friend WithEvents XtraTabPage5 As DevExpress.XtraTab.XtraTabPage - Friend WithEvents GridControl5 As DevExpress.XtraGrid.GridControl - Friend WithEvents GridView5 As DevExpress.XtraGrid.Views.Grid.GridView - Friend WithEvents LabelStatus As DevExpress.XtraBars.BarStaticItem -End Class diff --git a/Common/frmResult.resx b/Common/frmResult.resx deleted file mode 100644 index 3a681462..00000000 --- a/Common/frmResult.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/Common/frmResult.vb b/Common/frmResult.vb deleted file mode 100644 index be8bc841..00000000 --- a/Common/frmResult.vb +++ /dev/null @@ -1,355 +0,0 @@ -Imports System.Drawing -Imports DevExpress.Utils -Imports DevExpress.XtraGrid -Imports DevExpress.XtraGrid.Columns -Imports DevExpress.XtraGrid.Views.Grid -Imports DigitalData.GUIs.Common -Imports DigitalData.Modules.Database -Imports DigitalData.Modules.Logging -Imports DigitalData.Modules.ZooFlow -Imports DigitalData.Modules.ZooFlow.Params -Imports Patterns.ClassPatterns - -Public Class frmResult - Implements IResultForm - - Private _LogConfig As LogConfig - Private _Logger As Logger - Private _Params As ClipboardWatcherParams - Private _Environment As Environment - Private _DocumentSearches As DataTable - Private _MatchingProfiles As List(Of ProfileData) - Private _Database As MSSQLServer - Private _ResultType As ResultType - - Private Class Search - Public DataTable As DataTable - Public TabIndex As Integer - Public TabCaption As String - Public ProfileId As Integer - Public SQLCommand As String - End Class - - Public Enum ResultType - Data - Document - End Enum - - Public Property ShouldReturnToMatchForm As Boolean = False Implements IResultForm.ShouldReturnToMatchForm - - Public Sub New(LogConfig As LogConfig, Environment As Environment, Params As ClipboardWatcherParams, ResultType As ResultType) - ' Dieser Aufruf ist für den Designer erforderlich. - InitializeComponent() - - ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu. - _MatchingProfiles = Params.MatchingProfiles - _LogConfig = LogConfig - _Logger = LogConfig.GetLogger - _Database = Environment.Database - _Environment = Environment - _Params = Params - _ResultType = ResultType - End Sub - - Private Async Sub frmResult_Load(sender As Object, e As EventArgs) Handles MyBase.Load - GridView1.ShowLoadingPanel() - - Dim oSearches As New List(Of Search) - - If _ResultType = ResultType.Data Then - oSearches = Await LoadDataSearchesAsync() - Else - oSearches = Await LoadDocumentSearchesAsync() - End If - - For Each oSearch As Search In oSearches - RefreshTabDoc(oSearch.ProfileId, oSearch.DataTable, oSearch.TabIndex, oSearch.TabCaption) - Next - - GridView1.HideLoadingPanel() - End Sub - - Private Async Function LoadDocumentSearchesAsync() As Task(Of List(Of Search)) - Return Await Task.Run(AddressOf DoLoadDocumentSearches) - End Function - - - - Private Function DoLoadDocumentSearches() As List(Of Search) - Dim oMatchingIds = String.Join(",", _MatchingProfiles.Select(Function(p) p.Guid).ToArray()) - Dim oSQL As String = $"SELECT * FROM TBCW_PROF_DOC_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID in ({oMatchingIds}) ORDER BY TAB_INDEX" - Dim oSearchesDataTable = _Database.GetDatatable(oSQL) - Dim oDocSearches As New List(Of Search) - Dim oCounter As Integer = 0 - Dim oPatterns As New Patterns.ClassPatterns(_LogConfig) - - _DocumentSearches = oSearchesDataTable - - For Each oRow As DataRow In oSearchesDataTable.Rows - Dim oProfileId As Integer = oRow.Item("PROFILE_ID") - Dim oTabTitle As String = oRow.Item("TAB_TITLE") - Dim oConnectionId As Integer = oRow.Item("CONN_ID") - - oSQL = oRow.Item("SQL_COMMAND") - oSQL = oPatterns.ReplaceUserValues(oSQL, _Environment.User) - oSQL = oPatterns.ReplaceInternalValues(oSQL) - - Dim oDatatable As DataTable = _Database.GetDatatable(oSQL, oConnectionId) - oDocSearches.Add(New Search() With { - .DataTable = oDatatable, - .ProfileId = oProfileId, - .TabCaption = oTabTitle, - .TabIndex = oCounter, - .SQLCommand = oSQL - }) - - oCounter += 1 - Next - - Return oDocSearches - End Function - - Private Async Function LoadDataSearchesAsync() As Task(Of List(Of Search)) - Return Await Task.Run(AddressOf DoLoadDataSearches) - End Function - - Private Function DoLoadDataSearches() As List(Of Search) - Dim oMatchingIds = String.Join(",", _MatchingProfiles.Select(Function(p) p.Guid).ToArray()) - Dim oSQL As String = $"SELECT * FROM TBCW_PROF_DATA_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID in ({oMatchingIds}) ORDER BY TAB_INDEX" - Dim oSearchesDataTable = _Database.GetDatatable(oSQL) - Dim oDataSearches As New List(Of Search) - Dim oCounter As Integer = 0 - Dim oPatterns As New Patterns.ClassPatterns(_LogConfig) - - _DocumentSearches = oSearchesDataTable - - For Each oRow As DataRow In oSearchesDataTable.Rows - Dim oProfileId As Integer = oRow.Item("PROFILE_ID") - Dim oTabTitle As String = oRow.Item("TAB_TITLE") - Dim oConnectionId As Integer = oRow.Item("CONN_ID") - - oSQL = oRow.Item("SQL_COMMAND") - oSQL = oPatterns.ReplaceUserValues(oSQL, _Environment.User) - oSQL = oPatterns.ReplaceInternalValues(oSQL) - - Dim oDatatable As DataTable = _Database.GetDatatable(oSQL, oConnectionId) - oDataSearches.Add(New Search() With { - .DataTable = oDatatable, - .ProfileId = oProfileId, - .TabCaption = oTabTitle, - .TabIndex = oCounter, - .SQLCommand = oSQL - }) - - oCounter += 1 - Next - - Return oDataSearches - End Function - - Sub RefreshTabDoc(ProfileId As Integer, Datatable As DataTable, TabIndex As Integer, TabCaption As String) - Try - Dim oSelectedGridControl As GridControl = GridControl1 - Dim oSelectedGridView As GridView = GridView1 - - Select Case TabIndex - Case 0 - GridControl1.DataSource = Nothing - GridView1.Columns.Clear() - oSelectedGridView = GridView1 - oSelectedGridControl = GridControl1 - Case 1 - GridControl2.DataSource = Nothing - GridView2.Columns.Clear() - oSelectedGridView = GridView2 - oSelectedGridControl = GridControl2 - Case 2 - GridControl3.DataSource = Nothing - GridView3.Columns.Clear() - oSelectedGridView = GridView3 - oSelectedGridControl = GridControl3 - Case 3 - GridControl4.DataSource = Nothing - GridView4.Columns.Clear() - oSelectedGridControl = GridControl4 - oSelectedGridView = GridView4 - Case 4 - GridControl5.DataSource = Nothing - GridView5.Columns.Clear() - oSelectedGridControl = GridControl5 - oSelectedGridView = GridView5 - End Select - - 'oSelectedGridControl.ContextMenuStrip = ContextMenuStripWMFile - - If Not IsNothing(Datatable) Then - XtraTabControl.TabPages(TabIndex).Text = $"{TabCaption} ({Datatable.Rows.Count})" - 'clsWMDocGrid.DTDocuments = Datatable - - If _ResultType = ResultType.Document Then - CreateDocumentGrid(oSelectedGridView, Datatable) - Else - CreateDataGrid(oSelectedGridView, Datatable) - End If - - 'Dim oxmlPath As String = Get_DocGrid_Layout_Filename(XtraTabControlDocs.SelectedTabPageIndex) - 'If File.Exists(oxmlPath) Then - ' oSelectedGridView.RestoreLayoutFromXml(oxmlPath) - ' oSelectedGridView.GuessAutoFilterRowValuesFromFilter() - 'End If - LabelStatus.Caption = $"Tab [{TabCaption}] refreshed - {Now}" - XtraTabControl.TabPages(TabIndex).PageVisible = True - Else - 'clsWMDocGrid.DTDocuments = Nothing - End If - Catch ex As Exception - _Logger.Error(ex) - End Try - End Sub - - Private Sub CreateDataGrid(GridView As GridView, Datatable As DataTable) - End Sub - - Private Sub CreateDocumentGrid(MyGridView As GridView, _datatable As DataTable) - Dim oMyDocDatatable As New DataTable - Try - 'Die Icon Colum erstellen und konfigurieren - Dim oColIcon As New DataColumn() With { - .DataType = GetType(Image), - .ColumnName = "ICON", - .Caption = "" - } - oMyDocDatatable.Columns.Add(oColIcon) - - Dim oColPath As New DataColumn() With { - .DataType = GetType(String), - .ColumnName = "FULL_FILENAME", - .Caption = "Fullpath" - } - oMyDocDatatable.Columns.Add(oColPath) - - Dim oColDocID As New DataColumn() With { - .DataType = GetType(Int32), - .ColumnName = "DocID", - .Caption = "DocID" - } - oMyDocDatatable.Columns.Add(oColDocID) - - Dim oRestColArray As New List(Of String) - For Each oCol As DataColumn In _datatable.Columns - Dim onewColumn As New DataColumn() - If oCol.ColumnName <> "DocID" And oCol.ColumnName <> "FULL_FILENAME" And oCol.ColumnName <> "Filename" Then - onewColumn.DataType = GetType(String) - onewColumn.ColumnName = oCol.ColumnName - onewColumn.Caption = oCol.Caption - oMyDocDatatable.Columns.Add(onewColumn) - oRestColArray.Add(onewColumn.ColumnName) - End If - - Next - For Each FILE_ROW As DataRow In _datatable.Rows - Dim oFullpath = FILE_ROW.Item("FULL_FILENAME") - Dim oDocID = FILE_ROW.Item("DocID") - 'Dim Folderpath = Path.GetDirectoryName(fullpath) - Dim oFilename = IO.Path.GetFileName(oFullpath) - Dim oFileextension = IO.Path.GetExtension(oFullpath) - Dim oNewRow As DataRow - oNewRow = oMyDocDatatable.NewRow() - 'Icon zuweisen - Select Case oFileextension.ToUpper - Case ".csv".ToUpper - oNewRow.Item(0) = My.Resources.xls - Case ".txt".ToUpper - oNewRow.Item(0) = My.Resources.txt - Case ".pdf".ToUpper - oNewRow.Item(0) = My.Resources.pdf - Case ".doc".ToUpper - oNewRow.Item(0) = My.Resources.doc - Case ".docx".ToUpper - oNewRow.Item(0) = My.Resources.doc - Case ".xls".ToUpper - oNewRow.Item(0) = My.Resources.xls - Case ".xlsx".ToUpper - oNewRow.Item(0) = My.Resources.xls - Case ".xlsm".ToUpper - oNewRow.Item(0) = My.Resources.xls - Case ".ppt".ToUpper - oNewRow.Item(0) = My.Resources.ppt - Case ".pptx".ToUpper - oNewRow.Item(0) = My.Resources.ppt - Case ".dwg".ToUpper - oNewRow.Item(0) = My.Resources.dwg - Case ".dxf".ToUpper - oNewRow.Item(0) = My.Resources.dxf - Case ".msg".ToUpper - oNewRow.Item(0) = My.Resources._page - Case ".msg".ToUpper - oNewRow.Item(0) = My.Resources._page - Case ".tif".ToUpper - oNewRow.Item(0) = My.Resources.tiff - Case ".tiff".ToUpper - oNewRow.Item(0) = My.Resources.tiff - Case ".jpg".ToUpper - oNewRow.Item(0) = My.Resources.jpg - Case Else - oNewRow.Item(0) = My.Resources._blank - End Select - 'Den Filepath mitgeben - oNewRow.Item(1) = oFullpath - oNewRow.Item(2) = oDocID - - Dim i = 3 'Fängt bei 3 an, um die definierten Spalten zu überspringen - For Each Colname As String In oRestColArray - Dim oRowValue - oRowValue = FILE_ROW.Item(Colname) - oNewRow.Item(i) = oRowValue.ToString - i += 1 - Next - oMyDocDatatable.Rows.Add(oNewRow) - Next - - Dim oGridControl As GridControl = MyGridView.GridControl - oGridControl.DataSource = oMyDocDatatable - oGridControl.ForceInitialize() - Try - MyGridView.Columns.Item("DocID").Visible = False - Catch ex As Exception - End Try - Try - MyGridView.Columns.Item("FULL_FILENAME").Visible = False - Catch ex As Exception - End Try - - Dim created, changed As String - If _Environment.User.Language <> "de-DE" Then - changed = "Changed" - created = "Created" - Else - changed = "Geändert" - created = "Erstellt" - End If - - Dim createdColumn = MyGridView.Columns(created) - If Not IsNothing(createdColumn) Then - createdColumn.DisplayFormat.FormatType = FormatType.DateTime - createdColumn.DisplayFormat.FormatString = _Environment.User.DateFormat & " HH:MM:ss" - End If - - Dim changedColumn = MyGridView.Columns(changed) - If Not IsNothing(changedColumn) Then - changedColumn.DisplayFormat.FormatType = FormatType.DateTime - changedColumn.DisplayFormat.FormatString = _Environment.User.DateFormat & " HH:MM:ss" - End If - ' Alle Spalten aus ReadOnly setzen, danach werden alle passenden auf nicht ReadOnly gesetzt - For Each column As GridColumn In MyGridView.Columns - column.OptionsColumn.AllowEdit = False - Next - MyGridView.Columns.Item("ICON").MaxWidth = 24 - MyGridView.Columns.Item("ICON").MinWidth = 24 - MyGridView.OptionsView.BestFitMaxRowCount = -1 - MyGridView.BestFitColumns(True) - Catch ex As Exception - _Logger.Error(ex) - End Try - End Sub -End Class \ No newline at end of file diff --git a/ZooFlow/ClassErrorHandler.vb b/ZooFlow/ClassErrorHandler.vb deleted file mode 100644 index 6bdd70c6..00000000 --- a/ZooFlow/ClassErrorHandler.vb +++ /dev/null @@ -1,60 +0,0 @@ -Imports System.Reflection -Imports DigitalData.Modules.Logging - -Public Class ClassErrorHandler - Private _Logger As Logger - - Private Const UNKNOWN_METHOD = "Unknown Method" - Private Const UNKNOWN_FORM = "Unknown Form" - - Public Sub New(Logger As Logger) - _Logger = Logger - End Sub - Public Sub ShowErrorMessage(Exception As Exception) - _Logger.Error(Exception) - MsgBox(GetMessage(Exception), MsgBoxStyle.Critical, "Unexpected Error") - End Sub - - Private Function GetMessage(Exception As Exception) As String - Dim oTargetSite = Exception.TargetSite - Dim oMethodName = GetMethodName(Exception) - Dim oFormName = GetFormName(Exception) - Dim oMessage As String = String.Empty - - oMessage &= $"Form: {oFormName}{vbNewLine}" - oMessage &= $"Method: {oMethodName}{vbNewLine}" - - If Not String.IsNullOrEmpty(Exception.StackTrace) Then - oMessage &= $"Message: {Exception.Message}{vbNewLine}{vbNewLine}" - End If - - If Not String.IsNullOrEmpty(Exception.StackTrace) Then - oMessage &= $"Stacktrace: {Exception.StackTrace}{vbNewLine}" - End If - - oMessage &= $"{vbNewLine}" - oMessage &= $"Please report this error to error@digitaldata.works" - - Return oMessage - End Function - - Private Function GetMethodName(Exception As Exception) As String - Dim oMethodName = Exception.TargetSite?.ReflectedType?.Name - - If oMethodName Is Nothing Then - Return UNKNOWN_METHOD - Else - Return oMethodName - End If - End Function - - Private Function GetFormName(Exception As Exception) As String - Dim oFormName = Exception.TargetSite?.ReflectedType?.ReflectedType?.Name - - If oFormName Is Nothing Then - Return UNKNOWN_FORM - Else - Return oFormName - End If - End Function -End Class diff --git a/ZooFlow/ZooFlow.vbproj b/ZooFlow/ZooFlow.vbproj index ea5925b4..ecd10c0a 100644 --- a/ZooFlow/ZooFlow.vbproj +++ b/ZooFlow/ZooFlow.vbproj @@ -97,7 +97,6 @@ -