From 0c2387830107e290d2b31b91c96dcfe549b69400 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Thu, 19 May 2022 14:02:15 +0200 Subject: [PATCH] Zooflow: Search --- GUIs.Common/Base/BaseErrorHandler.vb | 6 +- GUIs.ZooFlow/ClassInit.vb | 2 +- GUIs.ZooFlow/Search/SearchRunner.vb | 20 ++++-- .../Search/frmFlowSearch2.Designer.vb | 72 ++++--------------- GUIs.ZooFlow/Search/frmFlowSearch2.vb | 39 +++++----- 5 files changed, 56 insertions(+), 83 deletions(-) diff --git a/GUIs.Common/Base/BaseErrorHandler.vb b/GUIs.Common/Base/BaseErrorHandler.vb index dc79a380..30bffa3c 100644 --- a/GUIs.Common/Base/BaseErrorHandler.vb +++ b/GUIs.Common/Base/BaseErrorHandler.vb @@ -4,9 +4,9 @@ Imports DigitalData.Modules.Logging Namespace Base Public Class BaseErrorHandler - Private _LogConfig As LogConfig - Private _Logger As Logger - Private _Form As Form + Private ReadOnly _LogConfig As LogConfig + Private ReadOnly _Logger As Logger + Private ReadOnly _Form As Form Public Sub New(LogConfig As LogConfig, Logger As Logger, Form As Form) _LogConfig = LogConfig diff --git a/GUIs.ZooFlow/ClassInit.vb b/GUIs.ZooFlow/ClassInit.vb index 63258d8d..0d385c51 100644 --- a/GUIs.ZooFlow/ClassInit.vb +++ b/GUIs.ZooFlow/ClassInit.vb @@ -268,8 +268,8 @@ Public Class ClassInit oBaseSQL = oBaseSQL.Replace("@USRID", My.Application.User.UserId) oBaseSQL = oBaseSQL.Replace("@USRNAME", My.Application.User.UserName) oBaseSQL = oBaseSQL.Replace("@UserName", My.Application.User.UserName) - oBaseSQL = oBaseSQL.Replace("@LANG_CODE", My.Application.User.Language) oBaseSQL = oBaseSQL.Replace("@LANG_CODE_SHORT", Right(My.Application.User.Language, 2)) + oBaseSQL = oBaseSQL.Replace("@LANG_CODE", My.Application.User.Language) oBaseSQL = oBaseSQL.Replace("{#INT#USERNAME}", My.Application.User.UserName) If oTITLE = SQLCMD_FLOW_SEARCH_BASE Then diff --git a/GUIs.ZooFlow/Search/SearchRunner.vb b/GUIs.ZooFlow/Search/SearchRunner.vb index dd8572df..5f6ab3ca 100644 --- a/GUIs.ZooFlow/Search/SearchRunner.vb +++ b/GUIs.ZooFlow/Search/SearchRunner.vb @@ -59,13 +59,15 @@ Public Class SearchRunner Private ReadOnly Environment As Environment Private ReadOnly SearchTitle As String - Public ReadOnly Property UserId As Integer + Private ReadOnly UserId As Integer + Private ReadOnly UserLanguage As String Public Sub New(pLogConfig As LogConfig, pEnvironment As Environment, pSearchTitle As String) MyBase.New(pLogConfig) Environment = pEnvironment SearchTitle = pSearchTitle UserId = My.Application.User.UserId + UserLanguage = My.Application.User.Language End Sub Public Function RunWithDataTable(pDatatable As DataTable) As SearchResult @@ -106,17 +108,25 @@ Public Class SearchRunner Return Await RunWithSearchTerm(pSearchTerm, pDateFrom, pDateTo, Nothing, Nothing) End Function - Public Async Function RunWithSearchTerm(pSearchTerm As String, pDateFrom As Date, pDateTo As Date, pSearchTokens As IEnumerable(Of Search.SearchToken.AttributeValueToken), pSearchTitle As String) As Task(Of SearchResult) + Public Async Function RunWithSearchTerm(pSearchTerm As String, pDateFrom As Date, pDateTo As Date, pSearchTokens As IEnumerable(Of Search.SearchToken.Token), pSearchTitle As String) As Task(Of SearchResult) Dim oWindowTitle = GetResultWindowString(pSearchTerm, pSearchTitle) Dim oParams = GetParams(oWindowTitle) - Dim oDateConstraint = GetDateConstraint(pDateFrom, pDateTo) + Dim oDateConstraint = Await GetDateConstraint(pDateFrom, pDateTo) Await InsertSearchTokens(pSearchTokens) - Dim oSQL = $"EXEC PRIDB_SEARCH_TEXT_GET_RESULTS {UserId},'{pSearchTerm}','{oDateConstraint}'" + Dim oSQL = $"EXEC PRIDB_SEARCH_GET_TEXT_RESULTS {UserId},'{pSearchTerm}','{oDateConstraint}', '{UserLanguage}'" + If pSearchTokens IsNot Nothing AndAlso pSearchTokens.Count > 0 Then + oSQL = $"EXEC PRIDB_SEARCH_GET_TOKEN_RESULT_DOCS {UserId}, '{oDateConstraint}', '{UserLanguage}'" + End If If Await My.Database.ExecuteNonQueryIDBAsync(oSQL) = True Then Dim oDTDocResult = Await My.Database.GetDatatableIDBAsync(BaseSearchSQL) + + If oDTDocResult Is Nothing Then + Return New SearchResult("Error in Search Query") + End If + Dim oRowCount = oDTDocResult.Rows.Count If oRowCount > 0 Then oParams.Results.Add(New DocumentResultList.DocumentResult() With { @@ -142,7 +152,7 @@ Public Class SearchRunner End If Else - Return New SearchResult("Error in FlowSearch - Check Your log") + Return New SearchResult("Error in Search Function") End If End Function diff --git a/GUIs.ZooFlow/Search/frmFlowSearch2.Designer.vb b/GUIs.ZooFlow/Search/frmFlowSearch2.Designer.vb index 74ee67f2..63e4013d 100644 --- a/GUIs.ZooFlow/Search/frmFlowSearch2.Designer.vb +++ b/GUIs.ZooFlow/Search/frmFlowSearch2.Designer.vb @@ -23,11 +23,6 @@ Partial Class frmFlowSearch2 _ Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() - Dim EditorButtonImageOptions1 As DevExpress.XtraEditors.Controls.EditorButtonImageOptions = New DevExpress.XtraEditors.Controls.EditorButtonImageOptions() - Dim SerializableAppearanceObject1 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() - Dim SerializableAppearanceObject2 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() - Dim SerializableAppearanceObject3 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() - Dim SerializableAppearanceObject4 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() Dim TableColumnDefinition1 As DevExpress.XtraEditors.TableLayout.TableColumnDefinition = New DevExpress.XtraEditors.TableLayout.TableColumnDefinition() Dim TableColumnDefinition2 As DevExpress.XtraEditors.TableLayout.TableColumnDefinition = New DevExpress.XtraEditors.TableLayout.TableColumnDefinition() Dim TableRowDefinition1 As DevExpress.XtraEditors.TableLayout.TableRowDefinition = New DevExpress.XtraEditors.TableLayout.TableRowDefinition() @@ -55,7 +50,6 @@ Partial Class frmFlowSearch2 Me.PanelControl2 = New DevExpress.XtraEditors.PanelControl() Me.LayoutControl1 = New DevExpress.XtraLayout.LayoutControl() Me.TokenEditEx1 = New DigitalData.GUIs.ZooFlow.TokenEditEx() - Me.TextEdit1 = New DevExpress.XtraEditors.ButtonEdit() Me.GridPredefinedSearches = New DevExpress.XtraGrid.GridControl() Me.TileView1 = New DevExpress.XtraGrid.Views.Tile.TileView() Me.colCount = New DevExpress.XtraGrid.Columns.TileViewColumn() @@ -76,7 +70,6 @@ Partial Class frmFlowSearch2 Me.LayoutControlItem8 = New DevExpress.XtraLayout.LayoutControlItem() Me.LayoutControlGroup3 = New DevExpress.XtraLayout.LayoutControlGroup() Me.LayoutControlItem3 = New DevExpress.XtraLayout.LayoutControlItem() - Me.LayoutControlItem5 = New DevExpress.XtraLayout.LayoutControlItem() Me.LayoutControlItem7 = New DevExpress.XtraLayout.LayoutControlItem() Me.SvgImageCollection1 = New DevExpress.Utils.SvgImageCollection(Me.components) CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit() @@ -88,7 +81,6 @@ Partial Class frmFlowSearch2 CType(Me.LayoutControl1, System.ComponentModel.ISupportInitialize).BeginInit() Me.LayoutControl1.SuspendLayout() CType(Me.TokenEditEx1.Properties, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.TextEdit1.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.GridPredefinedSearches, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.TileView1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.GridView1, System.ComponentModel.ISupportInitialize).BeginInit() @@ -110,7 +102,6 @@ Partial Class frmFlowSearch2 CType(Me.LayoutControlItem8, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlGroup3, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlItem3, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.LayoutControlItem5, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlItem7, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.SvgImageCollection1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() @@ -161,7 +152,7 @@ Partial Class frmFlowSearch2 ' Me.lblResults.Caption = "Noch keine Ergebnisse" Me.lblResults.Id = 2 - Me.lblResults.ItemAppearance.Normal.Font = New System.Drawing.Font("Segoe UI", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.lblResults.ItemAppearance.Normal.Font = New System.Drawing.Font("Segoe UI", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.lblResults.ItemAppearance.Normal.Options.UseFont = True Me.lblResults.Name = "lblResults" ' @@ -268,7 +259,6 @@ Partial Class frmFlowSearch2 ' Me.LayoutControl1.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(240, Byte), Integer), CType(CType(240, Byte), Integer)) Me.LayoutControl1.Controls.Add(Me.TokenEditEx1) - Me.LayoutControl1.Controls.Add(Me.TextEdit1) Me.LayoutControl1.Controls.Add(Me.GridPredefinedSearches) Me.LayoutControl1.Controls.Add(Me.RadioGroupDateConstraints) Me.LayoutControl1.Controls.Add(Me.DateEditFrom) @@ -300,22 +290,6 @@ Partial Class frmFlowSearch2 Me.TokenEditEx1.StyleController = Me.LayoutControl1 Me.TokenEditEx1.TabIndex = 4 ' - 'TextEdit1 - ' - Me.TextEdit1.Location = New System.Drawing.Point(0, 202) - Me.TextEdit1.MenuManager = Me.RibbonControl1 - Me.TextEdit1.Name = "TextEdit1" - Me.TextEdit1.Properties.Appearance.Font = New System.Drawing.Font("Segoe UI", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.TextEdit1.Properties.Appearance.Options.UseFont = True - EditorButtonImageOptions1.SvgImage = Global.DigitalData.GUIs.ZooFlow.My.Resources.Resources.ZooFlow_CW_DevExpress - EditorButtonImageOptions1.SvgImageSize = New System.Drawing.Size(20, 20) - Me.TextEdit1.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "", -1, True, True, False, EditorButtonImageOptions1, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject1, SerializableAppearanceObject2, SerializableAppearanceObject3, SerializableAppearanceObject4, "", "SEARCH", Nothing, DevExpress.Utils.ToolTipAnchor.[Default])}) - Me.TextEdit1.Properties.NullText = "Suchbegriff eingeben.." - Me.TextEdit1.Properties.Padding = New System.Windows.Forms.Padding(5, 10, 10, 10) - Me.TextEdit1.Size = New System.Drawing.Size(886, 44) - Me.TextEdit1.StyleController = Me.LayoutControl1 - Me.TextEdit1.TabIndex = 2 - ' 'GridPredefinedSearches ' Me.GridPredefinedSearches.Location = New System.Drawing.Point(14, 92) @@ -385,7 +359,7 @@ Partial Class frmFlowSearch2 ' 'RadioGroupDateConstraints ' - Me.RadioGroupDateConstraints.Location = New System.Drawing.Point(4, 290) + Me.RadioGroupDateConstraints.Location = New System.Drawing.Point(4, 228) Me.RadioGroupDateConstraints.MenuManager = Me.RibbonControl1 Me.RadioGroupDateConstraints.Name = "RadioGroupDateConstraints" Me.RadioGroupDateConstraints.Properties.Appearance.BackColor = System.Drawing.SystemColors.Control @@ -393,14 +367,14 @@ Partial Class frmFlowSearch2 Me.RadioGroupDateConstraints.Properties.Columns = 2 Me.RadioGroupDateConstraints.Properties.ItemHorzAlignment = DevExpress.XtraEditors.RadioItemHorzAlignment.Near Me.RadioGroupDateConstraints.Properties.ItemsLayout = DevExpress.XtraEditors.RadioGroupItemsLayout.Flow - Me.RadioGroupDateConstraints.Size = New System.Drawing.Size(615, 119) + Me.RadioGroupDateConstraints.Size = New System.Drawing.Size(615, 181) Me.RadioGroupDateConstraints.StyleController = Me.LayoutControl1 Me.RadioGroupDateConstraints.TabIndex = 4 ' 'DateEditFrom ' Me.DateEditFrom.EditValue = Nothing - Me.DateEditFrom.Location = New System.Drawing.Point(724, 293) + Me.DateEditFrom.Location = New System.Drawing.Point(724, 231) Me.DateEditFrom.MenuManager = Me.RibbonControl1 Me.DateEditFrom.Name = "DateEditFrom" Me.DateEditFrom.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) @@ -412,7 +386,7 @@ Partial Class frmFlowSearch2 'DateEditTo ' Me.DateEditTo.EditValue = Nothing - Me.DateEditTo.Location = New System.Drawing.Point(724, 346) + Me.DateEditTo.Location = New System.Drawing.Point(724, 284) Me.DateEditTo.MenuManager = Me.RibbonControl1 Me.DateEditTo.Name = "DateEditTo" Me.DateEditTo.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) @@ -423,7 +397,7 @@ Partial Class frmFlowSearch2 ' 'CheckEdit1 ' - Me.CheckEdit1.Location = New System.Drawing.Point(627, 320) + Me.CheckEdit1.Location = New System.Drawing.Point(627, 258) Me.CheckEdit1.MenuManager = Me.RibbonControl1 Me.CheckEdit1.Name = "CheckEdit1" Me.CheckEdit1.Properties.OffText = "Datum bis deaktiviert" @@ -434,7 +408,7 @@ Partial Class frmFlowSearch2 ' 'ComboBoxDateAttributes ' - Me.ComboBoxDateAttributes.Location = New System.Drawing.Point(724, 376) + Me.ComboBoxDateAttributes.Location = New System.Drawing.Point(724, 314) Me.ComboBoxDateAttributes.MenuManager = Me.RibbonControl1 Me.ComboBoxDateAttributes.Name = "ComboBoxDateAttributes" Me.ComboBoxDateAttributes.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) @@ -446,7 +420,7 @@ Partial Class frmFlowSearch2 ' Me.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.[True] Me.Root.GroupBordersVisible = False - Me.Root.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlGroupDate1, Me.LayoutControlGroupDate2, Me.LayoutControlGroup3, Me.LayoutControlItem5, Me.LayoutControlItem7}) + Me.Root.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlGroupDate1, Me.LayoutControlGroupDate2, Me.LayoutControlGroup3, Me.LayoutControlItem7}) Me.Root.Name = "Root" Me.Root.Padding = New DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0) Me.Root.Size = New System.Drawing.Size(886, 413) @@ -462,11 +436,10 @@ Partial Class frmFlowSearch2 Me.LayoutControlGroupDate1.BestFitWeight = 0 Me.LayoutControlGroupDate1.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.[False] Me.LayoutControlGroupDate1.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlItem1}) - Me.LayoutControlGroupDate1.Location = New System.Drawing.Point(0, 246) + Me.LayoutControlGroupDate1.Location = New System.Drawing.Point(0, 202) Me.LayoutControlGroupDate1.Name = "LayoutControlGroupDate1" Me.LayoutControlGroupDate1.Padding = New DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0) - Me.LayoutControlGroupDate1.Size = New System.Drawing.Size(623, 167) - Me.LayoutControlGroupDate1.Spacing = New DevExpress.XtraLayout.Utils.Padding(2, 2, 20, 2) + Me.LayoutControlGroupDate1.Size = New System.Drawing.Size(623, 211) Me.LayoutControlGroupDate1.Text = "Datums Einschränkung" Me.LayoutControlGroupDate1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never ' @@ -475,7 +448,7 @@ Partial Class frmFlowSearch2 Me.LayoutControlItem1.Control = Me.RadioGroupDateConstraints Me.LayoutControlItem1.Location = New System.Drawing.Point(0, 0) Me.LayoutControlItem1.Name = "LayoutControlItem1" - Me.LayoutControlItem1.Size = New System.Drawing.Size(619, 123) + Me.LayoutControlItem1.Size = New System.Drawing.Size(619, 185) Me.LayoutControlItem1.TextSize = New System.Drawing.Size(0, 0) Me.LayoutControlItem1.TextVisible = False ' @@ -487,11 +460,10 @@ Partial Class frmFlowSearch2 Me.LayoutControlGroupDate2.AppearanceGroup.Options.UseBorderColor = True Me.LayoutControlGroupDate2.BestFitWeight = 0 Me.LayoutControlGroupDate2.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlItem2, Me.LayoutControlItem4, Me.EmptySpaceItem1, Me.LayoutControlItem6, Me.LayoutControlItem8}) - Me.LayoutControlGroupDate2.Location = New System.Drawing.Point(623, 246) + Me.LayoutControlGroupDate2.Location = New System.Drawing.Point(623, 202) Me.LayoutControlGroupDate2.Name = "LayoutControlGroupDate2" Me.LayoutControlGroupDate2.Padding = New DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0) - Me.LayoutControlGroupDate2.Size = New System.Drawing.Size(263, 167) - Me.LayoutControlGroupDate2.Spacing = New DevExpress.XtraLayout.Utils.Padding(2, 2, 20, 2) + Me.LayoutControlGroupDate2.Size = New System.Drawing.Size(263, 211) Me.LayoutControlGroupDate2.Text = "Eigenes Datum" Me.LayoutControlGroupDate2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never ' @@ -521,7 +493,7 @@ Partial Class frmFlowSearch2 Me.EmptySpaceItem1.AllowHotTrack = False Me.EmptySpaceItem1.Location = New System.Drawing.Point(0, 113) Me.EmptySpaceItem1.Name = "EmptySpaceItem1" - Me.EmptySpaceItem1.Size = New System.Drawing.Size(259, 10) + Me.EmptySpaceItem1.Size = New System.Drawing.Size(259, 72) Me.EmptySpaceItem1.TextSize = New System.Drawing.Size(0, 0) ' 'LayoutControlItem6 @@ -562,18 +534,6 @@ Partial Class frmFlowSearch2 Me.LayoutControlItem3.TextSize = New System.Drawing.Size(0, 0) Me.LayoutControlItem3.TextVisible = False ' - 'LayoutControlItem5 - ' - Me.LayoutControlItem5.BestFitWeight = 0 - Me.LayoutControlItem5.Control = Me.TextEdit1 - Me.LayoutControlItem5.Location = New System.Drawing.Point(0, 202) - Me.LayoutControlItem5.Name = "LayoutControlItem5" - Me.LayoutControlItem5.Padding = New DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0) - Me.LayoutControlItem5.Size = New System.Drawing.Size(886, 44) - Me.LayoutControlItem5.TextSize = New System.Drawing.Size(0, 0) - Me.LayoutControlItem5.TextVisible = False - Me.LayoutControlItem5.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never - ' 'LayoutControlItem7 ' Me.LayoutControlItem7.Control = Me.TokenEditEx1 @@ -614,7 +574,6 @@ Partial Class frmFlowSearch2 CType(Me.LayoutControl1, System.ComponentModel.ISupportInitialize).EndInit() Me.LayoutControl1.ResumeLayout(False) CType(Me.TokenEditEx1.Properties, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.TextEdit1.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.GridPredefinedSearches, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.TileView1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit() @@ -636,7 +595,6 @@ Partial Class frmFlowSearch2 CType(Me.LayoutControlItem8, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlGroup3, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlItem3, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.LayoutControlItem5, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlItem7, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.SvgImageCollection1, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) @@ -654,7 +612,6 @@ Partial Class frmFlowSearch2 Friend WithEvents Root As DevExpress.XtraLayout.LayoutControlGroup Friend WithEvents RadioGroupDateConstraints As DevExpress.XtraEditors.RadioGroup Friend WithEvents LayoutControlItem1 As DevExpress.XtraLayout.LayoutControlItem - Friend WithEvents TextEdit1 As DevExpress.XtraEditors.ButtonEdit Friend WithEvents GridPredefinedSearches As DevExpress.XtraGrid.GridControl Friend WithEvents TileView1 As DevExpress.XtraGrid.Views.Tile.TileView Friend WithEvents colName As DevExpress.XtraGrid.Columns.TileViewColumn @@ -670,7 +627,6 @@ Partial Class frmFlowSearch2 Friend WithEvents EmptySpaceItem1 As DevExpress.XtraLayout.EmptySpaceItem Friend WithEvents LayoutControlGroup3 As DevExpress.XtraLayout.LayoutControlGroup Friend WithEvents LayoutControlItem3 As DevExpress.XtraLayout.LayoutControlItem - Friend WithEvents LayoutControlItem5 As DevExpress.XtraLayout.LayoutControlItem Friend WithEvents CheckEdit1 As DevExpress.XtraEditors.ToggleSwitch Friend WithEvents LayoutControlItem6 As DevExpress.XtraLayout.LayoutControlItem Friend WithEvents lblResults As DevExpress.XtraBars.BarStaticItem diff --git a/GUIs.ZooFlow/Search/frmFlowSearch2.vb b/GUIs.ZooFlow/Search/frmFlowSearch2.vb index 18069798..410c54da 100644 --- a/GUIs.ZooFlow/Search/frmFlowSearch2.vb +++ b/GUIs.ZooFlow/Search/frmFlowSearch2.vb @@ -137,29 +137,26 @@ Public Class frmFlowSearch2 } End Function - Private Function GetTokens() As IEnumerable(Of AttributeValueToken) + Private Function GetTokens() As IEnumerable(Of Token) Dim oTokens = TokenEditEx1.GetTokenList() - Return oTokens.Select(Of AttributeValueToken)(Function(token) token.Value).ToList() + Return oTokens.Select(Of Token)(Function(token) token.Value).ToList() End Function - Private Async Sub TextEdit1_KeyUp(sender As Object, e As KeyEventArgs) Handles TextEdit1.KeyUp + Private Async Sub TextEdit1_KeyUp(sender As Object, e As KeyEventArgs) If e.KeyCode = Keys.Enter Then - Dim oTokens = GetTokens() - Await RunSearch(oTokens) + Await RunSearch(GetTokens()) End If End Sub Private Async Sub SearchControl2_KeyUp(sender As Object, e As KeyEventArgs) Handles TokenEditEx1.KeyUp If e.KeyCode = Keys.Enter And TokenEditEx1.IsPopupOpen = False Then - Dim oTokens = GetTokens() - Await RunSearch(oTokens) + Await RunSearch(GetTokens()) End If End Sub - Private Async Sub TextEdit1_ButtonClick(sender As Object, e As DevExpress.XtraEditors.Controls.ButtonPressedEventArgs) Handles TextEdit1.ButtonClick + Private Async Sub TextEdit1_ButtonClick(sender As Object, e As DevExpress.XtraEditors.Controls.ButtonPressedEventArgs) If e.Button.Tag = "SEARCH" Then - Dim oTokens = GetTokens() - Await RunSearch(oTokens) + Await RunSearch(GetTokens()) End If End Sub @@ -182,7 +179,7 @@ Public Class frmFlowSearch2 Dim oResult = Await SearchRunner.RunWithSearchTerm(String.Empty, oDateFrom, oDateTo, pTokens, "") If oResult.OK = False Then - SetStatusBarColor(Color.OrangeRed) + SetStatusBarColor(Color.OrangeRed, Color.White) End If lblResults.Caption = $"{oResult.Count} Ergebnisse" @@ -211,11 +208,19 @@ Public Class frmFlowSearch2 Dim oResult = Await SearchRunner.RunWithSearchTerm("", oSearchTitle) - If oResult.Count = 0 Then - SetStatusBarColor(Color.OrangeRed) + If oResult.OK = False Then + SetStatusBarColor(Color.OrangeRed, Color.White) + lblResults.Caption = oResult.ErrorMessage + + ElseIf oResult.Count = 0 Then + SetStatusBarColor(Color.OrangeRed, Color.White) + lblResults.Caption = $"Keine Ergebnisse" + + Else + lblResults.Caption = $"{oResult.Count} Ergebnisse" + End If - lblResults.Caption = $"{oResult.Count} Ergebnisse" Catch ex As Exception MsgBox(ex.Message) Finally @@ -224,7 +229,7 @@ Public Class frmFlowSearch2 End Sub Private Function StartUpdateUI() As IOverlaySplashScreenHandle - SetStatusBarColor(Color.FromArgb(255, 240, 240, 240)) + SetStatusBarColor(Color.FromArgb(255, 240, 240, 240), Color.Black) Dim oHandle = SplashScreenManager.ShowOverlayForm(LayoutControl1) Return oHandle End Function @@ -233,16 +238,18 @@ Public Class frmFlowSearch2 SplashScreenManager.CloseOverlayForm(pHandle) End Sub - Private Sub SetStatusBarColor(pColor As Color) + Private Sub SetStatusBarColor(pColor As Color, pForeColor As Color) ' Change color for StatusBarBackground Dim element As SkinElement = SkinManager.GetSkinElement(SkinProductId.Ribbon, UserLookAndFeel.Default, "StatusBarBackground") element.Color.SolidImageCenterColor = pColor element.Color.BackColor = pColor + element.Color.ForeColor = pForeColor ' Change color for StatusBarFormBackground Dim element2 As SkinElement = SkinManager.GetSkinElement(SkinProductId.Ribbon, UserLookAndFeel.Default, "StatusBarFormBackground") element2.Color.SolidImageCenterColor = pColor element2.Color.BackColor = pColor + element2.Color.ForeColor = pForeColor ' Force update of LookAndFeel LookAndFeelHelper.ForceDefaultLookAndFeelChanged()