From a97c3b8f4194e85973e034d1ef0bbd3a2141ed14 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Wed, 22 Sep 2021 13:50:08 +0200 Subject: [PATCH] Fix profile changing when refreshing, fix crash when clicking on "new x" twice in a row --- Global_Indexer/frmAdministration.Designer.vb | 84 ++++++++++---------- Global_Indexer/frmAdministration.resx | 24 +++--- Global_Indexer/frmAdministration.vb | 58 +++++++++----- Global_Indexer/frmIndex.vb | 2 +- 4 files changed, 95 insertions(+), 73 deletions(-) diff --git a/Global_Indexer/frmAdministration.Designer.vb b/Global_Indexer/frmAdministration.Designer.vb index f8a8c34..3a375dd 100644 --- a/Global_Indexer/frmAdministration.Designer.vb +++ b/Global_Indexer/frmAdministration.Designer.vb @@ -139,10 +139,10 @@ Partial Class frmAdministration Me.GridColumn8 = New DevExpress.XtraGrid.Columns.GridColumn() Me.Label35 = New System.Windows.Forms.Label() Me.SplitContainerControl4 = New DevExpress.XtraEditors.SplitContainerControl() - Me.GridControl1 = New DevExpress.XtraGrid.GridControl() + Me.GridControlProfile = New DevExpress.XtraGrid.GridControl() Me.TBDD_DOKUMENTARTBindingSource = New System.Windows.Forms.BindingSource(Me.components) Me.MyDataset = New Global_Indexer.MyDataset() - Me.GridView1 = New DevExpress.XtraGrid.Views.Grid.GridView() + Me.GridViewProfile = New DevExpress.XtraGrid.Views.Grid.GridView() Me.colAKTIV = New DevExpress.XtraGrid.Columns.GridColumn() Me.colBEZEICHNUNG = New DevExpress.XtraGrid.Columns.GridColumn() Me.Label3 = New System.Windows.Forms.Label() @@ -371,10 +371,10 @@ Partial Class frmAdministration CType(Me.viewAvailableUsers, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.SplitContainerControl4, System.ComponentModel.ISupportInitialize).BeginInit() Me.SplitContainerControl4.SuspendLayout() - CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.GridControlProfile, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.TBDD_DOKUMENTARTBindingSource, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.MyDataset, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.GridView1, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.GridViewProfile, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.XtraTabControl1, System.ComponentModel.ISupportInitialize).BeginInit() Me.XtraTabControl1.SuspendLayout() Me.XtraTabPageProfiles.SuspendLayout() @@ -974,28 +974,28 @@ Partial Class frmAdministration ' resources.ApplyResources(Me.SplitContainerControl4, "SplitContainerControl4") Me.SplitContainerControl4.Name = "SplitContainerControl4" - Me.SplitContainerControl4.Panel1.Controls.Add(Me.GridControl1) + Me.SplitContainerControl4.Panel1.Controls.Add(Me.GridControlProfile) Me.SplitContainerControl4.Panel1.Controls.Add(Me.Label3) resources.ApplyResources(Me.SplitContainerControl4.Panel1, "SplitContainerControl4.Panel1") Me.SplitContainerControl4.Panel2.Controls.Add(Me.XtraTabControl1) resources.ApplyResources(Me.SplitContainerControl4.Panel2, "SplitContainerControl4.Panel2") Me.SplitContainerControl4.SplitterPosition = 224 ' - 'GridControl1 - ' - Me.GridControl1.CausesValidation = False - Me.GridControl1.DataSource = Me.TBDD_DOKUMENTARTBindingSource - resources.ApplyResources(Me.GridControl1, "GridControl1") - Me.GridControl1.EmbeddedNavigator.AllowHtmlTextInToolTip = CType(resources.GetObject("GridControl1.EmbeddedNavigator.AllowHtmlTextInToolTip"), DevExpress.Utils.DefaultBoolean) - Me.GridControl1.EmbeddedNavigator.Anchor = CType(resources.GetObject("GridControl1.EmbeddedNavigator.Anchor"), System.Windows.Forms.AnchorStyles) - Me.GridControl1.EmbeddedNavigator.BackgroundImageLayout = CType(resources.GetObject("GridControl1.EmbeddedNavigator.BackgroundImageLayout"), System.Windows.Forms.ImageLayout) - Me.GridControl1.EmbeddedNavigator.ImeMode = CType(resources.GetObject("GridControl1.EmbeddedNavigator.ImeMode"), System.Windows.Forms.ImeMode) - Me.GridControl1.EmbeddedNavigator.TextLocation = CType(resources.GetObject("GridControl1.EmbeddedNavigator.TextLocation"), DevExpress.XtraEditors.NavigatorButtonsTextLocation) - Me.GridControl1.EmbeddedNavigator.ToolTipIconType = CType(resources.GetObject("GridControl1.EmbeddedNavigator.ToolTipIconType"), DevExpress.Utils.ToolTipIconType) - Me.GridControl1.MainView = Me.GridView1 - Me.GridControl1.Name = "GridControl1" - Me.GridControl1.ShowOnlyPredefinedDetails = True - Me.GridControl1.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridView1}) + 'GridControlProfile + ' + Me.GridControlProfile.CausesValidation = False + Me.GridControlProfile.DataSource = Me.TBDD_DOKUMENTARTBindingSource + resources.ApplyResources(Me.GridControlProfile, "GridControlProfile") + Me.GridControlProfile.EmbeddedNavigator.AllowHtmlTextInToolTip = CType(resources.GetObject("GridControl1.EmbeddedNavigator.AllowHtmlTextInToolTip"), DevExpress.Utils.DefaultBoolean) + Me.GridControlProfile.EmbeddedNavigator.Anchor = CType(resources.GetObject("GridControl1.EmbeddedNavigator.Anchor"), System.Windows.Forms.AnchorStyles) + Me.GridControlProfile.EmbeddedNavigator.BackgroundImageLayout = CType(resources.GetObject("GridControl1.EmbeddedNavigator.BackgroundImageLayout"), System.Windows.Forms.ImageLayout) + Me.GridControlProfile.EmbeddedNavigator.ImeMode = CType(resources.GetObject("GridControl1.EmbeddedNavigator.ImeMode"), System.Windows.Forms.ImeMode) + Me.GridControlProfile.EmbeddedNavigator.TextLocation = CType(resources.GetObject("GridControl1.EmbeddedNavigator.TextLocation"), DevExpress.XtraEditors.NavigatorButtonsTextLocation) + Me.GridControlProfile.EmbeddedNavigator.ToolTipIconType = CType(resources.GetObject("GridControl1.EmbeddedNavigator.ToolTipIconType"), DevExpress.Utils.ToolTipIconType) + Me.GridControlProfile.MainView = Me.GridViewProfile + Me.GridControlProfile.Name = "GridControlProfile" + Me.GridControlProfile.ShowOnlyPredefinedDetails = True + Me.GridControlProfile.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridViewProfile}) ' 'TBDD_DOKUMENTARTBindingSource ' @@ -1007,24 +1007,24 @@ Partial Class frmAdministration Me.MyDataset.DataSetName = "MyDataset" Me.MyDataset.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema ' - 'GridView1 - ' - Me.GridView1.Appearance.EvenRow.BackColor = System.Drawing.Color.PaleTurquoise - Me.GridView1.Appearance.EvenRow.Options.UseBackColor = True - Me.GridView1.Appearance.FocusedRow.BackColor = System.Drawing.Color.Khaki - Me.GridView1.Appearance.FocusedRow.Options.UseBackColor = True - Me.GridView1.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.colAKTIV, Me.colBEZEICHNUNG}) - Me.GridView1.GridControl = Me.GridControl1 - Me.GridView1.Name = "GridView1" - Me.GridView1.OptionsBehavior.AllowAddRows = DevExpress.Utils.DefaultBoolean.[False] - Me.GridView1.OptionsBehavior.AllowDeleteRows = DevExpress.Utils.DefaultBoolean.[False] - Me.GridView1.OptionsBehavior.Editable = False - Me.GridView1.OptionsClipboard.CopyColumnHeaders = DevExpress.Utils.DefaultBoolean.[False] - Me.GridView1.OptionsSelection.EnableAppearanceFocusedCell = False - Me.GridView1.OptionsView.EnableAppearanceEvenRow = True - Me.GridView1.OptionsView.ShowAutoFilterRow = True - Me.GridView1.OptionsView.ShowColumnHeaders = False - Me.GridView1.OptionsView.ShowGroupPanel = False + 'GridViewProfile + ' + Me.GridViewProfile.Appearance.EvenRow.BackColor = System.Drawing.Color.PaleTurquoise + Me.GridViewProfile.Appearance.EvenRow.Options.UseBackColor = True + Me.GridViewProfile.Appearance.FocusedRow.BackColor = System.Drawing.Color.Khaki + Me.GridViewProfile.Appearance.FocusedRow.Options.UseBackColor = True + Me.GridViewProfile.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.colAKTIV, Me.colBEZEICHNUNG}) + Me.GridViewProfile.GridControl = Me.GridControlProfile + Me.GridViewProfile.Name = "GridViewProfile" + Me.GridViewProfile.OptionsBehavior.AllowAddRows = DevExpress.Utils.DefaultBoolean.[False] + Me.GridViewProfile.OptionsBehavior.AllowDeleteRows = DevExpress.Utils.DefaultBoolean.[False] + Me.GridViewProfile.OptionsBehavior.Editable = False + Me.GridViewProfile.OptionsClipboard.CopyColumnHeaders = DevExpress.Utils.DefaultBoolean.[False] + Me.GridViewProfile.OptionsSelection.EnableAppearanceFocusedCell = False + Me.GridViewProfile.OptionsView.EnableAppearanceEvenRow = True + Me.GridViewProfile.OptionsView.ShowAutoFilterRow = True + Me.GridViewProfile.OptionsView.ShowColumnHeaders = False + Me.GridViewProfile.OptionsView.ShowGroupPanel = False ' 'colAKTIV ' @@ -2493,10 +2493,10 @@ Partial Class frmAdministration CType(Me.viewAvailableUsers, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.SplitContainerControl4, System.ComponentModel.ISupportInitialize).EndInit() Me.SplitContainerControl4.ResumeLayout(False) - CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.GridControlProfile, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.TBDD_DOKUMENTARTBindingSource, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.MyDataset, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.GridViewProfile, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.XtraTabControl1, System.ComponentModel.ISupportInitialize).EndInit() Me.XtraTabControl1.ResumeLayout(False) Me.XtraTabPageProfiles.ResumeLayout(False) @@ -2660,8 +2660,8 @@ Partial Class frmAdministration Friend WithEvents VARIANTComboBox As System.Windows.Forms.ComboBox Friend WithEvents btnAddWindowsVariable As System.Windows.Forms.Button Friend WithEvents lblWDINDEX As System.Windows.Forms.Label - Friend WithEvents GridControl1 As DevExpress.XtraGrid.GridControl - Friend WithEvents GridView1 As DevExpress.XtraGrid.Views.Grid.GridView + Friend WithEvents GridControlProfile As DevExpress.XtraGrid.GridControl + Friend WithEvents GridViewProfile As DevExpress.XtraGrid.Views.Grid.GridView Friend WithEvents colBEZEICHNUNG As DevExpress.XtraGrid.Columns.GridColumn Friend WithEvents gridAssignedGroups As DevExpress.XtraGrid.GridControl Friend WithEvents viewAssignedGroups As DevExpress.XtraGrid.Views.Grid.GridView diff --git a/Global_Indexer/frmAdministration.resx b/Global_Indexer/frmAdministration.resx index b01a9c2..c15cb90 100644 --- a/Global_Indexer/frmAdministration.resx +++ b/Global_Indexer/frmAdministration.resx @@ -1267,7 +1267,7 @@ 17, 17 - + Fill @@ -1288,7 +1288,7 @@ Application - + 0, 30 @@ -1312,22 +1312,22 @@ 277 - + 224, 587 - + 93 - - GridControl1 + + GridControlProfile - + DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - + SplitContainerControl4.Panel1 - + 0 @@ -7081,10 +7081,10 @@ Die erhaltenen Werte können in Indizes geschrieben oder zur Benennung der Datei Global_Indexer.MyDataset, MyDataset.Designer.vb.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - - GridView1 + + GridViewProfile - + DevExpress.XtraGrid.Views.Grid.GridView, DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a diff --git a/Global_Indexer/frmAdministration.vb b/Global_Indexer/frmAdministration.vb index ab92455..c082065 100644 --- a/Global_Indexer/frmAdministration.vb +++ b/Global_Indexer/frmAdministration.vb @@ -106,7 +106,7 @@ Public Class frmAdministration Me.TBDD_DOKUMENTARTTableAdapter.FillByModuleGI(Me.MyDataset.TBDD_DOKUMENTART) If MyDataset.TBDD_DOKUMENTART.Rows.Count > 0 Then - GridView1.SelectRow(1) + GridViewProfile.SelectRow(1) EnableControls(XtraTabPageProfiles) End If If Me.DOKART_GUIDTextBox.Text <> "" Then @@ -757,7 +757,9 @@ Public Class frmAdministration End Sub Sub LoadGlobix_Doctypes() + Dim oFocusedRow = GridViewProfile.FocusedRowHandle Load_Dokart() + GridViewProfile.FocusedRowHandle = oFocusedRow End Sub Private Sub btncrFolder_delete_Click(sender As Object, e As EventArgs) Handles btncrFolder_delete.Click @@ -1069,11 +1071,15 @@ Public Class frmAdministration End Sub Private Sub BarButtonItem16_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem16.ItemClick - TBDD_INDEX_MANBindingSource.AddNew() + Try + TBDD_INDEX_MANBindingSource.AddNew() - If WINDREAM_DIRECTCheckBox.Checked = True Then - load_WDIndices() - End If + If WINDREAM_DIRECTCheckBox.Checked = True Then + load_WDIndices() + End If + Catch ex As Exception + LOGGER.Error(ex) + End Try End Sub Private Sub BarButtonItem17_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem17.ItemClick @@ -1108,12 +1114,18 @@ Public Class frmAdministration Private Sub BarButtonItem18_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem18.ItemClick If DOKART_GUIDTextBox.Text <> String.Empty Then + Dim oSelectedIndex = ListBoxControl3.SelectedIndex Load_INDEXMAN(DOKART_GUIDTextBox.Text) + ListBoxControl3.SelectedIndex = oSelectedIndex End If End Sub Private Sub BarButtonItem20_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem20.ItemClick - TBDD_INDEX_MAN_POSTPROCESSINGBindingSource.AddNew() + Try + TBDD_INDEX_MAN_POSTPROCESSINGBindingSource.AddNew() + Catch ex As Exception + LOGGER.Error(ex) + End Try End Sub Private Sub BarButtonItem21_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem21.ItemClick @@ -1144,15 +1156,21 @@ Public Class frmAdministration End Sub Private Sub BarButtonItem22_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem22.ItemClick + Dim oSelectedIndex = ListBox1.SelectedIndex Load_PostProcessing(Me.DOKART_GUIDTextBox.Text) + ListBox1.SelectedIndex = oSelectedIndex End Sub Private Sub BarButtonItem24_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem24.ItemClick - TBDD_INDEX_AUTOMBindingSource.AddNew() + Try + TBDD_INDEX_AUTOMBindingSource.AddNew() - If WINDREAM_DIRECTCheckBox.Checked = True Then - load_WDIndices() - End If + If WINDREAM_DIRECTCheckBox.Checked = True Then + load_WDIndices() + End If + Catch ex As Exception + LOGGER.Error(ex) + End Try End Sub Private Sub ToolStripButton17_Click(sender As Object, e As EventArgs) @@ -1181,7 +1199,9 @@ Public Class frmAdministration End Sub Private Sub BarButtonItem26_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem26.ItemClick + Dim oSelectedIndex = ListBoxControl4.SelectedIndex Load_INDEXE_AUTO(Me.DOKART_GUIDTextBox.Text) + ListBoxControl4.SelectedIndex = oSelectedIndex End Sub Private Sub BarButtonItem25_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem25.ItemClick @@ -1228,17 +1248,19 @@ Public Class frmAdministration End Sub Private Sub BarButtonItem28_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem28.ItemClick - TBGI_REGEX_DOCTYPEBindingSource.AddNew() - - - EnableControls(XtraTabPageProfileRegex) + Try + TBGI_REGEX_DOCTYPEBindingSource.AddNew() + EnableControls(XtraTabPageProfileRegex) + Catch ex As Exception + LOGGER.Error(ex) + End Try End Sub - Private Sub GridView1_ValidateRow(sender As Object, e As ValidateRowEventArgs) Handles GridView1.ValidateRow + Private Sub GridView1_ValidateRow(sender As Object, e As ValidateRowEventArgs) Handles GridViewProfile.ValidateRow e.Valid = True End Sub - Private Sub GridView1_InvalidRowException(sender As Object, e As InvalidRowExceptionEventArgs) Handles GridView1.InvalidRowException + Private Sub GridView1_InvalidRowException(sender As Object, e As InvalidRowExceptionEventArgs) Handles GridViewProfile.InvalidRowException e.ExceptionMode = DevExpress.XtraEditors.Controls.ExceptionMode.NoAction End Sub @@ -1316,8 +1338,8 @@ Public Class frmAdministration End If End Sub - Private Sub GridView1_BeforeLeaveRow(sender As Object, e As RowAllowEventArgs) Handles GridView1.BeforeLeaveRow - Dim oRowView As DataRowView = GridView1.GetRow(e.RowHandle) + Private Sub GridView1_BeforeLeaveRow(sender As Object, e As RowAllowEventArgs) Handles GridViewProfile.BeforeLeaveRow + Dim oRowView As DataRowView = GridViewProfile.GetRow(e.RowHandle) Dim oProfileName As String = oRowView?.Row.Item("BEZEICHNUNG") If oRowView Is Nothing Then diff --git a/Global_Indexer/frmIndex.vb b/Global_Indexer/frmIndex.vb index 56377f3..4f0b891 100644 --- a/Global_Indexer/frmIndex.vb +++ b/Global_Indexer/frmIndex.vb @@ -2788,7 +2788,7 @@ Public Class frmIndex Catch ex As Exception MsgBox("Uncaught error while indexing: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, Text) - ' Clear all temp files after indexing + ' Clear all temp files in case of an error Clear_Tempfiles() EMAIL.Clear_TempFiles() Finally