From 910c755966093fd25f32a11017bf82b7ba4da1ed Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Tue, 9 Feb 2021 12:59:35 +0100 Subject: [PATCH] ClipboardWatcher: Add Waiting Form --- GUIs.ClipboardWatcher/ClipboardWatcher.vbproj | 10 ++ GUIs.ClipboardWatcher/frmMatch.Designer.vb | 28 ++-- GUIs.ClipboardWatcher/frmMatch.vb | 70 ++++++---- .../frmMatchLoading.Designer.vb | 89 +++++++++++++ GUIs.ClipboardWatcher/frmMatchLoading.resx | 120 ++++++++++++++++++ GUIs.ClipboardWatcher/frmMatchLoading.vb | 24 ++++ 6 files changed, 303 insertions(+), 38 deletions(-) create mode 100644 GUIs.ClipboardWatcher/frmMatchLoading.Designer.vb create mode 100644 GUIs.ClipboardWatcher/frmMatchLoading.resx create mode 100644 GUIs.ClipboardWatcher/frmMatchLoading.vb diff --git a/GUIs.ClipboardWatcher/ClipboardWatcher.vbproj b/GUIs.ClipboardWatcher/ClipboardWatcher.vbproj index 5a568159..e67450dd 100644 --- a/GUIs.ClipboardWatcher/ClipboardWatcher.vbproj +++ b/GUIs.ClipboardWatcher/ClipboardWatcher.vbproj @@ -46,6 +46,7 @@ False + False @@ -119,6 +120,12 @@ + + frmMatchLoading.vb + + + Form + @@ -134,6 +141,9 @@ My.Resources Designer + + frmMatchLoading.vb + diff --git a/GUIs.ClipboardWatcher/frmMatch.Designer.vb b/GUIs.ClipboardWatcher/frmMatch.Designer.vb index e95c4479..dc79f6a0 100644 --- a/GUIs.ClipboardWatcher/frmMatch.Designer.vb +++ b/GUIs.ClipboardWatcher/frmMatch.Designer.vb @@ -28,6 +28,7 @@ Partial Class frmMatch Me.TileGroupData = New DevExpress.XtraEditors.TileGroup() Me.Label1 = New System.Windows.Forms.Label() Me.Label2 = New System.Windows.Forms.Label() + Me.SplashScreenManager1 = New DevExpress.XtraSplashScreen.SplashScreenManager(Me, GetType(Global.DigitalData.GUIs.ClipboardWatcher.frmMatchLoading), True, True) Me.SuspendLayout() ' 'TileControlMatch @@ -44,10 +45,10 @@ Partial Class frmMatch Me.TileControlMatch.Groups.Add(Me.TileGroupDocumentsData) Me.TileControlMatch.Groups.Add(Me.TileGroupDocuments) Me.TileControlMatch.Groups.Add(Me.TileGroupData) - Me.TileControlMatch.Location = New System.Drawing.Point(0, 0) + Me.TileControlMatch.Location = New System.Drawing.Point(0, 38) Me.TileControlMatch.Name = "TileControlMatch" Me.TileControlMatch.ShowGroupText = True - Me.TileControlMatch.Size = New System.Drawing.Size(800, 450) + Me.TileControlMatch.Size = New System.Drawing.Size(800, 382) Me.TileControlMatch.TabIndex = 0 Me.TileControlMatch.Text = "TileControl1" ' @@ -69,43 +70,47 @@ Partial Class frmMatch ' 'Label1 ' - Me.Label1.AutoSize = True Me.Label1.BackColor = System.Drawing.Color.FromArgb(CType(CType(165, Byte), Integer), CType(CType(36, Byte), Integer), CType(CType(49, Byte), Integer)) + Me.Label1.Dock = System.Windows.Forms.DockStyle.Top Me.Label1.Font = New System.Drawing.Font("Segoe UI Semibold", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label1.ForeColor = System.Drawing.Color.White - Me.Label1.Location = New System.Drawing.Point(12, 9) + Me.Label1.Location = New System.Drawing.Point(0, 0) Me.Label1.Name = "Label1" - Me.Label1.Size = New System.Drawing.Size(408, 21) + Me.Label1.Padding = New System.Windows.Forms.Padding(5) + Me.Label1.Size = New System.Drawing.Size(800, 38) Me.Label1.TabIndex = 1 Me.Label1.Text = "Es wurde(n) {0} in {1} für Ihre Suche nach '{2}' gefunden:" ' 'Label2 ' - Me.Label2.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) - Me.Label2.AutoSize = True Me.Label2.BackColor = System.Drawing.Color.FromArgb(CType(CType(165, Byte), Integer), CType(CType(36, Byte), Integer), CType(CType(49, Byte), Integer)) Me.Label2.Cursor = System.Windows.Forms.Cursors.Hand + Me.Label2.Dock = System.Windows.Forms.DockStyle.Bottom Me.Label2.Font = New System.Drawing.Font("Segoe UI", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label2.ForeColor = System.Drawing.SystemColors.Control - Me.Label2.Location = New System.Drawing.Point(12, 424) + Me.Label2.Location = New System.Drawing.Point(0, 420) Me.Label2.Name = "Label2" - Me.Label2.Size = New System.Drawing.Size(205, 17) + Me.Label2.Padding = New System.Windows.Forms.Padding(5) + Me.Label2.Size = New System.Drawing.Size(800, 30) Me.Label2.TabIndex = 3 Me.Label2.Text = "Wie wurden die Profile gefunden?" ' + 'SplashScreenManager1 + ' + Me.SplashScreenManager1.ClosingDelay = 500 + ' 'frmMatch ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(800, 450) + Me.Controls.Add(Me.TileControlMatch) Me.Controls.Add(Me.Label2) Me.Controls.Add(Me.Label1) - Me.Controls.Add(Me.TileControlMatch) Me.IconOptions.ShowIcon = False Me.Name = "frmMatch" Me.Text = "Clipboard Watcher - Profile gefunden" Me.ResumeLayout(False) - Me.PerformLayout() End Sub @@ -115,4 +120,5 @@ Partial Class frmMatch Friend WithEvents TileGroupData As DevExpress.XtraEditors.TileGroup Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Label2 As System.Windows.Forms.Label + Friend WithEvents SplashScreenManager1 As DevExpress.XtraSplashScreen.SplashScreenManager End Class diff --git a/GUIs.ClipboardWatcher/frmMatch.vb b/GUIs.ClipboardWatcher/frmMatch.vb index d01dd1f5..84170123 100644 --- a/GUIs.ClipboardWatcher/frmMatch.vb +++ b/GUIs.ClipboardWatcher/frmMatch.vb @@ -71,38 +71,48 @@ Public Class frmMatch Dim oCreatedTiles As Integer = oResult.Item1 Dim oMatchedProfiles As Integer = oResult.Item2 - If oCreatedTiles = -1 Then - Exit Sub - End If + Try + SplashScreenManager1.ShowWaitForm() + TileControlMatch.Enabled = False - If oCreatedTiles = 0 Then - _Logger.Warn("No Tiles Created: No Results found for ""{0}""", _Params.ClipboardContents) - Close() - End If + If oCreatedTiles = -1 Then + Exit Sub + End If - Label1.Text = GetResultString(oCreatedTiles, oMatchedProfiles, _Params.ClipboardContents) - _Logger.Debug($"Created Tiles: {oCreatedTiles} ") - _Logger.Debug($"Matched Profiles: {oMatchedProfiles}") + If oCreatedTiles = 0 Then + _Logger.Warn("No Tiles Created: No Results found for ""{0}""", _Params.ClipboardContents) + Close() + End If - If oCreatedTiles = 1 Then - Dim oProfile As ProfileData = _Params.MatchingProfiles.First() - Dim oProfileSearch As New ProfileSearches(_LogConfig, _Environment, _Params) + Label1.Text = GetResultString(oCreatedTiles, oMatchedProfiles, _Params.ClipboardContents) + _Logger.Debug($"Created Tiles: {oCreatedTiles} ") + _Logger.Debug($"Matched Profiles: {oMatchedProfiles}") - If oProfile.CountDocs > 0 And oProfile.CountData = 0 Then - _Logger.Debug($"ONLY Docs") - 'ONLY DOCS AND NÒ DATA - Dim oSearches = Await oProfileSearch.LoadDocumentSearchesAsync(oProfile.Guid) - OpenDocumentResults(oProfile, oSearches) - Hide() - ElseIf oProfile.CountDocs > 0 And oProfile.CountData > 0 Then - _Logger.Debug($"Docs AND Data") - ElseIf oProfile.CountDocs = 0 And oProfile.CountData > 0 Then - _Logger.Debug($"ONLY Data") - Dim oSearches = Await oProfileSearch.LoadDataSearchesAsync(oProfile.Guid) - OpenDataResults(oProfile, oSearches) - Hide() + If oCreatedTiles = 1 Then + Dim oProfile As ProfileData = _Params.MatchingProfiles.First() + Dim oProfileSearch As New ProfileSearches(_LogConfig, _Environment, _Params) + + If oProfile.CountDocs > 0 And oProfile.CountData = 0 Then + _Logger.Debug($"ONLY Docs") + 'ONLY DOCS AND NÒ DATA + Dim oSearches = Await oProfileSearch.LoadDocumentSearchesAsync(oProfile.Guid) + OpenDocumentResults(oProfile, oSearches) + Hide() + ElseIf oProfile.CountDocs > 0 And oProfile.CountData > 0 Then + _Logger.Debug($"Docs AND Data") + ElseIf oProfile.CountDocs = 0 And oProfile.CountData > 0 Then + _Logger.Debug($"ONLY Data") + Dim oSearches = Await oProfileSearch.LoadDataSearchesAsync(oProfile.Guid) + OpenDataResults(oProfile, oSearches) + Hide() + End If End If - End If + Catch ex As Exception + _Logger.Error(ex) + Finally + TileControlMatch.Enabled = True + SplashScreenManager1.CloseWaitForm() + End Try End Sub Private Sub frmMatch_Activated(sender As Object, e As EventArgs) Handles Me.Activated @@ -244,6 +254,9 @@ Public Class frmMatch Private Async Sub TileControlMatch_ItemClick(sender As Object, e As TileItemEventArgs) Handles TileControlMatch.ItemClick Try + SplashScreenManager1.ShowWaitForm() + TileControlMatch.Enabled = False + Dim oItem As TileItem = e.Item Dim oProfileId As Integer = oItem.Tag @@ -271,6 +284,9 @@ Public Class frmMatch Catch ex As Exception MsgBox($"Error while loading Searches: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, Text) _Logger.Error(ex) + Finally + SplashScreenManager1.CloseWaitForm() + TileControlMatch.Enabled = True End Try End Sub diff --git a/GUIs.ClipboardWatcher/frmMatchLoading.Designer.vb b/GUIs.ClipboardWatcher/frmMatchLoading.Designer.vb new file mode 100644 index 00000000..08c416bd --- /dev/null +++ b/GUIs.ClipboardWatcher/frmMatchLoading.Designer.vb @@ -0,0 +1,89 @@ +Imports System.Windows.Forms + + +Partial Class frmMatchLoading + Inherits DevExpress.XtraWaitForm.WaitForm + + 'Form overrides dispose to clean up the component list. + + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + 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.progressPanel1 = New DevExpress.XtraWaitForm.ProgressPanel() + Me.tableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() + Me.tableLayoutPanel1.SuspendLayout() + Me.SuspendLayout() + ' + 'progressPanel1 + ' + Me.progressPanel1.Appearance.BackColor = System.Drawing.Color.Transparent + Me.progressPanel1.Appearance.Options.UseBackColor = True + Me.progressPanel1.AppearanceCaption.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!) + Me.progressPanel1.AppearanceCaption.Options.UseFont = True + Me.progressPanel1.AppearanceDescription.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.progressPanel1.AppearanceDescription.Options.UseFont = True + Me.progressPanel1.BarAnimationElementThickness = 2 + Me.progressPanel1.Caption = "Bitte warten" + Me.progressPanel1.Description = "Ergebnisse werden geladen..." + Me.progressPanel1.Dock = System.Windows.Forms.DockStyle.Fill + Me.progressPanel1.ImageHorzOffset = 20 + Me.progressPanel1.Location = New System.Drawing.Point(0, 17) + Me.progressPanel1.Margin = New System.Windows.Forms.Padding(0, 3, 0, 3) + Me.progressPanel1.Name = "progressPanel1" + Me.progressPanel1.Size = New System.Drawing.Size(246, 39) + Me.progressPanel1.TabIndex = 0 + Me.progressPanel1.Text = "progressPanel1" + ' + 'tableLayoutPanel1 + ' + Me.tableLayoutPanel1.AutoSize = True + Me.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.tableLayoutPanel1.BackColor = System.Drawing.Color.Transparent + Me.tableLayoutPanel1.ColumnCount = 1 + Me.tableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) + Me.tableLayoutPanel1.Controls.Add(Me.progressPanel1, 0, 0) + Me.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill + Me.tableLayoutPanel1.Location = New System.Drawing.Point(0, 0) + Me.tableLayoutPanel1.Name = "tableLayoutPanel1" + Me.tableLayoutPanel1.Padding = New System.Windows.Forms.Padding(0, 14, 0, 14) + Me.tableLayoutPanel1.RowCount = 1 + Me.tableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) + Me.tableLayoutPanel1.Size = New System.Drawing.Size(246, 73) + Me.tableLayoutPanel1.TabIndex = 1 + ' + 'WaitForm1 + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.AutoSize = True + Me.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ClientSize = New System.Drawing.Size(246, 73) + Me.Controls.Add(Me.tableLayoutPanel1) + Me.DoubleBuffered = True + Me.Name = "WaitForm1" + Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual + Me.Text = "Form1" + Me.tableLayoutPanel1.ResumeLayout(False) + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Private WithEvents progressPanel1 As DevExpress.XtraWaitForm.ProgressPanel + Private WithEvents tableLayoutPanel1 As System.Windows.Forms.TableLayoutPanel +End Class diff --git a/GUIs.ClipboardWatcher/frmMatchLoading.resx b/GUIs.ClipboardWatcher/frmMatchLoading.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/GUIs.ClipboardWatcher/frmMatchLoading.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/GUIs.ClipboardWatcher/frmMatchLoading.vb b/GUIs.ClipboardWatcher/frmMatchLoading.vb new file mode 100644 index 00000000..ab714860 --- /dev/null +++ b/GUIs.ClipboardWatcher/frmMatchLoading.vb @@ -0,0 +1,24 @@ +Public Class frmMatchLoading + Sub New + InitializeComponent() + Me.progressPanel1.AutoHeight = True + End Sub + + Public Overrides Sub SetCaption(ByVal caption As String) + MyBase.SetCaption(caption) + Me.progressPanel1.Caption = caption + End Sub + + Public Overrides Sub SetDescription(ByVal description As String) + MyBase.SetDescription(description) + Me.progressPanel1.Description = description + End Sub + + Public Overrides Sub ProcessCommand(ByVal cmd As System.Enum, ByVal arg As Object) + MyBase.ProcessCommand(cmd, arg) + End Sub + + Public Enum WaitFormCommand + SomeCommandId + End Enum +End Class