jj - Speichern des Layouts / CheckInvalidColumns für Übersicht
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user