From d0e4ecb4ed827b067aff0bb54356872670afcccf Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Fri, 20 Nov 2020 16:09:29 +0100 Subject: [PATCH] ZooFlow: Improvements and Performance for frmSearchStart --- GUIs.ZooFlow/ClassCommandlineArgs.vb | 8 +- GUIs.ZooFlow/ClassConstants.vb | 5 + GUIs.ZooFlow/ClassControlCreator.vb | 631 +++++------------------- GUIs.ZooFlow/ClassInit.vb | 18 +- GUIs.ZooFlow/Search/SearchFilter.vb | 35 ++ GUIs.ZooFlow/ZooFlow.vbproj | 1 + GUIs.ZooFlow/frmSearchStart.Designer.vb | 107 ++-- GUIs.ZooFlow/frmSearchStart.resx | 36 +- GUIs.ZooFlow/frmSearchStart.vb | 180 ++++--- 9 files changed, 397 insertions(+), 624 deletions(-) create mode 100644 GUIs.ZooFlow/Search/SearchFilter.vb diff --git a/GUIs.ZooFlow/ClassCommandlineArgs.vb b/GUIs.ZooFlow/ClassCommandlineArgs.vb index 3e16308e..2f9e747e 100644 --- a/GUIs.ZooFlow/ClassCommandlineArgs.vb +++ b/GUIs.ZooFlow/ClassCommandlineArgs.vb @@ -12,8 +12,8 @@ Public Class ClassCommandlineArgs "start-search" } Private CommandLineArgTypeString As String = String.Join("|", CommandLineArgTypes) - Private CommandLineArgRegex As String = $"(?:-{{2}}(?:({CommandLineArgTypeString})+)=([a-zA-Z0-9~#]+)\s*)+" - Private CommandLineArgParameterRegex As String = "(?:~{0,1}([\w\d-]+#[\w\d-]+))+" + Private CommandLineArgRegex As String = $"(?:-{{2}}(?:({CommandLineArgTypeString})+)=([a-zA-Z0-9~|]+)\s*)+" + Private CommandLineArgParameterRegex As String = "(?:~{0,1}([\w\d-]+|[\w\d-]+))+" Public FunctionName As String Public FunctionArgs As New Dictionary(Of String, String) @@ -23,7 +23,7 @@ Public Class ClassCommandlineArgs Public Sub New(pLogConfig As LogConfig) LogConfig = pLogConfig - Logger = pLogConfig.GetLogger() + Logger = LogConfig.GetLogger() End Sub Public Sub Parse(Args As List(Of String)) @@ -48,7 +48,7 @@ Public Class ClassCommandlineArgs FunctionName = oParamName For Each oValue As String In oParamValue.Split("~"c) - Dim oValueArray = oValue.Split("#"c).ToList + Dim oValueArray = oValue.Split("|"c).ToList FunctionArgs.Add(oValueArray.Item(0), oValueArray.Item(1)) Next Else diff --git a/GUIs.ZooFlow/ClassConstants.vb b/GUIs.ZooFlow/ClassConstants.vb index d1099ec7..ba632e93 100644 --- a/GUIs.ZooFlow/ClassConstants.vb +++ b/GUIs.ZooFlow/ClassConstants.vb @@ -13,4 +13,9 @@ Public Const MODULE_CLIPBOARDWATCHER = "CW" Public Const MODULE_GLOBAL_INDEXER = "GLOBIX" Public Const MODULE_ZOOFLOW = "ZOOFLOW" + + Public Const ATTR_TYPE_STRING = "VARCHAR" + Public Const ATTR_TYPE_INTEGER = "BIG INTEGER" + Public Const ATTR_TYPE_DATE = "DATE" + Public Const ATTR_TYPE_BOOLEAN = "BIT" End Class diff --git a/GUIs.ZooFlow/ClassControlCreator.vb b/GUIs.ZooFlow/ClassControlCreator.vb index 698da317..546a44a7 100644 --- a/GUIs.ZooFlow/ClassControlCreator.vb +++ b/GUIs.ZooFlow/ClassControlCreator.vb @@ -1,9 +1,9 @@ Imports DevExpress.XtraEditors Imports DevExpress.XtraGrid -Imports DevExpress.XtraGrid.Views.Base Imports DevExpress.XtraGrid.Views.Grid Imports DevExpress.XtraTab Imports DigitalData.Modules.Logging +Imports DigitalData.Modules.Language Public Class ClassControlCreator @@ -54,41 +54,30 @@ Public Class ClassControlCreator Public Class ControlMetadata Public Guid As Integer - Public AttrID As Integer - Public DependingAttrID As Integer + Public AttributeID As Integer + Public DependingAttributeID As Integer Public Multiselect As Boolean - Public AttrTitle As String - Public AttrType As String + Public AttributeTitle As String + Public AttributeType As String Public SourceSQL As String Public DTSource As DataTable Public MinValue As String Public MaxValue As String End Class - Private Shared Function TransformDataRow(row As DataRow, pXPosition As Integer, pYPosition As Integer) As ControlDBProps + Private Shared Function TransformDataRow(pRow As DataRow, pXPosition As Integer, pYPosition As Integer) As ControlDBProps Dim oxPos As Integer = pXPosition Dim oYPos As Integer = pYPosition - ' Dim style As FontStyle = NotNull(row.Item("FONT_STYLE"), DEFAULT_FONT_STYLE) - ' Dim size As Single = NotNull(row.Item("FONT_SIZE"), DEFAULT_FONT_SIZE) - ' Dim familyString As String = NotNull(row.Item("FONT_FAMILY"), DEFAULT_FONT_FAMILY) - 'Dim family As FontFamily = New FontFamily(familyString) - - Dim oGuid As Integer = row.Item("GUID") - Dim oName As String = row.Item("ATTRIBUTE_TITLE") + Dim oGuid As Integer = pRow.Item("GUID") + Dim oName As String = pRow.Item("ATTRIBUTE_TITLE") Dim oLocation As New Point(oxPos, oYPos) - 'Dim oFont As New Font(family, size, style, GraphicsUnit.Point) - 'Dim oColor As Color = IntToColor(NotNull(row.Item("FONT_COLOR"), DEFAULT_COLOR)) - 'Dim oReadOnly As Boolean = row.Item("READ_ONLY") - Return New ControlDBProps() With { .Guid = oGuid, .Name = oName, - .Location = oLocation} - '.Font = oFont, - '.Color = oColor - + .Location = oLocation + } End Function - Public Function CreateBaseControl(ctrl As Control, pAttributeRow As DataRow, pXPosition As Integer, pYPosition As Integer) As Control + Public Function CreateBaseControl(pControl As Control, pAttributeRow As DataRow, pXPosition As Integer, pYPosition As Integer) As Control Try Dim props As ControlDBProps = TransformDataRow(pAttributeRow, pXPosition, pYPosition) Dim oSourceSQL As String = pAttributeRow.Item("SOURCE_SQL").ToString @@ -97,39 +86,38 @@ Public Class ClassControlCreator oSourceSQL = oSourceSQL.Replace("@RESULT_TITLE", pAttributeRow.Item("ATTRIBUTE_TITLE").ToString) Dim oDTSource As DataTable 'If pAttributeRow.Item("DEPENDING_ATTRIBUTE1") = 0 Then - oDTSource = My.DatabaseIDB.GetDatatable(oSourceSQL) + If Utils.NotNull(oSourceSQL, String.Empty) <> String.Empty Then + oDTSource = My.DatabaseIDB.GetDatatable(oSourceSQL) + End If 'End If Dim oMinValue As String = "" Dim oMaxValue As String = "" + If Not IsNothing(oDTSource) Then oMinValue = oDTSource.Rows(0).Item(0) oMaxValue = oDTSource.Rows(oDTSource.Rows.Count - 1).Item(0) End If - 'ctrl.Tag = New ControlMetadata() With { - Dim omyclass = New ControlMetadata() With { + + Dim oMetadata = New ControlMetadata() With { .Guid = CType(pAttributeRow.Item("GUID"), Integer), - .AttrID = CType(pAttributeRow.Item("ATTRIBUTE_ID"), Integer), + .AttributeID = CType(pAttributeRow.Item("ATTRIBUTE_ID"), Integer), .DTSource = CType(oDTSource, DataTable), - .AttrTitle = CType(pAttributeRow.Item("ATTRIBUTE_TITLE"), String), + .AttributeTitle = CType(pAttributeRow.Item("ATTRIBUTE_TITLE"), String), .Multiselect = CType(pAttributeRow.Item("MULTISELECT"), Boolean), .SourceSQL = oSourceSQL, .MinValue = oMinValue, .MaxValue = oMaxValue } - ' If CInt(pAttributeRow.Item("DEPENDING_ATTRIBUTE1")) <> 0 Then - ' omyclass.DTSource = Nothing - '' Else - ' omyclass.DTSource = CType(oDTSource, DataTable) - ' End If - ctrl.Tag = omyclass - ctrl.Name = props.Name - ctrl.Location = props.Location - ctrl.Font = props.Font - ctrl.ForeColor = props.Color - - - Return ctrl + + pControl.Tag = oMetadata + pControl.Name = props.Name + pControl.Location = props.Location + pControl.Font = props.Font + pControl.ForeColor = props.Color + + + Return pControl Catch ex As Exception Logger.Error(ex) End Try @@ -147,7 +135,7 @@ Public Class ClassControlCreator oCheckBox.AutoSize = True Try - oCheckBox.Text = pAttributeRow.Item("ATTRIBUTE_TITLE") + oCheckBox.Text = pAttributeRow.Item("ATTRIBUTE_TITLE").ToString Catch ex As Exception oCheckBox.Text = "NO CAPTION AVAILABLE" End Try @@ -163,13 +151,13 @@ Public Class ClassControlCreator oDateControl.Properties.ShowWeekNumbers = True oDateControl.Properties.ShowClear = True Try - Dim oMinDate As Date = DirectCast(oDateControl.Tag, ClassControlCreator.ControlMetadata).MinValue + Dim oMinDate As Date = DirectCast(oDateControl.Tag, ControlMetadata).MinValue oDateControl.Properties.MinValue = oMinDate Catch ex As Exception End Try Try - Dim oMaxDate As Date = DirectCast(oDateControl.Tag, ClassControlCreator.ControlMetadata).MaxValue + Dim oMaxDate As Date = DirectCast(oDateControl.Tag, ControlMetadata).MaxValue oDateControl.Properties.MaxValue = oMaxDate Catch ex As Exception @@ -178,187 +166,103 @@ Public Class ClassControlCreator Return oDateControl End Function Public Function CreateExistingGridControl(pAttributeRow As DataRow, pXPosition As Integer, pYPosition As Integer) As GridControl + Dim oWatch1 As New Watch("Creating Base Control") + Dim oMyNewGridControl As GridControl = CreateBaseControl(New GridControl(), pAttributeRow, pXPosition, pYPosition) Dim oDatatable As New DataTable - Dim oView As DevExpress.XtraGrid.Views.Grid.GridView + Dim oView As GridView + + oWatch1.Stop() + oWatch1 = New Watch("Configuring Grid") oMyNewGridControl.ForceInitialize() + oMyNewGridControl.ContextMenu = Nothing + oMyNewGridControl.Size = New Size(CInt(pAttributeRow.Item("WIDTH")), DEFAULT_HEIGHT_GRIDVIEW) + 'oMyNewGridControl.Size = New Size(CInt(pAttributeRow.Item("WIDTH")), CInt(pAttributeRow.Item("HEIGHT"))) oView = CType(oMyNewGridControl.MainView, GridView) - oView.OptionsView.ShowGroupPanel = False - oMyNewGridControl.ContextMenu = Nothing oView.Appearance.EvenRow.BackColor = Color.PaleTurquoise - oView.OptionsBehavior.Editable = False oView.OptionsBehavior.ReadOnly = True - - oView.OptionsBehavior.AllowAddRows = False - oView.OptionsBehavior.AllowDeleteRows = False + oView.OptionsBehavior.AllowAddRows = DevExpress.Utils.DefaultBoolean.False + oView.OptionsBehavior.AllowDeleteRows = DevExpress.Utils.DefaultBoolean.False oView.OptionsView.NewItemRowPosition = NewItemRowPosition.None oView.OptionsView.ShowAutoFilterRow = True oView.OptionsView.EnableAppearanceEvenRow = True - oMyNewGridControl.Size = New Size(CInt(pAttributeRow.Item("WIDTH")), CInt(pAttributeRow.Item("HEIGHT"))) + oView.OptionsView.ShowGroupPanel = False + If CType(pAttributeRow.Item("MULTISELECT"), Boolean) Then oView.OptionsSelection.MultiSelect = True oView.OptionsSelection.MultiSelectMode = GridMultiSelectMode.CheckBoxRowSelect oView.OptionsSelection.CheckBoxSelectorColumnWidth = 20 - oMyNewGridControl.Size = New Size(CInt(pAttributeRow.Item("WIDTH") + 50), CInt(pAttributeRow.Item("HEIGHT"))) + oMyNewGridControl.Size = New Size(CInt(pAttributeRow.Item("WIDTH") + 50), DEFAULT_HEIGHT_GRIDVIEW) End If - 'oView.Columns("TERM_ID").Visible = False - ' Add and configure navigator to delete rows - oMyNewGridControl.UseEmbeddedNavigator = True - With oMyNewGridControl.EmbeddedNavigator.Buttons - .CancelEdit.Visible = False - .Edit.Visible = False - .EndEdit.Visible = False - .First.Visible = False - .Last.Visible = False - .Next.Visible = False - .NextPage.Visible = False - .PrevPage.Visible = False - .Prev.Visible = False - - End With - - GridTables.Clear() - - - 'Dim oColumn = New DataColumn() With { - ' .DataType = GetType(String), - ' .ColumnName = pAttributeRow.Item("ATTRIBUTE_TITLE").ToString, - ' .Caption = pAttributeRow.Item("ATTRIBUTE_TITLE").ToString, - ' .ReadOnly = False - ' } - - 'oDatatable.Columns.Add(oColumn) - - 'For Each oRow As DataRow In DT_MY_COLUMNS.Rows - ' ' Create Columns in Datatable - - ' Dim oColumn = New DataColumn() With { - ' .DataType = GetType(String), - ' .ColumnName = pAttributeRow.Item("ATTRIBUTE_TITLE").ToString, - ' .Caption = pAttributeRow.Item("ATTRIBUTE_TITLE").ToString, - ' .ReadOnly = False - ' } - ' oDatatable.Columns.Add(oColumn) - - ' ' Fetch and cache Combobox results - ' Dim oConnectionId As Integer = NotNull(oRow.Item("CONNECTION_ID"), 0) - ' Dim oSqlCommand As String = NotNull(oRow.Item("SQL_COMMAND"), "") - - ' If Not clsPatterns.HasComplexPatterns(oSqlCommand) Then - ' If oConnectionId > 0 And oSqlCommand <> "" Then - ' Try - ' Dim oComboboxDataTable As DataTable = ClassDatabase.Return_Datatable_ConId(oSqlCommand, oConnectionId) - ' GridTables.Add(oRow.Item("SPALTENNAME"), oComboboxDataTable) - ' Catch ex As Exception - ' Logger.Warn("Could not load data for column {0} in control {1}", oRow.Item("SPALTENNAME"), oControl.Name) - ' Logger.Error(ex) - ' End Try - ' End If - ' End If + oWatch1.Stop() + oWatch1 = New Watch("Loading Datasource") + ' Add and configure navigator to delete rows + 'oMyNewGridControl.UseEmbeddedNavigator = True + 'With oMyNewGridControl.EmbeddedNavigator.Buttons + ' .CancelEdit.Visible = False + ' .Edit.Visible = False + ' .EndEdit.Visible = False + ' .First.Visible = False + ' .Last.Visible = False + ' .Next.Visible = False + ' .NextPage.Visible = False + ' .PrevPage.Visible = False + ' .Prev.Visible = False + + 'End With - 'Next + GridTables.Clear() - Dim oDTSource As DataTable = DirectCast(oMyNewGridControl.Tag, ClassControlCreator.ControlMetadata).DTSource + Dim oDTSource As DataTable = DirectCast(oMyNewGridControl.Tag, ControlMetadata).DTSource oMyNewGridControl.DataSource = oDTSource oView.PopulateColumns() oMyNewGridControl.RefreshDataSource() oMyNewGridControl.ForceInitialize() - 'Try - ' oView.Columns(0).Caption = "Existierende Werte" - 'Catch ex As Exception - - 'End Try - - - - 'AddHandler oView.CustomRowCellEdit, Sub(sender As Object, e As CustomRowCellEditEventArgs) - ' For Each oRow As DataRow In DT_MY_COLUMNS.Rows - ' If oRow.Item("SPALTENNAME") = e.Column.FieldName Then - - ' If GridTables.ContainsKey(e.Column.FieldName) Then - ' Dim oComboboxDataTable As DataTable = GridTables.Item(e.Column.FieldName) - ' Dim oEditor As New RepositoryItemComboBox() - ' Dim oItems As New List(Of String) - - ' AddHandler oEditor.Validating, Sub(_sender As ComboBoxEdit, _e As CancelEventArgs) - ' If oItems.Contains(_sender.EditValue) Then - ' _e.Cancel = False - ' Else - ' _e.Cancel = True - ' End If - - ' End Sub - ' For Each oRow2 As DataRow In oComboboxDataTable.Rows - ' Dim oValue = oRow2.Item(0) - - ' Try - ' oValue &= $" | {oRow2.Item(1)}" - ' Catch ex As Exception - ' End Try - - ' oEditor.Items.Add(oValue) - ' oItems.Add(oValue) - ' Next - ' e.RepositoryItem = oEditor - - ' End If - ' End If - ' Next - ' End Sub - - 'AddHandler oView.CellValueChanged, Sub(sender As Object, e As CellValueChangedEventArgs) - ' Dim oValue = e.Value.ToString() - ' Dim oView2 As GridView = TryCast(sender, GridView) - - - ' If oValue.Contains(" | ") Then - ' oValue = oValue.Split(" | ").ToList().Item(0) - ' oView2.SetRowCellValue(e.RowHandle, e.Column, oValue) - ' End If - ' End Sub + oWatch1.Stop() Return oMyNewGridControl End Function - Public Function AddCheckBox(indexname As String, y As Integer, vorbelegung As String, caption As String) + Public Function AddCheckBox(pIndexname As String, y As Integer, pVorbelegung As String, pCaption As String) As CheckBox Try - Dim value As Boolean = False - Dim chk As New CheckBox - chk.Name = "chk" & indexname - chk.Size = New Size(100, 27) - chk.Location = New Point(11, y) - chk.Tag = New ControlMeta() With { - .IndexName = indexname, - .IndexType = "BOOLEAN" + Dim oValue As Boolean = False + Dim oCheckbox As New CheckBox With { + .Name = "chk" & pIndexname, + .Size = New Size(100, 27), + .Location = New Point(11, y), + .Tag = New ControlMeta() With { + .IndexName = pIndexname, + .IndexType = "BOOLEAN" + } } - If caption <> "" Then - chk.Text = caption - chk.Size = New Size(CInt(caption.Length * 15), 27) + If pCaption <> "" Then + oCheckbox.Text = pCaption + oCheckbox.Size = New Size(CInt(pCaption.Length * 15), 27) End If - If Boolean.TryParse(vorbelegung, value) = False Then - If vorbelegung = "1" Or vorbelegung = "0" Then - chk.Checked = CBool(vorbelegung) + If Boolean.TryParse(pVorbelegung, oValue) = False Then + If pVorbelegung = "1" Or pVorbelegung = "0" Then + oCheckbox.Checked = CBool(pVorbelegung) Else - chk.Checked = False + oCheckbox.Checked = False End If Else - chk.Checked = value + oCheckbox.Checked = oValue End If - AddHandler chk.CheckedChanged, AddressOf Checkbox_CheckedChanged + AddHandler oCheckbox.CheckedChanged, AddressOf Checkbox_CheckedChanged - Return chk + Return oCheckbox Catch ex As Exception Logger.Info("Unhandled Exception in AddCheckBox: " & ex.Message) Logger.Error(ex.Message) @@ -370,107 +274,32 @@ Public Class ClassControlCreator 'PrepareDependingControl(sender) End Sub - 'Public Function AddVorschlag_ComboBox(indexname As String, y As Integer, conid As Integer, sql_Vorschlag As String, Multiselect As Boolean, DataType As String, Optional Vorgabe As String = "", Optional AddNewValues As Boolean = False, Optional PreventDuplicateValues As Boolean = False, Optional SQLSuggestion As Boolean = False) As Control - ' Try - ' Dim oSql As String = sql_Vorschlag - ' Dim oConnectionString As String - ' Dim oControl As New DigitalData.Controls.LookupGrid.LookupControl2 With { - ' .Multiselect = Multiselect, - ' .AllowAddNewValues = AddNewValues, - ' .PreventDuplicates = PreventDuplicateValues, - ' .Location = New Point(11, y), - ' .Size = New Size(300, 27), - ' .Name = "cmbMulti" & indexname, - ' .Tag = New ControlMeta() With { - ' .IndexName = indexname, - ' .IndexType = DataType - ' } - ' } - ' oControl.Properties.AppearanceFocused.BackColor = Color.Lime - - ' If Not String.IsNullOrEmpty(Vorgabe) Then - ' Dim oDefaultValues As New List(Of String) - - ' If Vorgabe.Contains(",") Then - ' oDefaultValues = Vorgabe. - ' Split(",").ToList(). - ' Select(Function(item) item.Trim()). - ' ToList() - ' Else - ' oDefaultValues = Vorgabe. - ' Split(ClassConstants.VECTORSEPARATOR).ToList(). - ' Select(Function(item) item.Trim()). - ' ToList() - ' End If - ' oControl.SelectedValues = oDefaultValues - ' End If - - ' AddHandler oControl.SelectedValuesChanged, AddressOf Lookup_SelectedValuesChanged - - ' oConnectionString = ClassFormFunctions.GetConnectionString(conid) - - ' If oConnectionString IsNot Nothing And oSql.Length > 0 And SQLSuggestion = True Then - ' Logger.Debug("Connection String (redacted): [{0}]", oConnectionString.Substring(0, 30)) - - ' If ClassPatterns.HasComplexPatterns(oSql) Then - ' Logger.Debug(" >>sql enthält Platzhalter und wird erst während der Laufzeit gefüllt!", False) - ' Else - ' Dim oDatatable = ClassDatabase.Return_Datatable_Combined(oSql, oConnectionString, False) - ' oControl.DataSource = oDatatable - ' End If - ' Else - ' Logger.Warn("Connection String for control [{0}] is empty!", oControl.Name) - ' End If - - ' Return oControl - ' Catch ex As Exception - ' Logger.Info(" - Unvorhergesehener Unexpected error in AddVorschlag_ComboBox - Indexname: " & indexname & " - Fehler: " & vbNewLine & ex.Message) - ' Logger.Error(ex.Message) - ' MsgBox(ex.Message, MsgBoxStyle.Critical, "Unvorhergesehener Unexpected error in AddVorschlag_ComboBox:") - ' Return Nothing - ' End Try - 'End Function - - 'Private Sub Lookup_SelectedValuesChanged(sender As LookupControl2, SelectedValues As List(Of String)) - ' PrepareDependingControl(sender) - 'End Sub - - Function AddCombobox(indexname As String, y As Integer) - Dim cmb As New ComboBox - cmb.Name = "cmb" & indexname - cmb.AutoSize = True - cmb.Size = New Size(300, 27) - cmb.Location = New Point(11, y) - - cmb.Tag = New ControlMeta() With { + Function AddCombobox(indexname As String, y As Integer) As ComboBoxEdit + Dim oCombobox As New ComboBoxEdit + oCombobox.Name = "cmb" & indexname + oCombobox.AutoSize = True + oCombobox.Size = New Size(300, 27) + oCombobox.Location = New Point(11, y) + + oCombobox.Tag = New ControlMeta() With { .IndexName = indexname } - AddHandler cmb.SelectedIndexChanged, AddressOf OncmbSIndexChanged - AddHandler cmb.GotFocus, AddressOf OncmbGotFocus - AddHandler cmb.LostFocus, AddressOf OncmbLostFocus - 'AddHandler cmb.KeyDown, AddressOf OncmbKeyDown - Return cmb + AddHandler oCombobox.SelectedIndexChanged, AddressOf OncmbSIndexChanged + AddHandler oCombobox.GotFocus, AddressOf OncmbGotFocus + AddHandler oCombobox.LostFocus, AddressOf OncmbLostFocus + Return oCombobox End Function - 'Public Sub OncmbKeyDown(sender As System.Object, e As System.EventArgs) - ' Dim cmb As ComboBox = sender - - ' ' Verhindert, dass Auswahlliste und Autocompleteliste übereinander liegen - ' If cmb.DroppedDown = True Then - ' cmb.DroppedDown = False - ' End If - 'End Sub - - Public Sub OncmbGotFocus(sender As System.Object, e As System.EventArgs) - Dim cmb As ComboBox = sender - cmb.BackColor = Color.Lime + Public Sub OncmbGotFocus(sender As Object, e As System.EventArgs) + Dim oCombobox As ComboBoxEdit = CType(sender, ComboBoxEdit) + oCombobox.BackColor = Color.Lime End Sub - Public Sub OncmbLostFocus(sender As System.Object, e As System.EventArgs) - Dim cmb As ComboBox = sender - cmb.BackColor = Color.White + Public Sub OncmbLostFocus(sender As Object, e As System.EventArgs) + Dim oCombobox As ComboBoxEdit = CType(sender, ComboBoxEdit) + oCombobox.BackColor = Color.White End Sub Public Sub OncmbSIndexChanged(sender As System.Object, e As System.EventArgs) @@ -478,139 +307,20 @@ Public Class ClassControlCreator Exit Sub End If - Dim cmb As ComboBox = sender - If cmb.SelectedIndex <> -1 Then - If cmb.Text.Length > 15 Then - Dim g As Graphics = cmb.CreateGraphics - cmb.Width = g.MeasureString(cmb.Text, cmb.Font).Width + 30 + Dim oCombobox As ComboBoxEdit = CType(sender, ComboBoxEdit) + If oCombobox.SelectedIndex <> -1 Then + If oCombobox.Text.Length > 15 Then + Dim g As Graphics = oCombobox.CreateGraphics + oCombobox.Width = CInt(g.MeasureString(oCombobox.Text, oCombobox.Font).Width + 30) g.Dispose() End If - ' Get_NextComboBoxResults(cmb) - SendKeys.Send("{TAB}") End If End Sub - - 'Private Sub Get_NextComboBoxResults(cmb As ComboBox) - ' Try - ' Dim indexname = cmb.Name.Replace("cmb", "") - ' Dim sql = "SELECT GUID,NAME,SQL_RESULT FROM TBDD_INDEX_MAN where SUGGESTION = 1 AND SQL_RESULT like '%@" & indexname & "%' and DOK_ID = " & CURRENT_DOKART_ID & " ORDER BY SEQUENCE" - ' Dim DT As DataTable = ClassDatabase.Return_Datatable(sql, True) - ' If Not IsNothing(DT) Then - ' If DT.Rows.Count > 0 Then - ' Dim cmbname = "cmb" & DT.Rows(0).Item("NAME") - ' Renew_ComboboxResults(DT.Rows(0).Item("GUID"), indexname, cmb.Text) - ' End If - - ' End If - ' Catch ex As Exception - ' MsgBox("Error in Get_NextComboBoxResults:" & vbNewLine & ex.Message, MsgBoxStyle.Critical) - ' End Try - 'End Sub - - 'Private Sub Renew_ComboboxResults(INDEX_GUID As Integer, SearchString As String, Resultvalue As String) - ' Try - ' Dim connectionString As String - ' Dim sqlCnn As SqlConnection - ' Dim sqlCmd As SqlCommand - ' Dim adapter As New SqlDataAdapter - - ' Dim oracleConn As OracleConnection - ' Dim oracleCmd As OracleCommand - ' Dim oracleadapter As New OracleDataAdapter - - ' Dim NewDataset As New DataSet - ' Dim i As Integer - - ' Dim DT_INDEX As DataTable = ClassDatabase.Return_Datatable("select * FROM TBDD_INDEX_MAN WHERE GUID = " & INDEX_GUID, True) - ' If IsNothing(DT_INDEX) Then - ' Exit Sub - ' End If - - ' Dim conid = DT_INDEX.Rows(0).Item("CONNECTION_ID") - ' Dim sql_result = DT_INDEX.Rows(0).Item("SQL_RESULT") - ' Dim NAME = DT_INDEX.Rows(0).Item("NAME") - ' If Not IsNothing(conid) And Not IsNothing(sql_result) And Not IsNothing(NAME) Then - ' For Each ctrl As Control In Me.Panel.Controls - ' If ctrl.Name = "cmb" & NAME.ToString Then - ' Dim cmb As ComboBox = ctrl - ' Dim sql As String = sql_result.ToString.ToUpper.Replace("@" & SearchString.ToUpper, Resultvalue) - - ' connectionString = ClassFormFunctions.GetConnectionString(conid) - ' If connectionString Is Nothing = False Then - ' 'SQL Befehl füllt die Auswahlliste - - ' If connectionString.Contains("Initial Catalog=") Then - ' sqlCnn = New SqlConnection(connectionString) - ' sqlCnn.Open() - ' sqlCmd = New SqlCommand(sql, sqlCnn) - ' adapter.SelectCommand = sqlCmd - ' adapter.Fill(NewDataset) - ' ElseIf connectionString.StartsWith("Data Source=") And connectionString.Contains("SERVICE_NAME") Then - ' oracleConn = New OracleConnection(connectionString) - ' ' Try - ' oracleConn.Open() - ' oracleCmd = New OracleCommand(sql, oracleConn) - ' oracleadapter.SelectCommand = oracleCmd - ' oracleadapter.Fill(NewDataset) - ' End If - ' If NewDataset.Tables(0).Rows.Count > 0 Then - ' cmb.Items.Clear() - ' 'Die Standargrösse definieren - ' Dim newWidth As Integer = 300 - ' For i = 0 To NewDataset.Tables(0).Rows.Count - 1 - ' 'MsgBox(NewDataset.Tables(0).Rows(i).Item(0)) - ' cmb.Items.Add(NewDataset.Tables(0).Rows(i).Item(0)) - ' Try - ' Dim text As String = NewDataset.Tables(0).Rows(i).Item(0) - ' If text.Length > 15 Then - ' Dim g As Graphics = cmb.CreateGraphics - ' If g.MeasureString(text, cmb.Font).Width + 30 > newWidth Then - ' newWidth = g.MeasureString(text, cmb.Font).Width + 30 - ' End If - ' g.Dispose() - ' End If - ' Catch ex As Exception - ' MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Anpassung Breite ComboBox:") - ' End Try - - ' Next - ' cmb.Size = New Size(newWidth, 27) - ' cmb.AutoCompleteSource = AutoCompleteSource.ListItems - ' cmb.AutoCompleteMode = AutoCompleteMode.Suggest - ' End If - ' If connectionString.Contains("Initial Catalog=") Then - ' Try - ' adapter.Dispose() - ' sqlCmd.Dispose() - ' sqlCnn.Close() - ' Catch ex As Exception - - ' End Try - ' Else - ' Try - ' oracleadapter.Dispose() - ' oracleCmd.Dispose() - ' oracleConn.Close() - ' Catch ex As Exception - - ' End Try - ' End If - ' End If - ' End If - ' Next - ' End If - ' Catch ex As Exception - ' Logger.Info(" - Unvorhergesehener Unexpected error in Renew_ComboboxResults - Fehler: " & vbNewLine & ex.Message) - ' Logger.Error(ex.Message) - ' MsgBox(ex.Message, MsgBoxStyle.Critical, "Unvorhergesehener Unexpected error in Renew_ComboboxResults:") - ' End Try - 'End Sub - Public Function AddTextBox(pAttrName As String, y As Integer, text As String, pAttrDataType As String) As DevExpress.XtraEditors.TextEdit - Dim oEdit As New DevExpress.XtraEditors.TextEdit With { + Dim oEdit As New TextEdit With { .Name = "txt" & pAttrName, .Size = New Size(260, 27), .Location = New Point(11, y), @@ -622,7 +332,7 @@ Public Class ClassControlCreator Select Case pAttrDataType Case "INTEGER" - oEdit.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric + oEdit.Properties.Mask.MaskType = Mask.MaskType.Numeric oEdit.Properties.Mask.EditMask = "d" Console.WriteLine() End Select @@ -640,26 +350,26 @@ Public Class ClassControlCreator Return oEdit End Function - Public Sub OnTextBoxFocus(sender As System.Object, e As System.EventArgs) - Dim oTextbox As DevExpress.XtraEditors.TextEdit = sender + Public Sub OnTextBoxFocus(sender As Object, e As EventArgs) + Dim oTextbox As TextEdit = CType(sender, TextEdit) oTextbox.BackColor = Color.Lime oTextbox.SelectAll() End Sub - Public Sub OnTextBoxTextChanged(sender As System.Object, e As System.EventArgs) - Dim oTextbox As DevExpress.XtraEditors.TextEdit = sender + Public Sub OnTextBoxTextChanged(sender As Object, e As EventArgs) + Dim oTextbox As TextEdit = CType(sender, TextEdit) Using oGraphics As Graphics = oTextbox.CreateGraphics() - oTextbox.Width = oGraphics.MeasureString(oTextbox.Text, oTextbox.Font).Width + 15 + oTextbox.Width = CInt(oGraphics.MeasureString(oTextbox.Text, oTextbox.Font).Width + 15) End Using End Sub - Public Sub OnTextBoxLostFocus(sender As System.Object, e As System.EventArgs) - Dim oTextbox As DevExpress.XtraEditors.TextEdit = sender + Public Sub OnTextBoxLostFocus(sender As Object, e As EventArgs) + Dim oTextbox As TextEdit = CType(sender, TextEdit) oTextbox.BackColor = Color.White End Sub - Public Sub OnTextBoxKeyUp(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) - Dim oTextbox As DevExpress.XtraEditors.TextEdit = sender + Public Sub OnTextBoxKeyUp(sender As Object, e As KeyEventArgs) + Dim oTextbox As TextEdit = CType(sender, TextEdit) If oTextbox.Text = String.Empty Then Exit Sub @@ -675,8 +385,8 @@ Public Class ClassControlCreator End Sub - Public Function AddDateTimePicker(indexname As String, y As Integer, DataType As String) As DevExpress.XtraEditors.DateEdit - Dim oPicker As New DevExpress.XtraEditors.DateEdit With { + Public Function AddDateTimePicker(indexname As String, y As Integer, DataType As String) As DateEdit + Dim oPicker As New DateEdit With { .Name = "dtp" & indexname, .Size = New Size(260, 27), .Location = New Point(11, y), @@ -689,105 +399,4 @@ Public Class ClassControlCreator Return oPicker End Function - Sub OndtpChanged() - 'offen was hier zu tun ist - End Sub - - 'Private Sub PrepareDependingControl(Control As Control) - ' If TypeOf Control Is Label Then - ' Exit Sub - ' End If - - ' Try - ' Dim oMeta = DirectCast(Control.Tag, ClassControls.ControlMeta) - ' Dim oIndexName As String = oMeta.IndexName - ' Dim oSQL = $"SELECT * FROM TBDD_INDEX_MAN WHERE SQL_RESULT LIKE '%{oIndexName}%'" - ' Dim oDatatable As DataTable = ClassDatabase.Return_Datatable(oSQL) - - ' If Not IsNothing(oDatatable) Then - ' Logger.Debug("Found [{0}] depending controls for [{1}]", oDatatable.Rows.Count, Control.Name) - - ' For Each oRow As DataRow In oDatatable.Rows - ' Dim oControlName As String = NotNull(oRow.Item("NAME"), "") - ' Dim oConnectionId As Integer = NotNull(oRow.Item("CONNECTION_ID"), -1) - ' Dim oControlSql As String = NotNull(oRow.Item("SQL_RESULT"), "") - - ' If oConnectionId = -1 Or oControlSql = String.Empty Then - ' Logger.Warn("Missing SQL Query or ConnectionId for Control [{0}]! Continuing.", oControlName) - ' Continue For - ' End If - - ' oControlSql = ClassPatterns.ReplaceUserValues(oControlSql, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_DOKART_ID) - ' oControlSql = ClassPatterns.ReplaceInternalValues(oControlSql) - ' oControlSql = ClassPatterns.ReplaceControlValues(oControlSql, Panel) - - - ' Logger.Debug("SQL After Preparing: [{0}]", oControlSql) - ' Logger.Debug("Setting new value for [{0}]", oControlName) - ' SetDependingControlResult(oControlName, oControlSql, oConnectionId) - ' Next - ' End If - ' Catch ex As Exception - ' Logger.Error(ex) - ' End Try - 'End Sub - - 'Private Sub SetDependingControlResult(IndexName As String, SqlCommand As String, SqlConnectionId As Integer) - ' Try - ' If SqlCommand Is Nothing OrElse SqlCommand = String.Empty Then - ' Logger.Warn("New Value for Index [{0}] could not be set. Supplied SQL is empty.") - ' Exit Sub - ' End If - - ' Dim oConnectionString = ClassFormFunctions.GetConnectionString(SqlConnectionId) - ' Dim oDatatable As DataTable = ClassDatabase.Return_Datatable_CS(SqlCommand, oConnectionString) - ' Dim oFoundControl As Control = Nothing - - ' For Each oControl As Control In Panel.Controls - ' If TypeOf oControl Is Label Then - ' Continue For - ' End If - - ' Dim oMeta = DirectCast(oControl.Tag, ClassControls.ControlMeta) - ' Dim oIndex As String = oMeta.IndexName - - ' If oIndex = IndexName Then - ' oFoundControl = oControl - ' Exit For - ' End If - ' Next - - ' If oFoundControl Is Nothing Then - ' Logger.Warn("Depending Control for Index [{0}] not found!", IndexName) - ' End If - - ' If oDatatable Is Nothing Then - ' Logger.Warn("Error in SQL Command: {0}", SqlCommand) - ' End If - - ' Select Case oFoundControl.GetType.Name - ' Case GetType(DevExpress.XtraEditors.TextEdit).Name - ' If oDatatable.Rows.Count > 0 Then - ' Dim oFirstRow As DataRow = oDatatable.Rows.Item(0) - - ' If oFirstRow.ItemArray.Length > 0 Then - ' Dim oValue = oFirstRow.Item(0).ToString() - - ' Logger.Debug("Setting Value for TextEdit [{0}]: [{1}]", oFoundControl.Name, oValue) - ' DirectCast(oFoundControl, DevExpress.XtraEditors.TextEdit).Text = oValue - ' End If - ' End If - ' Case GetType(LookupControl2).Name - ' Logger.Debug("Setting Value for LookupControl [{0}]: [{1}]", oFoundControl.Name, "DATATABLE") - ' DirectCast(oFoundControl, LookupControl2).DataSource = oDatatable - ' Case GetType(ComboBox).Name - ' Logger.Debug("Setting Value for Combobox [{0}]: [{1}]", oFoundControl.Name, "DATATABLE") - ' DirectCast(oFoundControl, ComboBox).DataSource = oDatatable - ' Case Else - ' Logger.Debug("Could not set depending control result for [{0}]", oFoundControl.GetType.Name) - ' End Select - ' Catch ex As Exception - ' Logger.Error(ex) - ' End Try - 'End Sub End Class diff --git a/GUIs.ZooFlow/ClassInit.vb b/GUIs.ZooFlow/ClassInit.vb index 90130c98..4d540920 100644 --- a/GUIs.ZooFlow/ClassInit.vb +++ b/GUIs.ZooFlow/ClassInit.vb @@ -6,6 +6,8 @@ Imports DigitalData.Modules.Language.Utils Imports DigitalData.Modules.Logging Imports DigitalData.GUIs.ZooFlow.ClassInitLoader Imports DigitalData.GUIs.ZooFlow.ClassConstants +Imports System.Threading +Imports System.Globalization Public Class ClassInit Private _MainForm As frmFlowForm @@ -36,8 +38,9 @@ Public Class ClassInit oInit.AddStep("Checking connectivity..", AddressOf CheckConnectivity, True) oInit.AddStep("Initializing User..", AddressOf InitializeUser, True) oInit.AddStep("Initializing IDB..", AddressOf InitializeIDB, True) - oInit.AddStep("Loading 3rd-party licenses", AddressOf Initialize3rdParty, False) - oInit.AddStep("Loading basic Configs", AddressOf InitBasicData, False) + oInit.AddStep("Initializing Language..", AddressOf InitializeLanguage, False) + oInit.AddStep("Loading 3rd-party licenses..", AddressOf Initialize3rdParty, False) + oInit.AddStep("Loading Basic Configs..", AddressOf InitBasicData, False) ' === Init Schritte definieren AddHandler oInit.ProgressChanged, AddressOf ProgressChanged @@ -47,6 +50,17 @@ Public Class ClassInit End If End Sub + Private Sub InitializeLanguage(MyApplication As My.MyApplication) + Dim oLanguage = MyApplication.User.Language + Dim oDateFormat = MyApplication.User.DateFormat + Dim oCultureInfo As New CultureInfo(oLanguage) + oCultureInfo.DateTimeFormat.ShortDatePattern = oDateFormat + Thread.CurrentThread.CurrentCulture = oCultureInfo + Thread.CurrentThread.CurrentUICulture = oCultureInfo + CultureInfo.DefaultThreadCurrentCulture = oCultureInfo + CultureInfo.DefaultThreadCurrentUICulture = oCultureInfo + End Sub + Private Function SetupDatabase() As Boolean If My.SystemConfig.ConnectionString = String.Empty Then Dim oResult = frmConfigDatabase.ShowDialog() diff --git a/GUIs.ZooFlow/Search/SearchFilter.vb b/GUIs.ZooFlow/Search/SearchFilter.vb new file mode 100644 index 00000000..c9f89c1d --- /dev/null +++ b/GUIs.ZooFlow/Search/SearchFilter.vb @@ -0,0 +1,35 @@ +Public Class SearchFilter + + Public Shared Property DefaultFilters As New List(Of FilterTimeframe) From { + New FilterTimeframe() With {.Name = "Kein", .DisableFilter = True, .[To] = Nothing}, + New FilterTimeframe() With {.Name = "Eigener", .CustomFilter = True, .[To] = Date.Now, .From = Date.Now}, + New FilterTimeframe() With { + .Name = "letzte 7 Tage", + .From = Date.Now.Subtract(TimeSpan.FromDays(7)) + }, + New FilterTimeframe() With { + .Name = "letzte 14 Tage", + .From = Date.Now.Subtract(TimeSpan.FromDays(14)) + }, + New FilterTimeframe() With { + .Name = "letzte 30 Tage", + .From = Date.Now.Subtract(TimeSpan.FromDays(30)) + }, + New FilterTimeframe() With { + .Name = "aktueller Monat", + .From = New Date(Now.Year, Now.Month, 1) + } + } + + Public Class FilterTimeframe + Public Property Name As String + Public Property From As Date + Public Property [To] As Date = Date.Now + Public Property DisableFilter As Boolean = False + Public Property CustomFilter As Boolean = False + + Public Overrides Function ToString() As String + Return Name.ToString + End Function + End Class +End Class diff --git a/GUIs.ZooFlow/ZooFlow.vbproj b/GUIs.ZooFlow/ZooFlow.vbproj index fb6cae0b..a177d1fd 100644 --- a/GUIs.ZooFlow/ZooFlow.vbproj +++ b/GUIs.ZooFlow/ZooFlow.vbproj @@ -195,6 +195,7 @@ + frmAdministrationZooFlow.vb diff --git a/GUIs.ZooFlow/frmSearchStart.Designer.vb b/GUIs.ZooFlow/frmSearchStart.Designer.vb index 0fe64577..d572c143 100644 --- a/GUIs.ZooFlow/frmSearchStart.Designer.vb +++ b/GUIs.ZooFlow/frmSearchStart.Designer.vb @@ -26,6 +26,7 @@ Partial Class frmSearchStart Dim SplashScreenManager As DevExpress.XtraSplashScreen.SplashScreenManager = New DevExpress.XtraSplashScreen.SplashScreenManager(Me, Nothing, true, true) Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmSearchStart)) Me.RibbonControl1 = New DevExpress.XtraBars.Ribbon.RibbonControl() + Me.BarButtonItem2 = New DevExpress.XtraBars.BarButtonItem() Me.BarButtonNewSearch = New DevExpress.XtraBars.BarButtonItem() Me.BarButtonSaveSearch = New DevExpress.XtraBars.BarButtonItem() Me.BarHeaderItem1 = New DevExpress.XtraBars.BarHeaderItem() @@ -45,11 +46,12 @@ Partial Class frmSearchStart Me.cmbFilterTimeframe = New DevExpress.XtraBars.BarEditItem() Me.RepositoryItemComboBox2 = New DevExpress.XtraEditors.Repository.RepositoryItemComboBox() Me.BarCheckboxOpenSearchInSameWindow = New DevExpress.XtraBars.BarCheckItem() + Me.BarButtonItem1 = New DevExpress.XtraBars.BarButtonItem() Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage() - Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() - Me.RibbonPageGroup2 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() + Me.RibbonPageGroupFunctions = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RibbonPageGroupProfiles = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RibbonPageGroupFilter = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() + Me.RibbonPageGroupSettings = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RepositoryItemTextEdit1 = New DevExpress.XtraEditors.Repository.RepositoryItemTextEdit() Me.RepositoryItemTimeSpanEdit1 = New DevExpress.XtraEditors.Repository.RepositoryItemTimeSpanEdit() Me.RibbonStatusBar1 = New DevExpress.XtraBars.Ribbon.RibbonStatusBar() @@ -98,17 +100,28 @@ Partial Class frmSearchStart 'RibbonControl1 ' Me.RibbonControl1.AutoSizeItems = True + Me.RibbonControl1.CaptionBarItemLinks.Add(Me.BarButtonItem2) Me.RibbonControl1.ExpandCollapseItem.Id = 0 - Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.BarButtonNewSearch, Me.BarButtonSaveSearch, Me.BarHeaderItem1, Me.BarEditItem1, Me.BarButtonClearSearch, Me.BarButtonItem3, Me.BarEditItem2, Me.BarStaticItemInfo, Me.BarButtonStartSearch, Me.BarStaticItem1, Me.txtFilterFrom, Me.txtFilterTo, Me.cmbFilterTimeframe, Me.BarCheckboxOpenSearchInSameWindow}) + Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.BarButtonItem2, Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.BarButtonNewSearch, Me.BarButtonSaveSearch, Me.BarHeaderItem1, Me.BarEditItem1, Me.BarButtonClearSearch, Me.BarButtonItem3, Me.BarEditItem2, Me.BarStaticItemInfo, Me.BarButtonStartSearch, Me.BarStaticItem1, Me.txtFilterFrom, Me.txtFilterTo, Me.cmbFilterTimeframe, Me.BarCheckboxOpenSearchInSameWindow, Me.BarButtonItem1}) Me.RibbonControl1.Location = New System.Drawing.Point(0, 0) - Me.RibbonControl1.MaxItemId = 22 + Me.RibbonControl1.MaxItemId = 24 Me.RibbonControl1.Name = "RibbonControl1" Me.RibbonControl1.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1}) Me.RibbonControl1.RepositoryItems.AddRange(New DevExpress.XtraEditors.Repository.RepositoryItem() {Me.RepositoryItemRadioGroup1, Me.RepositoryItemComboBox1, Me.RepositoryItemTextEdit1, Me.RepositoryItemDateEdit1, Me.RepositoryItemDateEdit2, Me.RepositoryItemComboBox2, Me.RepositoryItemTimeSpanEdit1}) Me.RibbonControl1.ShowApplicationButton = DevExpress.Utils.DefaultBoolean.[False] - Me.RibbonControl1.Size = New System.Drawing.Size(1070, 158) + Me.RibbonControl1.ShowItemCaptionsInCaptionBar = True + Me.RibbonControl1.ShowPageHeadersMode = DevExpress.XtraBars.Ribbon.ShowPageHeadersMode.Hide + Me.RibbonControl1.Size = New System.Drawing.Size(1020, 131) Me.RibbonControl1.StatusBar = Me.RibbonStatusBar1 ' + 'BarButtonItem2 + ' + Me.BarButtonItem2.Caption = "Fenster wiederherstellen" + Me.BarButtonItem2.Id = 23 + Me.BarButtonItem2.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonItem2.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) + Me.BarButtonItem2.Name = "BarButtonItem2" + Me.BarButtonItem2.Visibility = DevExpress.XtraBars.BarItemVisibility.Never + ' 'BarButtonNewSearch ' Me.BarButtonNewSearch.Caption = "Neue Suche" @@ -234,31 +247,32 @@ Partial Class frmSearchStart ' 'BarCheckboxOpenSearchInSameWindow ' - Me.BarCheckboxOpenSearchInSameWindow.Caption = "Suche in gleichem Fenster öffnen" + Me.BarCheckboxOpenSearchInSameWindow.Caption = "Ergebnis in gleichem Fenster öffnen" Me.BarCheckboxOpenSearchInSameWindow.Id = 21 - Me.BarCheckboxOpenSearchInSameWindow.ImageOptions.SvgImage = CType(resources.GetObject("BarCheckItem1.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) + Me.BarCheckboxOpenSearchInSameWindow.ImageOptions.SvgImage = CType(resources.GetObject("BarCheckboxOpenSearchInSameWindow.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) Me.BarCheckboxOpenSearchInSameWindow.Name = "BarCheckboxOpenSearchInSameWindow" ' + 'BarButtonItem1 + ' + Me.BarButtonItem1.Caption = "Fenster wiederherstellen" + Me.BarButtonItem1.Id = 22 + Me.BarButtonItem1.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonItem1.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) + Me.BarButtonItem1.Name = "BarButtonItem1" + ' 'RibbonPage1 ' - Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroup2, Me.RibbonPageGroupProfiles, Me.RibbonPageGroupFilter}) + Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroupFunctions, Me.RibbonPageGroupProfiles, Me.RibbonPageGroupFilter, Me.RibbonPageGroupSettings}) Me.RibbonPage1.Name = "RibbonPage1" Me.RibbonPage1.Text = "Start" ' - 'RibbonPageGroup1 + 'RibbonPageGroupFunctions ' - Me.RibbonPageGroup1.ItemLinks.Add(Me.BarButtonStartSearch) - Me.RibbonPageGroup1.ItemLinks.Add(Me.BarButtonClearSearch) - Me.RibbonPageGroup1.ItemLinks.Add(Me.BarButtonNewSearch) - Me.RibbonPageGroup1.ItemLinks.Add(Me.BarButtonSaveSearch) - Me.RibbonPageGroup1.Name = "RibbonPageGroup1" - Me.RibbonPageGroup1.Text = "Suchfunktionen" - ' - 'RibbonPageGroup2 - ' - Me.RibbonPageGroup2.ItemLinks.Add(Me.BarCheckboxOpenSearchInSameWindow) - Me.RibbonPageGroup2.Name = "RibbonPageGroup2" - Me.RibbonPageGroup2.Text = "Sucheinstellungen" + Me.RibbonPageGroupFunctions.ItemLinks.Add(Me.BarButtonStartSearch) + Me.RibbonPageGroupFunctions.ItemLinks.Add(Me.BarButtonNewSearch) + Me.RibbonPageGroupFunctions.ItemLinks.Add(Me.BarButtonClearSearch) + Me.RibbonPageGroupFunctions.ItemLinks.Add(Me.BarButtonSaveSearch) + Me.RibbonPageGroupFunctions.Name = "RibbonPageGroupFunctions" + Me.RibbonPageGroupFunctions.Text = "Suchfunktionen" ' 'RibbonPageGroupProfiles ' @@ -275,6 +289,12 @@ Partial Class frmSearchStart Me.RibbonPageGroupFilter.Name = "RibbonPageGroupFilter" Me.RibbonPageGroupFilter.Text = "Filter" ' + 'RibbonPageGroupSettings + ' + Me.RibbonPageGroupSettings.ItemLinks.Add(Me.BarCheckboxOpenSearchInSameWindow) + Me.RibbonPageGroupSettings.Name = "RibbonPageGroupSettings" + Me.RibbonPageGroupSettings.Text = "Sucheinstellungen" + ' 'RepositoryItemTextEdit1 ' Me.RepositoryItemTextEdit1.AutoHeight = False @@ -289,10 +309,10 @@ Partial Class frmSearchStart 'RibbonStatusBar1 ' Me.RibbonStatusBar1.ItemLinks.Add(Me.BarStaticItemInfo) - Me.RibbonStatusBar1.Location = New System.Drawing.Point(0, 577) + Me.RibbonStatusBar1.Location = New System.Drawing.Point(0, 455) Me.RibbonStatusBar1.Name = "RibbonStatusBar1" Me.RibbonStatusBar1.Ribbon = Me.RibbonControl1 - Me.RibbonStatusBar1.Size = New System.Drawing.Size(1070, 24) + Me.RibbonStatusBar1.Size = New System.Drawing.Size(1020, 22) ' 'pnlProfileChoose ' @@ -301,10 +321,10 @@ Partial Class frmSearchStart Me.pnlProfileChoose.Controls.Add(Me.Label1) Me.pnlProfileChoose.Dock = System.Windows.Forms.DockStyle.Top Me.pnlProfileChoose.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.pnlProfileChoose.Location = New System.Drawing.Point(0, 158) + Me.pnlProfileChoose.Location = New System.Drawing.Point(0, 131) Me.pnlProfileChoose.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.pnlProfileChoose.Name = "pnlProfileChoose" - Me.pnlProfileChoose.Size = New System.Drawing.Size(1070, 57) + Me.pnlProfileChoose.Size = New System.Drawing.Size(1020, 57) Me.pnlProfileChoose.TabIndex = 5 ' 'cmbProfile @@ -315,7 +335,7 @@ Partial Class frmSearchStart Me.cmbProfile.FormattingEnabled = True Me.cmbProfile.Location = New System.Drawing.Point(3, 23) Me.cmbProfile.Name = "cmbProfile" - Me.cmbProfile.Size = New System.Drawing.Size(1065, 21) + Me.cmbProfile.Size = New System.Drawing.Size(1015, 21) Me.cmbProfile.TabIndex = 2 Me.cmbProfile.ValueMember = "DOKART_ID" ' @@ -337,68 +357,68 @@ Partial Class frmSearchStart Me.XtraTabControl1.MultiLine = DevExpress.Utils.DefaultBoolean.[False] Me.XtraTabControl1.Name = "XtraTabControl1" Me.XtraTabControl1.SelectedTabPage = Me.XtraTabPage1 - Me.XtraTabControl1.Size = New System.Drawing.Size(1070, 362) + Me.XtraTabControl1.Size = New System.Drawing.Size(1020, 267) Me.XtraTabControl1.TabIndex = 12 Me.XtraTabControl1.TabPages.AddRange(New DevExpress.XtraTab.XtraTabPage() {Me.XtraTabPage1, Me.XtraTabPage2, Me.XtraTabPage3, Me.XtraTabPage4, Me.XtraTabPage5, Me.XtraTabPage6, Me.XtraTabPage7, Me.XtraTabPage8, Me.XtraTabPage9, Me.XtraTabPage10}) ' 'XtraTabPage1 ' Me.XtraTabPage1.Name = "XtraTabPage1" - Me.XtraTabPage1.Size = New System.Drawing.Size(1068, 337) + Me.XtraTabPage1.Size = New System.Drawing.Size(1018, 244) Me.XtraTabPage1.Text = "Search#1" ' 'XtraTabPage2 ' Me.XtraTabPage2.Name = "XtraTabPage2" - Me.XtraTabPage2.Size = New System.Drawing.Size(1068, 337) + Me.XtraTabPage2.Size = New System.Drawing.Size(1018, 244) Me.XtraTabPage2.Text = "Search#2" ' 'XtraTabPage3 ' Me.XtraTabPage3.Name = "XtraTabPage3" - Me.XtraTabPage3.Size = New System.Drawing.Size(1068, 337) + Me.XtraTabPage3.Size = New System.Drawing.Size(1018, 244) Me.XtraTabPage3.Text = "Search#3" ' 'XtraTabPage4 ' Me.XtraTabPage4.Name = "XtraTabPage4" - Me.XtraTabPage4.Size = New System.Drawing.Size(1068, 337) + Me.XtraTabPage4.Size = New System.Drawing.Size(1018, 244) Me.XtraTabPage4.Text = "Search#4" ' 'XtraTabPage5 ' Me.XtraTabPage5.Name = "XtraTabPage5" - Me.XtraTabPage5.Size = New System.Drawing.Size(1068, 337) + Me.XtraTabPage5.Size = New System.Drawing.Size(1018, 244) Me.XtraTabPage5.Text = "Search#5" ' 'XtraTabPage6 ' Me.XtraTabPage6.Name = "XtraTabPage6" - Me.XtraTabPage6.Size = New System.Drawing.Size(1068, 337) + Me.XtraTabPage6.Size = New System.Drawing.Size(1018, 244) Me.XtraTabPage6.Text = "Search#6" ' 'XtraTabPage7 ' Me.XtraTabPage7.Name = "XtraTabPage7" - Me.XtraTabPage7.Size = New System.Drawing.Size(1068, 337) + Me.XtraTabPage7.Size = New System.Drawing.Size(1018, 244) Me.XtraTabPage7.Text = "Search#7" ' 'XtraTabPage8 ' Me.XtraTabPage8.Name = "XtraTabPage8" - Me.XtraTabPage8.Size = New System.Drawing.Size(1068, 337) + Me.XtraTabPage8.Size = New System.Drawing.Size(1018, 244) Me.XtraTabPage8.Text = "Search#8" ' 'XtraTabPage9 ' Me.XtraTabPage9.Name = "XtraTabPage9" - Me.XtraTabPage9.Size = New System.Drawing.Size(1068, 337) + Me.XtraTabPage9.Size = New System.Drawing.Size(1018, 244) Me.XtraTabPage9.Text = "Search#9" ' 'XtraTabPage10 ' Me.XtraTabPage10.Name = "XtraTabPage10" - Me.XtraTabPage10.Size = New System.Drawing.Size(1068, 337) + Me.XtraTabPage10.Size = New System.Drawing.Size(1018, 244) Me.XtraTabPage10.Text = "Search#10" ' 'ContextMenuStripSearchTerms @@ -437,13 +457,13 @@ Partial Class frmSearchStart Me.SplitContainerControlSearch.CollapsePanel = DevExpress.XtraEditors.SplitCollapsePanel.Panel2 Me.SplitContainerControlSearch.Dock = System.Windows.Forms.DockStyle.Fill Me.SplitContainerControlSearch.FixedPanel = DevExpress.XtraEditors.SplitFixedPanel.Panel2 - Me.SplitContainerControlSearch.Location = New System.Drawing.Point(0, 215) + Me.SplitContainerControlSearch.Location = New System.Drawing.Point(0, 188) Me.SplitContainerControlSearch.Name = "SplitContainerControlSearch" Me.SplitContainerControlSearch.Panel1.Controls.Add(Me.XtraTabControl1) Me.SplitContainerControlSearch.Panel1.Text = "Panel1" Me.SplitContainerControlSearch.Panel2.Text = "Panel2" Me.SplitContainerControlSearch.PanelVisibility = DevExpress.XtraEditors.SplitPanelVisibility.Panel1 - Me.SplitContainerControlSearch.Size = New System.Drawing.Size(1070, 362) + Me.SplitContainerControlSearch.Size = New System.Drawing.Size(1020, 267) Me.SplitContainerControlSearch.SplitterPosition = 310 Me.SplitContainerControlSearch.TabIndex = 16 ' @@ -453,13 +473,14 @@ Partial Class frmSearchStart Me.Appearance.Options.UseFont = True Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(1070, 601) + Me.ClientSize = New System.Drawing.Size(1020, 477) Me.Controls.Add(Me.SplitContainerControlSearch) Me.Controls.Add(Me.pnlProfileChoose) Me.Controls.Add(Me.RibbonStatusBar1) Me.Controls.Add(Me.RibbonControl1) Me.IconOptions.Icon = CType(resources.GetObject("frmSearchStart.IconOptions.Icon"), System.Drawing.Icon) Me.IconOptions.SvgImage = CType(resources.GetObject("frmSearchStart.IconOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) + Me.IconOptions.SvgImageColorizationMode = DevExpress.Utils.SvgImageColorizationMode.Full Me.KeyPreview = True Me.Name = "frmSearchStart" Me.Ribbon = Me.RibbonControl1 @@ -489,7 +510,7 @@ End Sub Friend WithEvents RibbonControl1 As DevExpress.XtraBars.Ribbon.RibbonControl Friend WithEvents RibbonPage1 As DevExpress.XtraBars.Ribbon.RibbonPage - Friend WithEvents RibbonPageGroup1 As DevExpress.XtraBars.Ribbon.RibbonPageGroup + Friend WithEvents RibbonPageGroupFunctions As DevExpress.XtraBars.Ribbon.RibbonPageGroup Friend WithEvents RibbonStatusBar1 As DevExpress.XtraBars.Ribbon.RibbonStatusBar Friend WithEvents pnlProfileChoose As Panel Friend WithEvents cmbProfile As ComboBox @@ -534,5 +555,7 @@ End Sub Friend WithEvents RepositoryItemComboBox2 As DevExpress.XtraEditors.Repository.RepositoryItemComboBox Friend WithEvents RepositoryItemTimeSpanEdit1 As DevExpress.XtraEditors.Repository.RepositoryItemTimeSpanEdit Friend WithEvents BarCheckboxOpenSearchInSameWindow As DevExpress.XtraBars.BarCheckItem - Friend WithEvents RibbonPageGroup2 As DevExpress.XtraBars.Ribbon.RibbonPageGroup + Friend WithEvents RibbonPageGroupSettings As DevExpress.XtraBars.Ribbon.RibbonPageGroup + Friend WithEvents BarButtonItem1 As DevExpress.XtraBars.BarButtonItem + Friend WithEvents BarButtonItem2 As DevExpress.XtraBars.BarButtonItem End Class diff --git a/GUIs.ZooFlow/frmSearchStart.resx b/GUIs.ZooFlow/frmSearchStart.resx index d506b55a..e343c8eb 100644 --- a/GUIs.ZooFlow/frmSearchStart.resx +++ b/GUIs.ZooFlow/frmSearchStart.resx @@ -118,6 +118,23 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjE5LjIsIFZlcnNpb249MTkuMi4z + LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl + dkV4cHJlc3MuVXRpbHMuU3ZnLlN2Z0ltYWdlAQAAAAREYXRhBwICAAAACQMAAAAPAwAAACECAAAC77u/ + PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4NCjxzdmcgeD0iMHB4IiB5PSIwcHgi + IHZpZXdCb3g9IjAgMCAzMiAzMiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcv + MjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3Bh + Y2U9InByZXNlcnZlIiBpZD0iRmlsbF9Eb3duIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAg + MCAzMiAzMiI+DQogIDxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+CgkuQmx1ZXtmaWxsOiMxMTc3RDc7fQoJ + LkJsYWNre2ZpbGw6IzcyNzI3Mjt9Cgkuc3Qwe29wYWNpdHk6MC41O30KPC9zdHlsZT4NCiAgPGcgY2xh + c3M9InN0MCI+DQogICAgPHBhdGggZD0iTTI4LDEwdjIwSDJWMTBoMTB2Nkg3LjNMMTUsMjcuNkwyMi43 + LDE2SDE4di02SDI4eiIgY2xhc3M9IkJsYWNrIiAvPg0KICA8L2c+DQogIDxwYXRoIGQ9Ik0yOCw4SDJW + MmgyNlY4eiBNMTQsMTB2OGgtM2w0LDZsNC02aC0zdi04SDE0eiIgY2xhc3M9IkJsdWUiIC8+DQo8L3N2 + Zz4L + + AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjE5LjIsIFZlcnNpb249MTkuMi4z @@ -209,7 +226,7 @@ LDI2LDI0LDI2eiIgY2xhc3M9IkJsYWNrIiAvPg0KPC9zdmc+Cw== - + AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjE5LjIsIFZlcnNpb249MTkuMi4z LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl @@ -233,6 +250,23 @@ MCwxNnYtNWMwLTAuNSwwLjUtMSwxLTFoMThjMC41LDAsMSwwLjUsMSwxdjVIMHogTTI4LDhWM2MwLTAu NS0wLjUtMS0xLTFIOUM4LjUsMiw4LDIuNSw4LDN2NUgyOHoiIGNsYXNzPSJCbHVlIiAvPg0KICA8L2c+ DQo8L3N2Zz4L + + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjE5LjIsIFZlcnNpb249MTkuMi4z + LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl + dkV4cHJlc3MuVXRpbHMuU3ZnLlN2Z0ltYWdlAQAAAAREYXRhBwICAAAACQMAAAAPAwAAACECAAAC77u/ + PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4NCjxzdmcgeD0iMHB4IiB5PSIwcHgi + IHZpZXdCb3g9IjAgMCAzMiAzMiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcv + MjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3Bh + Y2U9InByZXNlcnZlIiBpZD0iRmlsbF9Eb3duIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAg + MCAzMiAzMiI+DQogIDxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+CgkuQmx1ZXtmaWxsOiMxMTc3RDc7fQoJ + LkJsYWNre2ZpbGw6IzcyNzI3Mjt9Cgkuc3Qwe29wYWNpdHk6MC41O30KPC9zdHlsZT4NCiAgPGcgY2xh + c3M9InN0MCI+DQogICAgPHBhdGggZD0iTTI4LDEwdjIwSDJWMTBoMTB2Nkg3LjNMMTUsMjcuNkwyMi43 + LDE2SDE4di02SDI4eiIgY2xhc3M9IkJsYWNrIiAvPg0KICA8L2c+DQogIDxwYXRoIGQ9Ik0yOCw4SDJW + MmgyNlY4eiBNMTQsMTB2OGgtM2w0LDZsNC02aC0zdi04SDE0eiIgY2xhc3M9IkJsdWUiIC8+DQo8L3N2 + Zz4L diff --git a/GUIs.ZooFlow/frmSearchStart.vb b/GUIs.ZooFlow/frmSearchStart.vb index 9042e456..ee40acd5 100644 --- a/GUIs.ZooFlow/frmSearchStart.vb +++ b/GUIs.ZooFlow/frmSearchStart.vb @@ -1,22 +1,29 @@ Option Explicit On Imports DigitalData.Modules.Logging +Imports DigitalData.Modules.Language Imports DevExpress.XtraTab Imports DevExpress.XtraGrid Imports DevExpress.XtraGrid.Views.Grid Imports DevExpress.XtraEditors Imports DevExpress.XtraSplashScreen Imports DigitalData.GUIs.Common +Imports DigitalData.GUIs.ZooFlow.ClassConstants +Imports DigitalData.GUIs.ZooFlow.SearchFilter Imports System.Threading.Tasks + Public Class frmSearchStart Private Logger As Logger + ' Constants Private Const DEFAULT_X As Integer = 10 Private Const DEFAULT_Y As Integer = 10 + ' Runtime Variables Private SelectedTabIndex As Integer Private SelectedTab As XtraTabPage + Private HeightBeforeMinimizing As Integer = 600 Private SEARCH_ID As Integer = 0 Private SEARCH_SQL As String @@ -31,11 +38,15 @@ Public Class frmSearchStart Private LastSearchForm As frmDocumentResultList Private ChangedDateControls As List(Of String) + Private StopWatch As Watch + Public Sub New(ByVal pDTSearchProfiles As DataTable, Optional ByVal pRunSearch As Boolean = False) ' Dieser Aufruf ist für den Designer erforderlich. InitializeComponent() ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu. + StopWatch = New Watch(Name) + DatatableSearchProfiles = pDTSearchProfiles Logger = My.LogConfig.GetLogger() Dim oSearchTerms As New DataTable @@ -48,6 +59,7 @@ Public Class frmSearchStart oSearchTerms.Columns.Add("SearchTerm", GetType(String)) oSearchTerms.Columns.Add("BracketRight", GetType(String)) oSearchTerms.Columns.Add("Operator", GetType(String)) + End Sub Private Async Sub frmSearchStart_Load(sender As Object, e As EventArgs) Handles Me.Load @@ -56,30 +68,14 @@ Public Class frmSearchStart Try oHandle = SplashScreenManager.ShowOverlayForm(Me) + Dim oWatch As New Watch("Setting up Form") + pnlProfileChoose.Visible = False For Each oTab As XtraTabPage In XtraTabControl1.TabPages oTab.PageVisible = False Next - RepositoryItemComboBox2.Items.AddRange(New List(Of FilterTimeframe) From { - New FilterTimeframe() With {.Name = "Kein", .DisableFilter = True}, - New FilterTimeframe() With {.Name = "Eigener", .CustomFilter = True}, - New FilterTimeframe() With { - .Name = "letzte 7 Tage", - .From = Date.Now.Subtract(TimeSpan.FromDays(7)), - .[To] = Date.Now - }, - New FilterTimeframe() With { - .Name = "letzte 14 Tage", - .From = Date.Now.Subtract(TimeSpan.FromDays(14)), - .[To] = Date.Now - }, - New FilterTimeframe() With { - .Name = "letzte 30 Tage", - .From = Date.Now.Subtract(TimeSpan.FromDays(30)), - .[To] = Date.Now - } - }) + RepositoryItemComboBox2.Items.AddRange(DefaultFilters) BarCheckboxOpenSearchInSameWindow.Checked = My.UIConfig.SearchForm.OpenSearchInSameWindow @@ -96,6 +92,8 @@ Public Class frmSearchStart For Each oRow As DataRow In DatatableSearchProfiles.Rows RepositoryItemComboBox1.Items.Add(oRow.Item("TITLE")) Next + + oWatch.Stop() Else pnlProfileChoose.Visible = False RibbonPageGroupProfiles.Visible = False @@ -108,7 +106,10 @@ Public Class frmSearchStart SEARCH_SQL = DatatableSearchProfiles.Rows(0).Item("RESULT_SQL") SEARCH_TITLE = DatatableSearchProfiles.Rows(0).Item("TITLE") + oWatch.Stop() + oWatch = New Watch("Loading Attributes") Await Load_Search_Attributes() + oWatch.Stop() BarButtonNewSearch.Visibility = DevExpress.XtraBars.BarItemVisibility.Never End If SEARCH_COUNT = DatatableSearchProfiles.Rows.Count @@ -127,37 +128,50 @@ Public Class frmSearchStart MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error while loading ProfileSearches:") Finally SplashScreenManager.CloseOverlayForm(oHandle) + StopWatch.Stop() End Try End Sub Async Function Load_Search_Attributes() As Task Try DataLoaded = False + + Dim oWatch1 As New Watch("Getting data from Database") Dim oSQL = $"SELECT * FROM VWIDB_SEARCH_PROFILE_ATTRIBUTES WHERE SEARCH_PROFIL_ID = {SEARCH_ID} ORDER BY [SEQUENCE]" Dim oDT As DataTable = Await My.DatabaseIDB.GetDatatableAsync(oSQL) + oWatch1.Stop() + + Dim oWatch2 As New Watch("Procesing Dataset") DatatableAttributes = Nothing DatatableAttributes = oDT.Clone() oDT.Select("", "SEQUENCE").CopyToDataTable(DatatableAttributes, LoadOption.PreserveChanges) + oWatch2.Stop() Dim oControlCount As Integer = 1 Dim oControlRow As Integer = 0 Dim oControls As New ClassControlCreator(SelectedTab, Me) - Dim YMax As Integer = 0 + Dim YActControlHeight As Integer = 0 Dim XActControlWidth As Integer = 0 - Dim iList As New List(Of Integer) From {2, 3, 5, 6, 8, 9} + For Each oAttributeRow As DataRow In oDT.Rows Dim oXPosition As Integer Dim oYPositionControl As Integer Dim oYPositionLabel As Integer Dim oMyLastGridView As GridView Dim oSingleResult As Boolean = False - Dim oAttriTitle As String = oAttributeRow.Item("ATTRIBUTE_TITLE").ToString + Dim oAttributeTitle As String = oAttributeRow.Item("ATTRIBUTE_TITLE").ToString Dim oAttriID As Integer = CInt(oAttributeRow.Item("ATTRIBUTE_ID")) Dim oAttributeType As String = oAttributeRow.Item("ATTRIBUTE_TYPE").ToString + + Dim oWatch3 As New Watch($"Loading Attribute: {oAttributeTitle}") + + Dim oWatch4 As New Watch($"Calculating Position") + If oControlCount = 1 Or oControlCount = 5 Or oControlCount = 9 Then oControlRow += 1 End If + If oControlRow = 1 Then If oControlCount = 1 Then oXPosition = 10 @@ -177,30 +191,39 @@ Public Class frmSearchStart End If End If - Dim oControlHeight As Integer = CInt(oAttributeRow.Item("HEIGHT")) + oWatch4.Stop() + oWatch4 = New Watch("Creating Label") + + 'Dim oControlHeight As Integer = CInt(oAttributeRow.Item("HEIGHT")) + Dim oControlHeight As Integer = 150 Dim oControlWidth As Integer = CInt(oAttributeRow.Item("WIDTH")) + 'Dim oControlWidth As Integer = 150 If CBool(oAttributeRow.Item("MULTISELECT")) = True Then oControlWidth += 50 End If - addLabel(oAttriTitle, oXPosition, oYPositionLabel) + addLabel(oAttributeTitle, oXPosition, oYPositionLabel) 'Nun das Control mit dem entsprechenden Abstand und der Größe Dim oCalcHeight As Integer Dim oCalcWidth As Integer - If oAttributeType = "VARCHAR" Or oAttributeType = "BIG INTEGER" Then + If oAttributeType = ATTR_TYPE_STRING Or oAttributeType = ATTR_TYPE_INTEGER Then oCalcHeight = oControlHeight + oYPositionControl oCalcWidth = oControlWidth - ElseIf (oAttributeType = "DATE" Or oAttributeType = "BIT") Then + ElseIf (oAttributeType = ATTR_TYPE_DATE Or oAttributeType = ATTR_TYPE_BOOLEAN) Then oCalcHeight = 20 + oYPositionControl oCalcWidth = 100 End If If oCalcHeight > YActControlHeight Then YActControlHeight = oCalcHeight End If + + oWatch4.Stop() + oWatch4 = New Watch("Creating Control") + Dim oMyControl As Control = Nothing - If oAttributeType = "VARCHAR" Or oAttributeType = "BIG INTEGER" Then + If oAttributeType = ATTR_TYPE_STRING Or oAttributeType = ATTR_TYPE_INTEGER Then oMyControl = oControls.CreateExistingGridControl(oAttributeRow, oXPosition, oYPositionControl) Dim myDGV As GridControl = CType(oMyControl, GridControl) @@ -212,7 +235,7 @@ Public Class frmSearchStart End If End If - Dim oView As DevExpress.XtraGrid.Views.Grid.GridView + Dim oView As GridView oView = CType(myDGV.MainView, GridView) oMyLastGridView = oView If CBool(oAttributeRow.Item("MULTISELECT")) = True Then @@ -223,28 +246,30 @@ Public Class frmSearchStart End If oView.FocusInvalidRow() - ElseIf oAttributeType = "DATE" Then + ElseIf oAttributeType = ATTR_TYPE_DATE Then oMyControl = oControls.CreateExistingDatepicker(oAttributeRow, oXPosition, oYPositionControl) Dim myDTP As DateEdit = CType(oMyControl, DateEdit) AddHandler myDTP.DisableCalendarDate, AddressOf DisableCalendarDate AddHandler myDTP.DateTimeChanged, AddressOf CalendarChanged 'CalendarChanged - ElseIf oAttributeType = "BIT" Then + ElseIf oAttributeType = ATTR_TYPE_BOOLEAN Then oMyControl = oControls.CreateExistingCheckbox(oAttributeRow, oXPosition, oYPositionControl) Dim myCheckBox As CheckBox = CType(oMyControl, CheckBox) AddHandler myCheckBox.CheckedChanged, AddressOf CheckBox_CheckedChanged End If + oWatch4.Stop() + oWatch4 = New Watch("Adding Control to Panel") + oControlCount += 1 If oMyControl IsNot Nothing Then SelectedTab.Controls.Add(oMyControl) End If - If oAttributeType = "VARCHAR" Or oAttributeType = "BIG INTEGER" Then - oMyLastGridView.FocusInvalidRow() - End If - oXPosition += oControlWidth + 20 + + oWatch4.Stop() + oWatch3.Stop() Next Catch ex As Exception Logger.Warn("Unexpected error in Load_Search_Attributes - Error: " & ex.Message) @@ -252,7 +277,6 @@ Public Class frmSearchStart Finally DataLoaded = True End Try - End Function Sub addLabel(pAttrName As String, pXPos As Integer, ylbl As Integer) Dim lbl As New Label With { @@ -296,8 +320,8 @@ Public Class frmSearchStart Continue For End If - oAttrID = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttrID - oAttrTitle = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttrTitle + oAttrID = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttributeID + oAttrTitle = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttributeTitle For Each oRowHandle As Integer In oSelectedRows Dim oResult = oMyGridView.GetRowCellValue(oRowHandle, oMyGridView.Columns(0).FieldName) Dim oInsert = $"EXEC PRIDB_NEW_USER_SEARCH_CRITERIA {SEARCH_ID.ToString},{My.Application.User.UserId.ToString},{oAttrID.ToString},'{oResult}','{My.Application.User.UserName}'" @@ -315,8 +339,8 @@ Public Class frmSearchStart For Each oName As String In ChangedDateControls If oDateEdit.Name = oName Then If Not IsNothing(oDateEdit.EditValue) Then - oAttrID = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttrID - oAttrTitle = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttrTitle + oAttrID = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttributeID + oAttrTitle = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttributeTitle Dim oldValue As Date Dim validDate As Boolean = False Dim oDateValue As Date = DirectCast(oDateEdit.EditValue, Date) @@ -344,8 +368,8 @@ Public Class frmSearchStart Case "System.Windows.Forms.CheckBox" Dim myCheckBox As CheckBox = CType(oControl, CheckBox) If myCheckBox.CheckState <> CheckState.Indeterminate Then - oAttrID = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttrID - oAttrTitle = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttrTitle + oAttrID = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttributeID + oAttrTitle = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttributeTitle Dim oInsert = $"EXEC PRIDB_NEW_USER_SEARCH_CRITERIA {SEARCH_ID.ToString},{My.Application.User.UserId.ToString},{oAttrID.ToString},'{myCheckBox.Checked.ToString}','{My.Application.User.UserName}'" My.DatabaseIDB.ExecuteNonQuery(oInsert) End If @@ -363,8 +387,8 @@ Public Class frmSearchStart If IsNothing(oRowView) = False Then Dim oResult As String = CType(oRowView.Item(0), String) - Dim oAttrID = DirectCast(oCurrentControl.Tag, ClassControlCreator.ControlMetadata).AttrID - Dim oAttrTitle = DirectCast(oCurrentControl.Tag, ClassControlCreator.ControlMetadata).AttrTitle + Dim oAttrID = DirectCast(oCurrentControl.Tag, ClassControlCreator.ControlMetadata).AttributeID + Dim oAttrTitle = DirectCast(oCurrentControl.Tag, ClassControlCreator.ControlMetadata).AttributeTitle ' RenewSearchAttributes() ' AddSearchAttribute(oAttrID, oAttrTitle, oResult) @@ -375,8 +399,8 @@ Public Class frmSearchStart If DataLoaded = False Then Exit Sub Dim oCurrentCB As CheckBox = DirectCast(sender, CheckBox) Dim oChecked = oCurrentCB.Checked - Dim oAttrID = DirectCast(oCurrentCB.Tag, ClassControlCreator.ControlMetadata).AttrID - Dim oAttrTitle = DirectCast(oCurrentCB.Tag, ClassControlCreator.ControlMetadata).AttrTitle + Dim oAttrID = DirectCast(oCurrentCB.Tag, ClassControlCreator.ControlMetadata).AttributeID + Dim oAttrTitle = DirectCast(oCurrentCB.Tag, ClassControlCreator.ControlMetadata).AttributeTitle 'RenewSearchAttributes() ' AddSearchAttribute(oAttrID, oAttrTitle, oChecked.ToString) End Sub @@ -497,8 +521,8 @@ Public Class frmSearchStart If IsNothing(oRowView) = False Then Dim oResult As String = CType(oRowView.Item(0), String) - Dim oAttrID = DirectCast(oCurrentControl.Tag, ClassControlCreator.ControlMetadata).AttrID - Dim oAttrTitle = DirectCast(oCurrentControl.Tag, ClassControlCreator.ControlMetadata).AttrTitle + Dim oAttrID = DirectCast(oCurrentControl.Tag, ClassControlCreator.ControlMetadata).AttributeID + Dim oAttrTitle = DirectCast(oCurrentControl.Tag, ClassControlCreator.ControlMetadata).AttributeTitle End If End Sub @@ -544,10 +568,19 @@ Public Class frmSearchStart Private Sub BarButtonStartSearch_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonStartSearch.ItemClick RenewSearchAttributes() - Start_Search() + + ' Minimize the search form, but only if results were found + If Start_Search() Then + MinimizeSearchForm() + + ' Position Result Window below this window + LastSearchForm.Location = GetResultFormLocation() + LastSearchForm.Size = GetResultFormSize() + End If End Sub - Private Sub Start_Search() + Private Function Start_Search() As Boolean Dim oHandle As IOverlaySplashScreenHandle = Nothing + Dim oItemsFound As Boolean = False Try oHandle = SplashScreenManager.ShowOverlayForm(Me) @@ -587,16 +620,14 @@ Public Class frmSearchStart Dim oForm As New frmDocumentResultList(My.LogConfig, oEnvironment, oParams) oForm.Show() - ' Position Result Window below this window - oForm.Location = GetResultFormLocation() - oForm.Size = GetResultFormSize() - AddHandler oForm.FormClosed, Sub() LastSearchForm = Nothing End Sub LastSearchForm = oForm End If + + oItemsFound = True Else Display_InfoItem("No results for this searchcombination!", Color.OrangeRed, Color.White) End If @@ -605,7 +636,9 @@ Public Class frmSearchStart Finally SplashScreenManager.CloseOverlayForm(oHandle) End Try - End Sub + + Return oItemsFound + End Function Private Function GetResultFormLocation() As Point Dim oX = Location.X @@ -628,17 +661,24 @@ Public Class frmSearchStart End If End Sub - Private Class FilterTimeframe - Public Property Name As String - Public Property From As Date - Public Property [To] As Date - Public Property DisableFilter As Boolean = False - Public Property CustomFilter As Boolean = False + Private Sub MinimizeSearchForm() + HeightBeforeMinimizing = Height + Height = 200 + + BarButtonItem2.Visibility = DevExpress.XtraBars.BarItemVisibility.Always + End Sub + + Private Sub RestoreSearchForm() + Height = HeightBeforeMinimizing + + If LastSearchForm IsNot Nothing Then + LastSearchForm.Location = GetResultFormLocation() + End If + + BarButtonItem2.Visibility = DevExpress.XtraBars.BarItemVisibility.Never + End Sub + - Public Overrides Function ToString() As String - Return Name.ToString - End Function - End Class Private Sub cmbFilterTimeframe_EditValueChanged(sender As Object, e As EventArgs) Handles cmbFilterTimeframe.EditValueChanged Dim oTimeframe As FilterTimeframe = DirectCast(cmbFilterTimeframe.EditValue, FilterTimeframe) @@ -668,4 +708,16 @@ Public Class frmSearchStart My.UIConfig.SearchForm.Size = Size My.UIConfigManager.Save() End Sub + + Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick + RestoreSearchForm() + End Sub + + Private Sub BarButtonItem2_ItemClick_1(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick + RestoreSearchForm() + End Sub + + Private Sub RibbonControl1_MinimizedRibbonHiding(sender As Object, e As DevExpress.XtraBars.Ribbon.MinimizedRibbonEventArgs) Handles RibbonControl1.MinimizedRibbonHiding + + End Sub End Class \ No newline at end of file