From 0958e46eabb1a5c6287c44f9ffdfaeab8a2a76de Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Thu, 14 Jul 2022 11:49:41 +0200 Subject: [PATCH] Loading Form, center integer columns, use sequence field, simplify, fix layout --- GUIs.Monitor/Constants.vb | 8 + GUIs.Monitor/GridLoader.vb | 171 +++++++++++ GUIs.Monitor/Monitor.vbproj | 12 + GUIs.Monitor/My Project/Resources.Designer.vb | 10 + GUIs.Monitor/My Project/Resources.resx | 17 +- GUIs.Monitor/Resources/movepivottable.svg | 14 + GUIs.Monitor/SearchLoader.vb | 54 ++-- GUIs.Monitor/SearchParameter.vb | 1 + GUIs.Monitor/Validator.vb | 79 +++++ GUIs.Monitor/frmLoading.Designer.vb | 83 ++++++ GUIs.Monitor/frmLoading.resx | 120 ++++++++ GUIs.Monitor/frmLoading.vb | 24 ++ GUIs.Monitor/frmMonitor.Designer.vb | 26 +- GUIs.Monitor/frmMonitor.resx | 10 +- GUIs.Monitor/frmMonitor.vb | 277 ++++-------------- 15 files changed, 651 insertions(+), 255 deletions(-) create mode 100644 GUIs.Monitor/GridLoader.vb create mode 100644 GUIs.Monitor/Resources/movepivottable.svg create mode 100644 GUIs.Monitor/Validator.vb create mode 100644 GUIs.Monitor/frmLoading.Designer.vb create mode 100644 GUIs.Monitor/frmLoading.resx create mode 100644 GUIs.Monitor/frmLoading.vb diff --git a/GUIs.Monitor/Constants.vb b/GUIs.Monitor/Constants.vb index 1d57473..c3f44c7 100644 --- a/GUIs.Monitor/Constants.vb +++ b/GUIs.Monitor/Constants.vb @@ -7,6 +7,14 @@ 'Public Const STATE_DEFAULT As String = "DEFAULT" 'Public Const STATE_USER As String = "USER" + Public Class State + Public Const STATE_SUCCESS As String = "SUCCESS" + Public Const STATE_FAILURE As String = "FAILURE" + Public Const STATE_WARNING As String = "WARNING" + Public Const STATE_WAITING As String = "WAITING" + Public Const STATE_HIGHLIGHT As String = "HIGHLIGHT" + End Class + Public Enum ReturnTypeEnum Undefined Table diff --git a/GUIs.Monitor/GridLoader.vb b/GUIs.Monitor/GridLoader.vb new file mode 100644 index 0000000..796e5cf --- /dev/null +++ b/GUIs.Monitor/GridLoader.vb @@ -0,0 +1,171 @@ +Imports DevExpress.Utils +Imports DevExpress.XtraEditors.Controls +Imports DevExpress.XtraEditors.Repository +Imports DevExpress.XtraGrid +Imports DevExpress.XtraGrid.Views.Grid +Imports DevExpress.XtraTreeList +Imports DigitalData.GUIs.Common +Imports DigitalData.Modules.Base +Imports DigitalData.Modules.Logging + +Public Class GridLoader + Inherits BaseClass + + Public Const STATE_SUCCESS As String = "SUCCESS" + Public Const STATE_FAILURE As String = "FAILURE" + Public Const STATE_WARNING As String = "WARNING" + Public Const STATE_WAITING As String = "WAITING" + Public Const STATE_HIGHLIGHT As String = "HIGHLIGHT" + + Public ReadOnly Property SvgImageCollection As SvgImageCollection + Public ReadOnly Property GridBuilder As GridBuilder + + Private ReadOnly StateIcons As New Dictionary(Of String, NodeImage) From { + {STATE_SUCCESS, NodeImage.Success}, + {STATE_FAILURE, NodeImage.Failure} + } + + Private Enum NodeImage + [Default] = 0 + SQL = 1 + File = 2 + Mail = 3 + Success = 4 + Failure = 5 + Warning = 6 + Waiting = 7 + User = 8 + Highlight = 9 + End Enum + + Public Sub New(pLogConfig As LogConfig, pSvgImageCollection As SvgImageCollection) + MyBase.New(pLogConfig) + Me.SvgImageCollection = pSvgImageCollection + Me.GridBuilder = New GridBuilder() + End Sub + + Public Function InitTreeList() As TreeList + Dim oTreeList = New TreeList() With { + .Name = "TreeListResults", + .Visible = False + } + oTreeList.ForceInitialize() + oTreeList.KeyFieldName = "GUID" + oTreeList.ParentFieldName = "PARENT_ID" + + GridBuilder.SetDefaults(oTreeList) + GridBuilder.SetClipboardHandler(oTreeList) + GridBuilder.SetReadOnlyOptions(oTreeList) + + Return oTreeList + End Function + + Public Function InitGrid() As GridControl + Dim oGrid = New GridControl() With { + .Name = "GridViewResults", + .Visible = False + } + + oGrid.ForceInitialize() + Dim oView = DirectCast(oGrid.DefaultView, GridView) + + GridBuilder.SetDefaults(oView) + GridBuilder.SetClipboardHandler(oView) + GridBuilder.SetReadOnlyOptions(oView) + + Return oGrid + End Function + + Public Sub InitTreeListColumns(pTreeList As TreeList, pMaxLength As Integer) + Dim oColumn1 = pTreeList.Columns.Item("COLUMN1") + Dim oColumn2 = pTreeList.Columns.Item("COLUMN2") + Dim oColumn3 = pTreeList.Columns.Item("COLUMN3") + Dim oAddedWhenColumn = pTreeList.Columns.Item("ADDED_WHEN") + Dim oStateColumn = pTreeList.Columns.Item("STATE") + Dim oIconColumn = pTreeList.Columns.Item("ICON") + + Dim oStateEdit As RepositoryItemImageComboBox = GetStateEdit() + Dim oIconEdit As RepositoryItemImageComboBox = GetIconEdit() + + oColumn1.VisibleIndex = 0 + oStateColumn.VisibleIndex = 1 + oIconColumn.VisibleIndex = 2 + + Dim oColumnLength = pMaxLength * 5 + With oColumn1 + .Caption = "Titel" + .MinWidth = oColumnLength + .MaxWidth = oColumnLength + .Width = oColumnLength + .OptionsColumn.AllowSize = False + .OptionsColumn.AllowSort = False + End With + + With oColumn2 + .Caption = "Wert 1" + End With + + With oColumn3 + .Caption = "Wert 2" + End With + + With oAddedWhenColumn + .Caption = "Datum" + End With + + With oStateColumn + .ColumnEdit = oStateEdit + .MaxWidth = 25 + .MinWidth = 25 + .Width = 25 + .Caption = " " + .OptionsColumn.AllowSize = False + .OptionsColumn.AllowSort = False + .ImageOptions.Image = SvgImageCollection.GetImage(NodeImage.Success) + End With + + With oIconColumn + .ColumnEdit = oIconEdit + .MaxWidth = 25 + .MinWidth = 25 + .Width = 25 + .Caption = " " + .OptionsColumn.AllowSize = False + .OptionsColumn.AllowSort = False + .ImageOptions.Image = SvgImageCollection.GetImage(NodeImage.SQL) + End With + End Sub + + Private Function GetIconEdit() As RepositoryItemImageComboBox + Dim oIconEdit As New RepositoryItemImageComboBox With { + .SmallImages = SvgImageCollection, + .GlyphAlignment = HorzAlignment.Near + } + oIconEdit.Buttons.Clear() + oIconEdit.Items.AddRange(New List(Of ImageComboBoxItem) From { + New ImageComboBoxItem("Email", "MAIL", NodeImage.Mail), + New ImageComboBoxItem("SQL", "SQL", NodeImage.SQL), + New ImageComboBoxItem("File", "FILE", NodeImage.File) + }) + Return oIconEdit + End Function + + Private Function GetStateEdit() As RepositoryItemImageComboBox + Dim oStateEdit As New RepositoryItemImageComboBox With { + .SmallImages = SvgImageCollection, + .GlyphAlignment = HorzAlignment.Near + } + oStateEdit.Buttons.Clear() + oStateEdit.Items.AddRange(New List(Of ImageComboBoxItem) From { + New ImageComboBoxItem("Success", "SUCCESS", NodeImage.Success), + New ImageComboBoxItem("Failure", "FAILURE", NodeImage.Failure), + New ImageComboBoxItem("Warning", "WARNING", NodeImage.Warning), + New ImageComboBoxItem("Waiting", "WAITING", NodeImage.Waiting), + New ImageComboBoxItem("Default", "DEFAULT", NodeImage.Default), + New ImageComboBoxItem("User", "USER", NodeImage.User), + New ImageComboBoxItem("Highlight", "HIGHLIGHT", NodeImage.Highlight) + }) + + Return oStateEdit + End Function +End Class diff --git a/GUIs.Monitor/Monitor.vbproj b/GUIs.Monitor/Monitor.vbproj index 7d40c9a..4d6b330 100644 --- a/GUIs.Monitor/Monitor.vbproj +++ b/GUIs.Monitor/Monitor.vbproj @@ -145,6 +145,7 @@ Form + True Application.myapp @@ -155,6 +156,13 @@ + + frmLoading.vb + + + Form + + frmMonitor.vb @@ -170,6 +178,9 @@ Resources.resx True + + frmLoading.vb + SettingsSingleFileGenerator @@ -211,6 +222,7 @@ PreserveNewest + diff --git a/GUIs.Monitor/My Project/Resources.Designer.vb b/GUIs.Monitor/My Project/Resources.Designer.vb index c0aebc5..5e5d785 100644 --- a/GUIs.Monitor/My Project/Resources.Designer.vb +++ b/GUIs.Monitor/My Project/Resources.Designer.vb @@ -159,5 +159,15 @@ Namespace My.Resources Return CType(obj,DevExpress.Utils.Svg.SvgImage) End Get End Property + + ''' + ''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage. + ''' + Friend ReadOnly Property movepivottable() As DevExpress.Utils.Svg.SvgImage + Get + Dim obj As Object = ResourceManager.GetObject("movepivottable", resourceCulture) + Return CType(obj,DevExpress.Utils.Svg.SvgImage) + End Get + End Property End Module End Namespace diff --git a/GUIs.Monitor/My Project/Resources.resx b/GUIs.Monitor/My Project/Resources.resx index 38aa8fb..69d6cd7 100644 --- a/GUIs.Monitor/My Project/Resources.resx +++ b/GUIs.Monitor/My Project/Resources.resx @@ -124,9 +124,15 @@ ..\Resources\exporttoxlsx.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\exporttoxlsx1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + ..\Resources\export.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\managedatasource.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + ..\Resources\deletetable.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a @@ -136,16 +142,13 @@ ..\Resources\enablesearch.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\bo_dashboard.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - ..\Resources\gettingstarted.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\managedatasource.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\bo_dashboard.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\exporttoxlsx1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\movepivottable.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a \ No newline at end of file diff --git a/GUIs.Monitor/Resources/movepivottable.svg b/GUIs.Monitor/Resources/movepivottable.svg new file mode 100644 index 0000000..8767ed9 --- /dev/null +++ b/GUIs.Monitor/Resources/movepivottable.svg @@ -0,0 +1,14 @@ + + + + + + + + + \ No newline at end of file diff --git a/GUIs.Monitor/SearchLoader.vb b/GUIs.Monitor/SearchLoader.vb index e1a662f..df4120e 100644 --- a/GUIs.Monitor/SearchLoader.vb +++ b/GUIs.Monitor/SearchLoader.vb @@ -4,7 +4,7 @@ Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Language Imports DigitalData.GUIs.Monitor.Constants -Partial Public Class SearchLoader +Public Class SearchLoader Inherits BaseClass Private ReadOnly Config As Config @@ -30,6 +30,7 @@ Partial Public Class SearchLoader Dim oSearchId = oRow.ItemEx("GUID", 0) Dim oParams = Parameters. Where(Function(param) param.SearchId = oSearchId). + OrderBy(Function(param) param.Sequence). ToList() Searches.Add(New Search With { @@ -48,7 +49,31 @@ Partial Public Class SearchLoader End Try End Sub - Public Function GetItemType(pTypeString As String) As ItemTypeEnum + Public Sub LoadSearchParameters() + Dim oSQL As String = $"SELECT * FROM TBMON_PROFILE_PARAM WHERE ACTIVE = 1 ORDER BY SEQUENCE" + Dim oTable As DataTable = Database.GetDatatable(oSQL) + Dim oParameters As New List(Of SearchParameter) + + For Each oRow As DataRow In oTable.Rows + oParameters.Add(New SearchParameter With { + .Id = oRow.ItemEx("GUID", 0), + .Title = oRow.ItemEx("CAPTION", String.Empty), + .Description = oRow.ItemEx("DESCRIPTION", String.Empty), + .DataType = GetDataType(oRow.ItemEx("DATA_TYPE", "VARCHAR")), + .ItemString = oRow.ItemEx("ITEMS", String.Empty), + .ItemType = GetItemType(oRow.ItemEx("ITEM_TYPE", String.Empty)), + .Required = oRow.ItemEx("REQUIRED", True), + .PatternTitle = oRow.ItemEx("PATTERN", String.Empty), + .SearchId = oRow.ItemEx("PROFILE_ID", 0), + .DefaultValue = oRow.ItemEx("DEFAULT_VALUE", String.Empty), + .Sequence = oRow.ItemEx("SEQUENCE", 0) + }) + Next + + Parameters = oParameters + End Sub + + Private Function GetItemType(pTypeString As String) As ItemTypeEnum Select Case pTypeString Case "LIST" Return ItemTypeEnum.List @@ -59,7 +84,7 @@ Partial Public Class SearchLoader End Select End Function - Public Function GetReturnType(pTypeString As String) As ReturnTypeEnum + Private Function GetReturnType(pTypeString As String) As ReturnTypeEnum Select Case pTypeString Case "Table" Return ReturnTypeEnum.Table @@ -70,7 +95,7 @@ Partial Public Class SearchLoader End Select End Function - Public Function GetDataType(pTypeString As String) As DataTypeEnum + Private Function GetDataType(pTypeString As String) As DataTypeEnum Select Case pTypeString Case "BIT" Return DataTypeEnum.Boolean @@ -85,27 +110,6 @@ Partial Public Class SearchLoader End Select End Function - Public Sub LoadSearchParameters() - Dim oSQL As String = $"SELECT * FROM TBMON_PROFILE_PARAM WHERE ACTIVE = 1 ORDER BY SEQUENCE" - Dim oTable As DataTable = Database.GetDatatable(oSQL) - Dim oParameters As New List(Of SearchParameter) - For Each oRow As DataRow In oTable.Rows - oParameters.Add(New SearchParameter With { - .Id = oRow.ItemEx("GUID", 0), - .Title = oRow.ItemEx("CAPTION", String.Empty), - .Description = oRow.ItemEx("DESCRIPTION", String.Empty), - .DataType = GetDataType(oRow.ItemEx("DATA_TYPE", "VARCHAR")), - .ItemString = oRow.ItemEx("ITEMS", String.Empty), - .ItemType = GetItemType(oRow.ItemEx("ITEM_TYPE", String.Empty)), - .Required = oRow.ItemEx("REQUIRED", True), - .PatternTitle = oRow.ItemEx("PATTERN", String.Empty), - .SearchId = oRow.ItemEx("PROFILE_ID", 0), - .DefaultValue = oRow.ItemEx("DEFAULT_VALUE", String.Empty) - }) - Next - - Parameters = oParameters - End Sub End Class diff --git a/GUIs.Monitor/SearchParameter.vb b/GUIs.Monitor/SearchParameter.vb index 6a560c6..154dd09 100644 --- a/GUIs.Monitor/SearchParameter.vb +++ b/GUIs.Monitor/SearchParameter.vb @@ -9,6 +9,7 @@ Public Required As Boolean Public SearchId As Integer Public DefaultValue As String + Public Sequence As Integer Public ReadOnly Property HasItems As Boolean Get diff --git a/GUIs.Monitor/Validator.vb b/GUIs.Monitor/Validator.vb new file mode 100644 index 0000000..4ec1dc4 --- /dev/null +++ b/GUIs.Monitor/Validator.vb @@ -0,0 +1,79 @@ +Imports DevExpress.Utils +Imports DevExpress.Utils.VisualEffects +Imports DevExpress.XtraLayout +Imports DigitalData.GUIs.Common +Imports DigitalData.Modules.Base +Imports DigitalData.Modules.Logging + +Public Class Validator + Inherits BaseClass + Public Sub New(pLogConfig As LogConfig, pLayoutControl As LayoutControl, pAdornerUIManager As AdornerUIManager, pControlHelper As ControlHelper) + MyBase.New(pLogConfig) + Me.LayoutControl = pLayoutControl + Me.AdornerUIManager = pAdornerUIManager + Me.ControlHelper = pControlHelper + End Sub + + Public ReadOnly Property LayoutControl As LayoutControl + Public ReadOnly Property AdornerUIManager As AdornerUIManager + Public ReadOnly Property ControlHelper As ControlHelper + + Public Function Validate(pSearch As Search) As Boolean + With AdornerUIManager.ValidationHintProperties + .State = ValidationHintState.Invalid + .InvalidState.ShowBorder = True + .InvalidState.ShowBackgroundMode = ValidationHintBackgroundMode.Target + End With + + AdornerUIManager.Hide() + AdornerUIManager.Elements.Clear() + + Dim oMissingParams As Boolean = False + Dim oControls As New List(Of Control) + + For Each oItem As Control In LayoutControl.Controls + + Dim oParam = pSearch.Parameters. + Where(Function(param) param.PatternTitle = oItem.Name). + FirstOrDefault() + + If oParam Is Nothing Then + Continue For + End If + + oControls.Add(oItem) + + If oParam.Required And Not ControlHelper.HasValue(oItem) Then + AdornerUIManager.Elements.Add(New ValidationHint With { + .TargetElement = oItem, + .Visible = True + }) + oMissingParams = True + End If + Next + + AdornerUIManager.Show() + + Return oMissingParams + End Function + + Public Function GetControlsWithParams(pSearch As Search) As List(Of Control) + Dim oControls As New List(Of Control) + + For Each oItem As Control In LayoutControl.Controls + + Dim oParam = pSearch.Parameters. + Where(Function(param) param.PatternTitle = oItem.Name). + FirstOrDefault() + + If oParam Is Nothing Then + Continue For + End If + + oControls.Add(oItem) + + Next + + Return oControls + End Function +End Class diff --git a/GUIs.Monitor/frmLoading.Designer.vb b/GUIs.Monitor/frmLoading.Designer.vb new file mode 100644 index 0000000..0b29209 --- /dev/null +++ b/GUIs.Monitor/frmLoading.Designer.vb @@ -0,0 +1,83 @@ + _ +Partial Class frmLoading + Inherits DevExpress.XtraWaitForm.WaitForm + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.progressPanel1 = New DevExpress.XtraWaitForm.ProgressPanel() + Me.tableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() + Me.tableLayoutPanel1.SuspendLayout() + Me.SuspendLayout() + ' + 'progressPanel1 + ' + Me.progressPanel1.Appearance.BackColor = System.Drawing.Color.Transparent + Me.progressPanel1.Appearance.Options.UseBackColor = True + Me.progressPanel1.AppearanceCaption.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!) + Me.progressPanel1.AppearanceCaption.Options.UseFont = True + Me.progressPanel1.AppearanceDescription.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.progressPanel1.AppearanceDescription.Options.UseFont = True + Me.progressPanel1.Dock = System.Windows.Forms.DockStyle.Fill + Me.progressPanel1.ImageHorzOffset = 20 + Me.progressPanel1.Location = New System.Drawing.Point(0, 17) + Me.progressPanel1.Margin = New System.Windows.Forms.Padding(0, 3, 0, 3) + Me.progressPanel1.Name = "progressPanel1" + Me.progressPanel1.Size = New System.Drawing.Size(246, 39) + Me.progressPanel1.TabIndex = 0 + Me.progressPanel1.Text = "progressPanel1" + ' + 'tableLayoutPanel1 + ' + Me.tableLayoutPanel1.AutoSize = True + Me.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.tableLayoutPanel1.BackColor = System.Drawing.Color.Transparent + Me.tableLayoutPanel1.ColumnCount = 1 + Me.tableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) + Me.tableLayoutPanel1.Controls.Add(Me.progressPanel1, 0, 0) + Me.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill + Me.tableLayoutPanel1.Location = New System.Drawing.Point(0, 0) + Me.tableLayoutPanel1.Name = "tableLayoutPanel1" + Me.tableLayoutPanel1.Padding = New System.Windows.Forms.Padding(0, 14, 0, 14) + Me.tableLayoutPanel1.RowCount = 1 + Me.tableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) + Me.tableLayoutPanel1.Size = New System.Drawing.Size(246, 73) + Me.tableLayoutPanel1.TabIndex = 1 + ' + 'Form1 + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.AutoSize = True + Me.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ClientSize = New System.Drawing.Size(246, 73) + Me.Controls.Add(Me.tableLayoutPanel1) + Me.DoubleBuffered = True + Me.Name = "Form1" + Me.StartPosition = FormStartPosition.Manual + Me.Text = "Form1" + Me.tableLayoutPanel1.ResumeLayout(false) + Me.ResumeLayout(False) + Me.PerformLayout() + End Sub + + Private WithEvents progressPanel1 As DevExpress.XtraWaitForm.ProgressPanel + Private WithEvents tableLayoutPanel1 As System.Windows.Forms.TableLayoutPanel +End Class diff --git a/GUIs.Monitor/frmLoading.resx b/GUIs.Monitor/frmLoading.resx new file mode 100644 index 0000000..9d1fc38 --- /dev/null +++ b/GUIs.Monitor/frmLoading.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/GUIs.Monitor/frmLoading.vb b/GUIs.Monitor/frmLoading.vb new file mode 100644 index 0000000..7bfbd6d --- /dev/null +++ b/GUIs.Monitor/frmLoading.vb @@ -0,0 +1,24 @@ +Public Class frmLoading + Sub New + InitializeComponent() + Me.progressPanel1.AutoHeight = True + End Sub + + Public Overrides Sub SetCaption(ByVal caption As String) + MyBase.SetCaption(caption) + Me.progressPanel1.Caption = caption + End Sub + + Public Overrides Sub SetDescription(ByVal description As String) + MyBase.SetDescription(description) + Me.progressPanel1.Description = description + End Sub + + Public Overrides Sub ProcessCommand(ByVal cmd As System.Enum, ByVal arg As Object) + MyBase.ProcessCommand(cmd, arg) + End Sub + + Public Enum WaitFormCommand + SomeCommandId + End Enum +End Class diff --git a/GUIs.Monitor/frmMonitor.Designer.vb b/GUIs.Monitor/frmMonitor.Designer.vb index 8bacaa3..c2060be 100644 --- a/GUIs.Monitor/frmMonitor.Designer.vb +++ b/GUIs.Monitor/frmMonitor.Designer.vb @@ -34,6 +34,7 @@ Partial Class frmMonitor Me.lbResultCount = New DevExpress.XtraBars.BarStaticItem() Me.btnReloadSearches = New DevExpress.XtraBars.BarButtonItem() Me.btnResetLayout = New DevExpress.XtraBars.BarButtonItem() + Me.BarButtonItem2 = New DevExpress.XtraBars.BarButtonItem() Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage() Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RibbonPageGroup3 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() @@ -80,6 +81,7 @@ Partial Class frmMonitor Me.XtraSaveFileDialog1 = New DevExpress.XtraEditors.XtraSaveFileDialog(Me.components) Me.AdornerUIManager2 = New DevExpress.Utils.VisualEffects.AdornerUIManager(Me.components) Me.WorkspaceManager1 = New DevExpress.Utils.WorkspaceManager(Me.components) + Me.SplashScreenManager1 = New DevExpress.XtraSplashScreen.SplashScreenManager(Me, GetType(Global.DigitalData.GUIs.Monitor.frmLoading), True, True) CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.ApplicationMenu1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.XtraTabControlFileHTML, System.ComponentModel.ISupportInitialize).BeginInit() @@ -139,9 +141,9 @@ Partial Class frmMonitor ' Me.RibbonControl1.ApplicationButtonDropDownControl = Me.ApplicationMenu1 Me.RibbonControl1.ExpandCollapseItem.Id = 0 - Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.buttonSearch, Me.BarButtonItem1, Me.btnExportDetails, Me.btnExportMain, Me.lbResultCount, Me.btnReloadSearches, Me.btnResetLayout}) + Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.buttonSearch, Me.BarButtonItem1, Me.btnExportDetails, Me.btnExportMain, Me.lbResultCount, Me.btnReloadSearches, Me.btnResetLayout, Me.BarButtonItem2}) Me.RibbonControl1.Location = New System.Drawing.Point(0, 0) - Me.RibbonControl1.MaxItemId = 9 + Me.RibbonControl1.MaxItemId = 10 Me.RibbonControl1.Name = "RibbonControl1" Me.RibbonControl1.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1}) Me.RibbonControl1.ShowToolbarCustomizeItem = False @@ -172,7 +174,7 @@ Partial Class frmMonitor ' 'btnExportDetails ' - Me.btnExportDetails.Caption = "SQL Ansicht exportieren" + Me.btnExportDetails.Caption = "Export SQL Ansicht" Me.btnExportDetails.Enabled = False Me.btnExportDetails.Id = 4 Me.btnExportDetails.ImageOptions.SvgImage = Global.DigitalData.GUIs.Monitor.My.Resources.Resources.exporttoxlsx1 @@ -180,7 +182,7 @@ Partial Class frmMonitor ' 'btnExportMain ' - Me.btnExportMain.Caption = "Hauptansicht exportieren" + Me.btnExportMain.Caption = "Export Übersicht" Me.btnExportMain.Enabled = False Me.btnExportMain.Id = 5 Me.btnExportMain.ImageOptions.SvgImage = Global.DigitalData.GUIs.Monitor.My.Resources.Resources.exporttoxlsx @@ -198,7 +200,7 @@ Partial Class frmMonitor ' 'btnReloadSearches ' - Me.btnReloadSearches.Caption = "Suchen neuladen" + Me.btnReloadSearches.Caption = "Suchen neu laden" Me.btnReloadSearches.Id = 7 Me.btnReloadSearches.ImageOptions.SvgImage = Global.DigitalData.GUIs.Monitor.My.Resources.Resources.actions_reload Me.btnReloadSearches.Name = "btnReloadSearches" @@ -210,6 +212,13 @@ Partial Class frmMonitor Me.btnResetLayout.ImageOptions.SvgImage = Global.DigitalData.GUIs.Monitor.My.Resources.Resources.deletetable Me.btnResetLayout.Name = "btnResetLayout" ' + 'BarButtonItem2 + ' + Me.BarButtonItem2.Caption = "Layout speichern" + Me.BarButtonItem2.Id = 9 + Me.BarButtonItem2.ImageOptions.SvgImage = Global.DigitalData.GUIs.Monitor.My.Resources.Resources.movepivottable + Me.BarButtonItem2.Name = "BarButtonItem2" + ' 'RibbonPage1 ' Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroup3, Me.RibbonPageGroup2}) @@ -226,6 +235,7 @@ Partial Class frmMonitor 'RibbonPageGroup3 ' Me.RibbonPageGroup3.Alignment = DevExpress.XtraBars.Ribbon.RibbonPageGroupAlignment.Far + Me.RibbonPageGroup3.ItemLinks.Add(Me.BarButtonItem2) Me.RibbonPageGroup3.ItemLinks.Add(Me.btnResetLayout) Me.RibbonPageGroup3.Name = "RibbonPageGroup3" Me.RibbonPageGroup3.Text = "Layout" @@ -634,6 +644,10 @@ Partial Class frmMonitor Me.WorkspaceManager1.TargetControl = Me Me.WorkspaceManager1.TransitionType = PushTransition1 ' + 'SplashScreenManager1 + ' + Me.SplashScreenManager1.ClosingDelay = 500 + ' 'frmMonitor ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -762,4 +776,6 @@ Partial Class frmMonitor Friend WithEvents Root As DevExpress.XtraLayout.LayoutControlGroup Friend WithEvents lbParams As DevExpress.XtraLayout.SimpleLabelItem Friend WithEvents EmptySpaceItem1 As DevExpress.XtraLayout.EmptySpaceItem + Friend WithEvents SplashScreenManager1 As DevExpress.XtraSplashScreen.SplashScreenManager + Friend WithEvents BarButtonItem2 As DevExpress.XtraBars.BarButtonItem End Class diff --git a/GUIs.Monitor/frmMonitor.resx b/GUIs.Monitor/frmMonitor.resx index 2e58f63..7a8a48b 100644 --- a/GUIs.Monitor/frmMonitor.resx +++ b/GUIs.Monitor/frmMonitor.resx @@ -118,7 +118,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 183, 17 + 362, 17 @@ -146,15 +146,15 @@ - 17, 17 + 196, 17 - 335, 17 + 514, 17 - 494, 17 + 673, 17 - 657, 17 + 836, 17 \ No newline at end of file diff --git a/GUIs.Monitor/frmMonitor.vb b/GUIs.Monitor/frmMonitor.vb index e747445..6553230 100644 --- a/GUIs.Monitor/frmMonitor.vb +++ b/GUIs.Monitor/frmMonitor.vb @@ -50,34 +50,10 @@ Public Class frmMonitor Private GridControlResults As GridControl Private GridViewResults As GridView - Private Const STATE_SUCCESS As String = "SUCCESS" - Private Const STATE_FAILURE As String = "FAILURE" - Private Const STATE_WARNING As String = "WARNING" - Private Const STATE_WAITING As String = "WAITING" - Private Const STATE_HIGHLIGHT As String = "HIGHLIGHT" - Private MarkedColumns As New List(Of GridColumn) Private ActiveSearch As Search = Nothing - Private LastSearch As Search = Nothing - Private LastLoadedSearch As Search = Nothing - - Private Enum NodeImage - [Default] = 0 - SQL = 1 - File = 2 - Mail = 3 - Success = 4 - Failure = 5 - Warning = 6 - Waiting = 7 - User = 8 - Highlight = 9 - End Enum - - Private ReadOnly StateIcons As New Dictionary(Of String, NodeImage) From { - {STATE_SUCCESS, NodeImage.Success}, - {STATE_FAILURE, NodeImage.Failure} - } + 'Private LastSearch As Search = Nothing + 'Private LastLoadedSearch As Search = Nothing Private GridBuilder As GridBuilder Private ControlHelper As Common.ControlHelper @@ -90,13 +66,15 @@ Public Class frmMonitor Private FormHelper As FormHelper Private Patterns As Patterns2 Private Workspace As Common.DocumentResultList.Workspace(Of Config) + Private Validator As Validator + Private GridLoader As GridLoader Private Sub frmStart_Load(sender As Object, e As EventArgs) Handles MyBase.Load Try LogConfig = New LogConfig(LogConfig.PathType.AppData, Nothing, Nothing, "Digital Data", "Monitor") Logger = LogConfig.GetLogger() - ConfigManager = New ConfigManager(Of Config)(LogConfig, Application.UserAppDataPath, Application.UserAppDataPath, Application.StartupPath) + ConfigManager = New ConfigManager(Of Config)(LogConfig, Application.UserAppDataPath, Application.CommonAppDataPath, Application.StartupPath) Patterns = New Patterns2(LogConfig) FormHelper = New FormHelper(LogConfig, Me) ControlHelper = New Common.ControlHelper(LogConfig) @@ -128,6 +106,8 @@ Public Class frmMonitor SearchLoader = New SearchLoader(LogConfig, ConfigManager.Config, Database) ParamLoader = New ParameterLoader(LogConfig, Database, LayoutControl1) GridBuilder = New GridBuilder() + Validator = New Validator(LogConfig, LayoutControl1, AdornerUIManager2, ControlHelper) + GridLoader = New GridLoader(LogConfig, SvgImageCollection1) InitGrid() InitTreeList() @@ -146,7 +126,6 @@ Public Class frmMonitor HtmlResultViewers = New List(Of RichEditControl) From {RichEditControl1, RichEditControl2} HtmlResultTabs = New List(Of XtraTabPage) From {XtraTabPageHtml1, XtraTabPageHtml2} - SearchLoader.LoadSearchParameters() LoadSearches() @@ -183,12 +162,14 @@ Public Class frmMonitor Return Database.GetScalarValue(oSQL) End Function - Private Sub buttonSearch_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles buttonSearch.ItemClick - LoadData() + Private Async Sub buttonSearch_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles buttonSearch.ItemClick + Await LoadData() End Sub - Private Function LoadData() As Boolean + Private Async Function LoadData() As Threading.Tasks.Task(Of Boolean) Try + SplashScreenManager1.ShowWaitForm() + TreeListResults.DataSource = Nothing GridControlResults.DataSource = Nothing @@ -197,57 +178,24 @@ Public Class frmMonitor End If Dim oSearch As Search = cmbSearches.EditValue - Dim oMissingParams = False - If LastLoadedSearch IsNot Nothing AndAlso oSearch.Id = LastLoadedSearch.Id Then - Workspace.SaveWorkspace(oSearch.Id.ToString) - End If + 'If LastLoadedSearch IsNot Nothing AndAlso oSearch.Id = LastLoadedSearch.Id Then + ' Workspace.SaveWorkspace(oSearch.Id.ToString) + 'End If MarkedColumns.Clear() HideAllTabs() - With AdornerUIManager2.ValidationHintProperties - .State = VisualEffects.ValidationHintState.Invalid - .InvalidState.ShowBorder = True - .InvalidState.ShowBackgroundMode = VisualEffects.ValidationHintBackgroundMode.Target - End With - - AdornerUIManager2.Hide() - AdornerUIManager2.Elements.Clear() - - Dim oSQL As String = oSearch.SQLCommand - Dim oControls As New List(Of Control) - For Each oItem As Control In LayoutControl1.Controls - - Dim oParam = oSearch.Parameters. - Where(Function(param) param.PatternTitle = oItem.Name). - FirstOrDefault() - - If oParam Is Nothing Then - Continue For - End If - - oControls.Add(oItem) - - If oParam.Required And Not ControlHelper.HasValue(oItem) Then - AdornerUIManager2.Elements.Add(New VisualEffects.ValidationHint With { - .TargetElement = oItem, - .Visible = True - }) - oMissingParams = True - End If - - Next - - AdornerUIManager2.Show() + Dim oMissingParams = Validator.Validate(oSearch) If oMissingParams = True Then Return False End If - oSQL = Patterns.ReplaceControlValues(oSQL, oControls) - Dim oTable As DataTable = Database.GetDatatable(oSQL) + Dim oControls As List(Of Control) = LayoutControl1.Controls.Cast(Of Control).ToList() + Dim oSQL = Patterns.ReplaceControlValues(oSearch.SQLCommand, oControls) + Dim oTable As DataTable = Await Database.GetDatatableAsync(oSQL) If oSearch.ReturnType = Constants.ReturnTypeEnum.TreeView Then GridControlResults.Visible = False @@ -267,7 +215,7 @@ Public Class frmMonitor End If Next - InitTreeListColumns(oMaxLength) + GridLoader.InitTreeListColumns(TreeListResults, oMaxLength) ' Show all columns in DisplayColumns List For Each oColumn In TreeListResults.Columns @@ -283,7 +231,7 @@ Public Class frmMonitor ExpandNodes(oNode, Function(n) Dim oObjectValue = n.GetValue(oStateColumn) Dim oValue As String = NotNull(oObjectValue.ToString, String.Empty) - Return oValue IsNot Nothing AndAlso (oValue = STATE_WARNING Or oValue = STATE_FAILURE) + Return oValue IsNot Nothing AndAlso (oValue = State.STATE_WARNING Or oValue = State.STATE_FAILURE) End Function) Next @@ -299,6 +247,12 @@ Public Class frmMonitor GridViewResults.PopulateColumns() GridBuilder.SetDateTimeColumns(GridViewResults) + For Each oColumn As GridColumn In GridViewResults.Columns + If oColumn.ColumnType = GetType(Integer) Then + oColumn.AppearanceCell.TextOptions.HAlignment = HorzAlignment.Center + End If + Next + MarkedColumns = GridViewResults.Columns.AsEnumerable. Where(Function(column) Dim oCaption = column.FieldName.ToUpper.Trim @@ -315,7 +269,7 @@ Public Class frmMonitor GridViewResults.FocusInvalidRow() Workspace.LoadWorkspace(oSearch.Id.ToString) - LastLoadedSearch = oSearch + 'LastLoadedSearch = oSearch btnExportMain.Enabled = True @@ -323,11 +277,14 @@ Public Class frmMonitor Catch ex As Exception FormHelper.ShowErrorMessage(ex, "LoadData") Return False + Finally + SplashScreenManager1.CloseWaitForm() End Try End Function Private Sub LoadSearches() Try + SearchLoader.LoadSearchParameters() SearchLoader.LoadSearches() cmbSearches.Properties.Items.Clear() @@ -348,79 +305,9 @@ Public Class frmMonitor - Private Sub InitTreeListColumns(pMaxLength As Integer) - Dim oColumn1 = TreeListResults.Columns.Item("COLUMN1") - Dim oColumn2 = TreeListResults.Columns.Item("COLUMN2") - Dim oColumn3 = TreeListResults.Columns.Item("COLUMN3") - Dim oAddedWhenColumn = TreeListResults.Columns.Item("ADDED_WHEN") - Dim oStateColumn = TreeListResults.Columns.Item("STATE") - Dim oIconColumn = TreeListResults.Columns.Item("ICON") - - Dim oStateEdit As RepositoryItemImageComboBox = GetStateEdit() - Dim oIconEdit As RepositoryItemImageComboBox = GetIconEdit() - - oColumn1.VisibleIndex = 0 - oStateColumn.VisibleIndex = 1 - oIconColumn.VisibleIndex = 2 - - Dim oColumnLength = pMaxLength * 5 - With oColumn1 - .Caption = "Titel" - .MinWidth = oColumnLength - .MaxWidth = oColumnLength - .Width = oColumnLength - .OptionsColumn.AllowSize = False - .OptionsColumn.AllowSort = False - End With - - With oColumn2 - .Caption = "Wert 1" - End With - - With oColumn3 - .Caption = "Wert 2" - End With - - With oAddedWhenColumn - .Caption = "Datum" - End With - - With oStateColumn - .ColumnEdit = oStateEdit - .MaxWidth = 25 - .MinWidth = 25 - .Width = 25 - .Caption = " " - .OptionsColumn.AllowSize = False - .OptionsColumn.AllowSort = False - .ImageOptions.Image = SvgImageCollection1.GetImage(NodeImage.Success) - End With - - With oIconColumn - .ColumnEdit = oIconEdit - .MaxWidth = 25 - .MinWidth = 25 - .Width = 25 - .Caption = " " - .OptionsColumn.AllowSize = False - .OptionsColumn.AllowSort = False - .ImageOptions.Image = SvgImageCollection1.GetImage(NodeImage.SQL) - End With - End Sub - Private Function GetIconEdit() As RepositoryItemImageComboBox - Dim oIconEdit As New RepositoryItemImageComboBox With { - .SmallImages = SvgImageCollection1, - .GlyphAlignment = HorzAlignment.Near - } - oIconEdit.Buttons.Clear() - oIconEdit.Items.AddRange(New List(Of ImageComboBoxItem) From { - New ImageComboBoxItem("Email", "MAIL", NodeImage.Mail), - New ImageComboBoxItem("SQL", "SQL", NodeImage.SQL), - New ImageComboBoxItem("File", "FILE", NodeImage.File) - }) - Return oIconEdit - End Function + + Private Sub cmbSearches_SelectedValueChanged(sender As Object, e As EventArgs) Handles cmbSearches.SelectedValueChanged DisposeTreeList() @@ -449,11 +336,11 @@ Public Class frmMonitor Dim oSearch As Search = CType(cmbSearches.SelectedItem, Search) - If ActiveSearch IsNot Nothing Then - Workspace.SaveWorkspace(ActiveSearch.Id.ToString) - End If + 'If ActiveSearch IsNot Nothing Then + ' Workspace.SaveWorkspace(ActiveSearch.Id.ToString) + 'End If - LastSearch = ActiveSearch + 'LastSearch = ActiveSearch ActiveSearch = oSearch AdornerUIManager2.Hide() @@ -701,13 +588,13 @@ Public Class frmMonitor Dim oColor As Color = Nothing Select Case oState.ToString - Case STATE_SUCCESS + Case State.STATE_SUCCESS oColor = Color.LightGreen - Case STATE_FAILURE + Case State.STATE_FAILURE oColor = Color.LightCoral - Case STATE_WARNING + Case State.STATE_WARNING oColor = Color.Yellow - Case STATE_WAITING + Case State.STATE_WAITING oColor = Color.LightSkyBlue End Select @@ -762,16 +649,15 @@ Public Class frmMonitor End If End Sub - Private Sub frmMonitor_KeyUp(sender As Object, e As KeyEventArgs) Handles Me.KeyUp + Private Async Sub frmMonitor_KeyUp(sender As Object, e As KeyEventArgs) Handles Me.KeyUp If e.KeyCode = Keys.F5 Then Debug.Write("Debug.Write") Console.WriteLine("Console.WriteLine") Debug.Print("Debug.Print") - LoadData() + Await LoadData() End If End Sub - Private Sub TreeListResults_MouseClick(sender As Object, e As MouseEventArgs) Dim oInfo As TreeListHitInfo = TreeListResults.CalcHitInfo(New Point(e.X, e.Y)) @@ -813,7 +699,7 @@ Public Class frmMonitor End Sub Private Sub BarButtonItem4_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnReloadSearches.ItemClick - SearchLoader.LoadSearchParameters() + LoadSearches() TreeListResults.DataSource = Nothing @@ -913,17 +799,17 @@ Public Class frmMonitor SplitContainerFileHTML.Collapsed = True End Sub - Private Sub frmMonitor_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing - If ActiveSearch IsNot Nothing Then - Workspace.SaveWorkspace(ActiveSearch.Id.ToString) - End If - End Sub + 'Private Sub frmMonitor_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing + ' If ActiveSearch IsNot Nothing Then + ' Workspace.SaveWorkspace(ActiveSearch.Id.ToString) + ' End If + 'End Sub Private Sub btnResetLayout_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnResetLayout.ItemClick If ActiveSearch IsNot Nothing Then Workspace.ResetWorkspace(ActiveSearch.Id.ToString) - LastLoadedSearch = Nothing - ActiveSearch = Nothing + 'LastLoadedSearch = Nothing + 'ActiveSearch = Nothing DisposeTreeList() InitTreeList() @@ -931,9 +817,11 @@ Public Class frmMonitor DisposeGrid() InitGrid() - LoadSearch() + 'LoadSearch() HideAllTabs() + LoadData() + lbResultCount.Caption = String.Format(lbResultCount.Tag, 0) End If End Sub @@ -946,19 +834,12 @@ Public Class frmMonitor End Sub Private Sub InitGrid() - GridControlResults = New GridControl() With { - .Name = "GridViewResults", - .Visible = False - } - SplitContainerSQL.Panel1.Controls.Add(GridControlResults) - GridControlResults.ForceInitialize() + GridControlResults = GridLoader.InitGrid() GridViewResults = DirectCast(GridControlResults.DefaultView, GridView) AddHandler GridViewResults.FocusedRowChanged, AddressOf GridViewResults_FocusedRowChanged - GridBuilder.SetDefaults(GridViewResults) - GridBuilder.SetClipboardHandler(GridViewResults) - GridBuilder.SetReadOnlyOptions(GridViewResults) + SplitContainerSQL.Panel1.Controls.Add(GridControlResults) End Sub Private Sub DisposeTreeList() @@ -967,51 +848,21 @@ Public Class frmMonitor End Sub Private Sub InitTreeList() - TreeListResults = New TreeList() With { - .Name = "TreeListResults", - .Visible = False - } - SplitContainerSQL.Panel1.Controls.Add(TreeListResults) - TreeListResults.ForceInitialize() - - TreeListResults.KeyFieldName = "GUID" - TreeListResults.ParentFieldName = "PARENT_ID" + TreeListResults = GridLoader.InitTreeList() AddHandler TreeListResults.FocusedNodeChanged, AddressOf TreeListResults_FocusedNodeChanged AddHandler TreeListResults.MouseClick, AddressOf TreeListResults_MouseClick AddHandler TreeListResults.CustomDrawNodeCell, AddressOf TreeListResults_CustomDrawNodeCell - GridBuilder.SetDefaults(TreeListResults) - GridBuilder.SetClipboardHandler(TreeListResults) - GridBuilder.SetReadOnlyOptions(TreeListResults) + SplitContainerSQL.Panel1.Controls.Add(TreeListResults) End Sub - 'Private DisallowedComponentNames As New List(Of String) From {"LayoutControlItem", "LayoutControlGroup", "LayoutControl"} - - 'Private Sub WorkspaceManager1_PropertyDeserializing(sender As Object, ea As PropertyCancelEventArgs) Handles WorkspaceManager1.PropertyDeserializing, WorkspaceManager1.PropertySerializing - ' Dim oName = ea.Component?.GetType.Name - ' If DisallowedComponentNames.Contains(oName) Then - ' ea.Cancel = True - ' End If - 'End Sub + Private Sub BarButtonItem2_ItemClick_1(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick + If ActiveSearch Is Nothing Then + Exit Sub + End If - Private Function GetStateEdit() As RepositoryItemImageComboBox - Dim oStateEdit As New RepositoryItemImageComboBox With { - .SmallImages = SvgImageCollection1, - .GlyphAlignment = HorzAlignment.Near - } - oStateEdit.Buttons.Clear() - oStateEdit.Items.AddRange(New List(Of ImageComboBoxItem) From { - New ImageComboBoxItem("Success", "SUCCESS", NodeImage.Success), - New ImageComboBoxItem("Failure", "FAILURE", NodeImage.Failure), - New ImageComboBoxItem("Warning", "WARNING", NodeImage.Warning), - New ImageComboBoxItem("Waiting", "WAITING", NodeImage.Waiting), - New ImageComboBoxItem("Default", "DEFAULT", NodeImage.Default), - New ImageComboBoxItem("User", "USER", NodeImage.User), - New ImageComboBoxItem("Highlight", "HIGHLIGHT", NodeImage.Highlight) - }) - - Return oStateEdit - End Function + Workspace.SaveWorkspace(ActiveSearch.Id.ToString) + End Sub End Class