From fa3d81d448e761844a39cd5a45c34b29c539f315 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Mon, 26 Feb 2018 15:59:58 +0100 Subject: [PATCH] =?UTF-8?q?jj=20-=20Speichern=20des=20Layouts=20/=20CheckI?= =?UTF-8?q?nvalidColumns=20f=C3=BCr=20=C3=9Cbersicht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/DD_PM_WINDREAM/frmMain.Designer.vb | 160 +++++++++++++------------ app/DD_PM_WINDREAM/frmMain.resx | 2 +- app/DD_PM_WINDREAM/frmMain.vb | 108 ++++++++++------- 3 files changed, 152 insertions(+), 118 deletions(-) diff --git a/app/DD_PM_WINDREAM/frmMain.Designer.vb b/app/DD_PM_WINDREAM/frmMain.Designer.vb index 1212365..0716fa9 100644 --- a/app/DD_PM_WINDREAM/frmMain.Designer.vb +++ b/app/DD_PM_WINDREAM/frmMain.Designer.vb @@ -24,8 +24,8 @@ Partial Class frmMain Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmMain)) - Dim GridFormatRule2 As DevExpress.XtraGrid.GridFormatRule = New DevExpress.XtraGrid.GridFormatRule() - Dim FormatConditionRuleValue2 As DevExpress.XtraEditors.FormatConditionRuleValue = New DevExpress.XtraEditors.FormatConditionRuleValue() + Dim GridFormatRule1 As DevExpress.XtraGrid.GridFormatRule = New DevExpress.XtraGrid.GridFormatRule() + Dim FormatConditionRuleValue1 As DevExpress.XtraEditors.FormatConditionRuleValue = New DevExpress.XtraEditors.FormatConditionRuleValue() Me.ImageListProfile = New System.Windows.Forms.ImageList(Me.components) Me.DD_DMSLiteDataSet = New DD_PM_WINDREAM.DD_DMSLiteDataSet() Me.TBPM_PROFILEBindingSource = New System.Windows.Forms.BindingSource(Me.components) @@ -59,17 +59,6 @@ Partial Class frmMain Me.CMGroupStart = New System.Windows.Forms.ToolStripMenuItem() Me.CMFileStart = New System.Windows.Forms.ToolStripMenuItem() Me.GridViewProfile = New DevExpress.XtraGrid.Views.Grid.GridView() - Me.NotifyIcon1 = New System.Windows.Forms.NotifyIcon(Me.components) - Me.TimerRefresh = New System.Windows.Forms.Timer(Me.components) - Me.VWPM_PROFILE_USERBindingSource = New System.Windows.Forms.BindingSource(Me.components) - Me.VWPM_PROFILE_USERTableAdapter = New DD_PM_WINDREAM.DD_DMSLiteDataSetTableAdapters.VWPM_PROFILE_USERTableAdapter() - Me.TBPM_USERBindingSource = New System.Windows.Forms.BindingSource(Me.components) - Me.TBPM_USERTableAdapter = New DD_PM_WINDREAM.DD_DMSLiteDataSetTableAdapters.TBPM_USERTableAdapter() - Me.TBPM_KONFIGURATIONBindingSource = New System.Windows.Forms.BindingSource(Me.components) - Me.TBPM_KONFIGURATIONTableAdapter = New DD_PM_WINDREAM.DD_DMSLiteDataSetTableAdapters.TBPM_KONFIGURATIONTableAdapter() - Me.TBPM_PROFILE_FILESBindingSource = New System.Windows.Forms.BindingSource(Me.components) - Me.TBPM_PROFILE_FILESTableAdapter = New DD_PM_WINDREAM.DD_DMSLiteDataSetTableAdapters.TBPM_PROFILE_FILESTableAdapter() - Me.TimerReminder = New System.Windows.Forms.Timer(Me.components) Me.SplitContainerDashboard = New System.Windows.Forms.SplitContainer() Me.SplitContainerTop = New System.Windows.Forms.SplitContainer() Me.ChartTopLeft = New DevExpress.XtraCharts.ChartControl() @@ -81,6 +70,18 @@ Partial Class frmMain Me.ToolStripBottomLeft = New System.Windows.Forms.ToolStrip() Me.ChartBottomRight = New DevExpress.XtraCharts.ChartControl() Me.ToolStripBottomRight = New System.Windows.Forms.ToolStrip() + Me.NotifyIcon1 = New System.Windows.Forms.NotifyIcon(Me.components) + Me.TimerRefresh = New System.Windows.Forms.Timer(Me.components) + Me.VWPM_PROFILE_USERBindingSource = New System.Windows.Forms.BindingSource(Me.components) + Me.VWPM_PROFILE_USERTableAdapter = New DD_PM_WINDREAM.DD_DMSLiteDataSetTableAdapters.VWPM_PROFILE_USERTableAdapter() + Me.TBPM_USERBindingSource = New System.Windows.Forms.BindingSource(Me.components) + Me.TBPM_USERTableAdapter = New DD_PM_WINDREAM.DD_DMSLiteDataSetTableAdapters.TBPM_USERTableAdapter() + Me.TBPM_KONFIGURATIONBindingSource = New System.Windows.Forms.BindingSource(Me.components) + Me.TBPM_KONFIGURATIONTableAdapter = New DD_PM_WINDREAM.DD_DMSLiteDataSetTableAdapters.TBPM_KONFIGURATIONTableAdapter() + Me.TBPM_PROFILE_FILESBindingSource = New System.Windows.Forms.BindingSource(Me.components) + Me.TBPM_PROFILE_FILESTableAdapter = New DD_PM_WINDREAM.DD_DMSLiteDataSetTableAdapters.TBPM_PROFILE_FILESTableAdapter() + Me.TimerReminder = New System.Windows.Forms.Timer(Me.components) + Me.TabellenlayoutZurücksetzenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() CType(Me.DD_DMSLiteDataSet, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.TBPM_PROFILEBindingSource, System.ComponentModel.ISupportInitialize).BeginInit() Me.ToolStrip1.SuspendLayout() @@ -91,10 +92,6 @@ Partial Class frmMain CType(Me.GridControlProfile, System.ComponentModel.ISupportInitialize).BeginInit() Me.ContextMenuGrid.SuspendLayout() CType(Me.GridViewProfile, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.VWPM_PROFILE_USERBindingSource, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.TBPM_USERBindingSource, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.TBPM_KONFIGURATIONBindingSource, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.TBPM_PROFILE_FILESBindingSource, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.SplitContainerDashboard, System.ComponentModel.ISupportInitialize).BeginInit() Me.SplitContainerDashboard.Panel1.SuspendLayout() Me.SplitContainerDashboard.Panel2.SuspendLayout() @@ -111,6 +108,10 @@ Partial Class frmMain Me.SplitContainerBottom.SuspendLayout() CType(Me.ChartBottomLeft, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.ChartBottomRight, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.VWPM_PROFILE_USERBindingSource, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.TBPM_USERBindingSource, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.TBPM_KONFIGURATIONBindingSource, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.TBPM_PROFILE_FILESBindingSource, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'ImageListProfile @@ -377,9 +378,9 @@ Partial Class frmMain ' 'ContextMenuGrid ' - Me.ContextMenuGrid.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.CMGroupStart, Me.CMFileStart}) + Me.ContextMenuGrid.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.CMGroupStart, Me.CMFileStart, Me.TabellenlayoutZurücksetzenToolStripMenuItem}) Me.ContextMenuGrid.Name = "ContextMenuStrip1" - Me.ContextMenuGrid.Size = New System.Drawing.Size(266, 48) + Me.ContextMenuGrid.Size = New System.Drawing.Size(266, 92) ' 'CMGroupStart ' @@ -405,9 +406,9 @@ Partial Class frmMain Me.GridViewProfile.Appearance.GroupRow.Options.UseFont = True Me.GridViewProfile.Appearance.Row.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.GridViewProfile.Appearance.Row.Options.UseFont = True - GridFormatRule2.Name = "Format0" - GridFormatRule2.Rule = FormatConditionRuleValue2 - Me.GridViewProfile.FormatRules.Add(GridFormatRule2) + GridFormatRule1.Name = "Format0" + GridFormatRule1.Rule = FormatConditionRuleValue1 + Me.GridViewProfile.FormatRules.Add(GridFormatRule1) Me.GridViewProfile.GridControl = Me.GridControlProfile Me.GridViewProfile.GroupPanelText = "Ziehen Sie Spaltenüberschriften in diesen Bereich um nach diesen gruppieren zu la" & "ssen" @@ -427,56 +428,6 @@ Partial Class frmMain Me.GridViewProfile.OptionsView.ShowGroupPanel = False Me.GridViewProfile.OptionsView.ShowHorizontalLines = DevExpress.Utils.DefaultBoolean.[True] ' - 'NotifyIcon1 - ' - Me.NotifyIcon1.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info - Me.NotifyIcon1.Icon = CType(resources.GetObject("NotifyIcon1.Icon"), System.Drawing.Icon) - Me.NotifyIcon1.Text = "Process Manager" - Me.NotifyIcon1.Visible = True - ' - 'TimerRefresh - ' - Me.TimerRefresh.Interval = 60000 - ' - 'VWPM_PROFILE_USERBindingSource - ' - Me.VWPM_PROFILE_USERBindingSource.DataMember = "VWPM_PROFILE_USER" - Me.VWPM_PROFILE_USERBindingSource.DataSource = Me.DD_DMSLiteDataSet - ' - 'VWPM_PROFILE_USERTableAdapter - ' - Me.VWPM_PROFILE_USERTableAdapter.ClearBeforeFill = True - ' - 'TBPM_USERBindingSource - ' - Me.TBPM_USERBindingSource.DataMember = "TBPM_USER" - Me.TBPM_USERBindingSource.DataSource = Me.DD_DMSLiteDataSet - ' - 'TBPM_USERTableAdapter - ' - Me.TBPM_USERTableAdapter.ClearBeforeFill = True - ' - 'TBPM_KONFIGURATIONBindingSource - ' - Me.TBPM_KONFIGURATIONBindingSource.DataMember = "TBPM_KONFIGURATION" - Me.TBPM_KONFIGURATIONBindingSource.DataSource = Me.DD_DMSLiteDataSet - ' - 'TBPM_KONFIGURATIONTableAdapter - ' - Me.TBPM_KONFIGURATIONTableAdapter.ClearBeforeFill = True - ' - 'TBPM_PROFILE_FILESBindingSource - ' - Me.TBPM_PROFILE_FILESBindingSource.DataMember = "TBPM_PROFILE_FILES" - Me.TBPM_PROFILE_FILESBindingSource.DataSource = Me.DD_DMSLiteDataSet - ' - 'TBPM_PROFILE_FILESTableAdapter - ' - Me.TBPM_PROFILE_FILESTableAdapter.ClearBeforeFill = True - ' - 'TimerReminder - ' - ' 'SplitContainerDashboard ' Me.SplitContainerDashboard.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ @@ -607,6 +558,62 @@ Partial Class frmMain Me.ToolStripBottomRight.TabIndex = 0 Me.ToolStripBottomRight.Text = "ToolStrip3" ' + 'NotifyIcon1 + ' + Me.NotifyIcon1.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info + Me.NotifyIcon1.Icon = CType(resources.GetObject("NotifyIcon1.Icon"), System.Drawing.Icon) + Me.NotifyIcon1.Text = "Process Manager" + Me.NotifyIcon1.Visible = True + ' + 'TimerRefresh + ' + Me.TimerRefresh.Interval = 60000 + ' + 'VWPM_PROFILE_USERBindingSource + ' + Me.VWPM_PROFILE_USERBindingSource.DataMember = "VWPM_PROFILE_USER" + Me.VWPM_PROFILE_USERBindingSource.DataSource = Me.DD_DMSLiteDataSet + ' + 'VWPM_PROFILE_USERTableAdapter + ' + Me.VWPM_PROFILE_USERTableAdapter.ClearBeforeFill = True + ' + 'TBPM_USERBindingSource + ' + Me.TBPM_USERBindingSource.DataMember = "TBPM_USER" + Me.TBPM_USERBindingSource.DataSource = Me.DD_DMSLiteDataSet + ' + 'TBPM_USERTableAdapter + ' + Me.TBPM_USERTableAdapter.ClearBeforeFill = True + ' + 'TBPM_KONFIGURATIONBindingSource + ' + Me.TBPM_KONFIGURATIONBindingSource.DataMember = "TBPM_KONFIGURATION" + Me.TBPM_KONFIGURATIONBindingSource.DataSource = Me.DD_DMSLiteDataSet + ' + 'TBPM_KONFIGURATIONTableAdapter + ' + Me.TBPM_KONFIGURATIONTableAdapter.ClearBeforeFill = True + ' + 'TBPM_PROFILE_FILESBindingSource + ' + Me.TBPM_PROFILE_FILESBindingSource.DataMember = "TBPM_PROFILE_FILES" + Me.TBPM_PROFILE_FILESBindingSource.DataSource = Me.DD_DMSLiteDataSet + ' + 'TBPM_PROFILE_FILESTableAdapter + ' + Me.TBPM_PROFILE_FILESTableAdapter.ClearBeforeFill = True + ' + 'TimerReminder + ' + ' + 'TabellenlayoutZurücksetzenToolStripMenuItem + ' + Me.TabellenlayoutZurücksetzenToolStripMenuItem.Name = "TabellenlayoutZurücksetzenToolStripMenuItem" + Me.TabellenlayoutZurücksetzenToolStripMenuItem.Size = New System.Drawing.Size(265, 22) + Me.TabellenlayoutZurücksetzenToolStripMenuItem.Text = "Tabellenlayout zurücksetzen" + ' 'frmMain ' Me.AutoScaleDimensions = New System.Drawing.SizeF(9.0!, 19.0!) @@ -633,10 +640,6 @@ Partial Class frmMain CType(Me.GridControlProfile, System.ComponentModel.ISupportInitialize).EndInit() Me.ContextMenuGrid.ResumeLayout(False) CType(Me.GridViewProfile, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.VWPM_PROFILE_USERBindingSource, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.TBPM_USERBindingSource, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.TBPM_KONFIGURATIONBindingSource, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.TBPM_PROFILE_FILESBindingSource, System.ComponentModel.ISupportInitialize).EndInit() Me.SplitContainerDashboard.Panel1.ResumeLayout(False) Me.SplitContainerDashboard.Panel2.ResumeLayout(False) CType(Me.SplitContainerDashboard, System.ComponentModel.ISupportInitialize).EndInit() @@ -657,6 +660,10 @@ Partial Class frmMain Me.SplitContainerBottom.ResumeLayout(False) CType(Me.ChartBottomLeft, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.ChartBottomRight, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.VWPM_PROFILE_USERBindingSource, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.TBPM_USERBindingSource, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.TBPM_KONFIGURATIONBindingSource, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.TBPM_PROFILE_FILESBindingSource, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() @@ -716,4 +723,5 @@ Partial Class frmMain Friend WithEvents ToolStripBottomLeft As ToolStrip Friend WithEvents ChartBottomRight As DevExpress.XtraCharts.ChartControl Friend WithEvents ToolStripBottomRight As ToolStrip + Friend WithEvents TabellenlayoutZurücksetzenToolStripMenuItem As ToolStripMenuItem End Class diff --git a/app/DD_PM_WINDREAM/frmMain.resx b/app/DD_PM_WINDREAM/frmMain.resx index df2506f..c628d72 100644 --- a/app/DD_PM_WINDREAM/frmMain.resx +++ b/app/DD_PM_WINDREAM/frmMain.resx @@ -125,7 +125,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADw - CAAAAk1TRnQBSQFMAgEBAgEAAeABAgHgAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CAAAAk1TRnQBSQFMAgEBAgEAAegBAgHoAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/app/DD_PM_WINDREAM/frmMain.vb b/app/DD_PM_WINDREAM/frmMain.vb index 170cb73..3e7900a 100644 --- a/app/DD_PM_WINDREAM/frmMain.vb +++ b/app/DD_PM_WINDREAM/frmMain.vb @@ -46,8 +46,9 @@ Public Class frmMain ClassLogger.Add("Error in Save FormLayout: " & ex.Message) End Try Try - Dim XMLPath = GetXML_LayoutName() - GridViewProfile.SaveLayoutToXml(XMLPath) + 'Dim XMLPath = GetXML_LayoutName() + 'GridViewProfile.SaveLayoutToXml(XMLPath) + SaveLayout() Catch ex As Exception End Try @@ -172,6 +173,43 @@ Public Class frmMain Dim Filename As String = String.Format("GridViewProfiles_UserLayout_{0}.xml", GRID_LOAD_TYPE) Return System.IO.Path.Combine(Application.UserAppDataPath(), Filename) End Function + + Private Sub SaveLayout() + Try + Dim xml As String = GetXML_LayoutName() + Dim xmlDefault = xml & ".default" + + If IO.File.Exists(xmlDefault) = False Then + GridViewProfile.SaveLayoutToXml(xmlDefault, OptionsLayoutBase.FullLayout) + End If + + GridViewProfile.SaveLayoutToXml(xml, OptionsLayoutBase.FullLayout) + Catch ex As Exception + ClassLogger.Add("Error while saving layout: " & ex.Message) + End Try + End Sub + + Private Sub RestoreLayout() + Try + Dim xml As String = GetXML_LayoutName() + GridViewProfile.RestoreLayoutFromXml(xml, OptionsLayoutBase.FullLayout) + Catch ex As Exception + ClassLogger.Add("Error while restoring layout: " & ex.Message) + End Try + End Sub + + Private Sub ResetLayout() + Try + Dim xml As String = GetXML_LayoutName() + Dim xmlDefault = xml & ".default" + IO.File.Delete(xml) + + GridViewProfile.RestoreLayoutFromXml(xmlDefault, OptionsLayoutBase.FullLayout) + Catch ex As Exception + ClassLogger.Add("Error while resetting layout: " & ex.Message) + End Try + End Sub + Sub Load_Profile_items() Cursor = Cursors.WaitCursor Try @@ -209,6 +247,10 @@ Public Class frmMain Cursor = Cursors.Default End Sub Private Sub navBar_LinkClicked(ByVal sender As Object, ByVal e As NavBarLinkEventArgs) + ' Das aktuelle Layout speichern, bevor das neue geladen wird + ' und GRID_LOAD_TYPE gesetzt wird. + SaveLayout() + Dim _tag = e.Link.Item.Tag If Not IsNothing(_tag) Then If _tag.ToString.Contains("itmProfile#") Then @@ -437,19 +479,12 @@ Public Class frmMain CURR_DT_PROFILEGRID = ClassDatabase.Return_Datatable(sql, True) Create_Basic_View() - Dim filexml = GetXML_LayoutName() - GridViewProfile.RestoreLayoutFromXml(filexml) - GridView_CheckInvalidColumns() - If GRID_INV_COL_REMOVED = True Then - GridViewProfile.SaveLayoutToXml(filexml) - End If + Dim Columns_Removed = GridView_CheckInvalidColumns() + RestoreLayout() End If - - - Catch ex As Exception ClassLogger.Add("Load_single_Profile - Error: " & ex.Message) End Try @@ -493,12 +528,8 @@ Public Class frmMain GridControlProfile.DataSource = CURR_DT_PROFILEGRID 'GridControlProfile.ForceInitialize() - Try - Dim XMLPath = GetXML_LayoutName() - GridViewProfile.RestoreLayoutFromXml(XMLPath) - Catch ex As Exception + RestoreLayout() - End Try GridViewProfile.Columns.Item("PROFILE_ID").Visible = False GridViewProfile.Columns.Item("GUID").Visible = False GridViewProfile.Columns.Item("FULL_FILE_PATH").Visible = False @@ -507,7 +538,7 @@ Public Class frmMain GridViewProfile.Columns.Item("ICON").MaxWidth = 24 GridViewProfile.Columns.Item("ICON").MinWidth = 24 GridViewProfile.Columns.Item("ICON").AppearanceCell.BackColor = Color.White - GridViewProfile.Columns.Item("ICON").Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Left + GridViewProfile.Columns.Item("ICON").Fixed = FixedStyle.Left GridViewProfile.Columns("Last edited").DisplayFormat.FormatType = FormatType.DateTime GridViewProfile.Columns("Last edited").DisplayFormat.FormatString = "dd.MM.yyyy HH:MM:ss" GridViewProfile.Columns.Item("PROFILE_GROUP_TEXT").Visible = False @@ -515,7 +546,8 @@ Public Class frmMain End Sub - Private Sub GridView_CheckInvalidColumns() + Private Function GridView_CheckInvalidColumns() As Boolean + Dim Columns_Removed = False GRID_INV_COL_REMOVED = False Try For Each grid_column As GridColumn In GridViewProfile.Columns @@ -536,20 +568,20 @@ Public Class frmMain If grid_column.Visible = True Then Try grid_column.Dispose() + Columns_Removed = True GRID_INV_COL_REMOVED = True Catch ex As Exception End Try End If - - End If Next + Return Columns_Removed Catch ex As Exception ClassLogger.Add("Unexpected Error in GridView_CheckInvalidColumns: " & ex.Message) End Try - End Sub + End Function Sub LoadProfile_PM() Try If Me.Visible = True And frmProfileDesigner.Visible = False Then @@ -587,10 +619,9 @@ Public Class frmMain Catch ex As Exception ClassLogger.Add("Unexpected Error in Formatting Grid: " & ex.Message) End Try - GridView_CheckInvalidColumns() - If GRID_INV_COL_REMOVED = True Then - GridViewProfile.SaveLayoutToXml(GetXML_LayoutName()) - End If + + Dim Columns_Removed = GridView_CheckInvalidColumns() + RestoreLayout() Else @@ -798,15 +829,6 @@ Public Class frmMain End Sub - Private Sub GridViewProfile_Layout(sender As Object, e As EventArgs) Handles GridViewProfile.Layout - Try - Dim XMLPath = GetXML_LayoutName() - GridViewProfile.SaveLayoutToXml(XMLPath) - Catch ex As Exception - - End Try - End Sub - Private Sub GridViewProfile_MouseDown(sender As Object, e As MouseEventArgs) Handles GridViewProfile.MouseDown Dim view As GridView = sender @@ -924,6 +946,9 @@ Public Class frmMain End Sub Private Sub NavBarItemOverview_LinkClicked(sender As Object, e As NavBarLinkEventArgs) Handles NavBarItemOverview.LinkClicked + ' Das aktuelle Layout speichern, bevor das neue geladen wird + ' und GRID_LOAD_TYPE gesetzt wird. + SaveLayout() Load_Grid_Overview() End Sub Sub Load_Grid_Overview() @@ -997,12 +1022,9 @@ Public Class frmMain GridControlProfile.DataSource = CURR_DT_PROFILEGRID 'GridControlProfile.ForceInitialize() - Try - Dim XMLPath = GetXML_LayoutName() - GridViewProfile.RestoreLayoutFromXml(XMLPath) - Catch ex As Exception - End Try + Dim Columns_Removed = GridView_CheckInvalidColumns() + RestoreLayout() Try GridViewProfile.Columns.Item("PROFILE_GROUP_TEXT").GroupIndex = 0 @@ -1065,8 +1087,8 @@ Public Class frmMain - GridViewProfile.SaveLayoutToXml(GetXML_LayoutName()) - + 'GridViewProfile.SaveLayoutToXml(GetXML_LayoutName()) + SaveLayout() Else GridControlProfile.DataSource = Nothing Try @@ -1101,4 +1123,8 @@ Public Class frmMain End If Layout_Dashboard() End Sub + + Private Sub TabellenlayoutZurücksetzenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles TabellenlayoutZurücksetzenToolStripMenuItem.Click + ResetLayout() + End Sub End Class \ No newline at end of file