Refactor monitoring grid to use GridViewMonitoring

Replaces all references to GridView5 with GridViewMonitoring for clarity and maintainability. Updates layout save/restore logic to use the new view, adds a helper for loading layouts, and improves default layout restoration. Cleans up designer and resource files, removing obsolete entries and ensuring correct initialization.
This commit is contained in:
OlgunR
2026-01-28 11:28:19 +01:00
parent 5d4cdb2814
commit 9b321269ce
3 changed files with 115 additions and 141 deletions

View File

@@ -98,11 +98,6 @@ Public Class frmMain
txtMonitoringConfig.Text = "500"
End If
LoadMonitoringIntoGrid()
Dim layoutPath As String = System.IO.Path.Combine(Application.UserAppDataPath, "gridMonitoringLayout.xml")
If System.IO.File.Exists(layoutPath) Then
GridView5.RestoreLayoutFromXml(layoutPath)
End If
End Sub
Private Sub frmMain_Shown(sender As Object, e As EventArgs) Handles Me.Shown
@@ -1070,11 +1065,14 @@ Public Class frmMain
Me.gridMonitoring.DataSource = oDT
Dim gridView = TryCast(Me.GridView5, DevExpress.XtraGrid.Views.Grid.GridView)
Dim gridView = TryCast(Me.GridViewMonitoring, DevExpress.XtraGrid.Views.Grid.GridView)
If gridView IsNot Nothing Then
gridView.OptionsView.ColumnAutoWidth = True
gridView.BestFitColumns()
gridView.OptionsBehavior.Editable = False
LoadLayoutMonitoring()
End If
Catch ex As Exception
@@ -1095,7 +1093,7 @@ Public Class frmMain
Private Sub btnSaveLayout_Click(sender As Object, e As EventArgs) Handles btnSaveLayout.Click
Dim layoutPath As String = System.IO.Path.Combine(Application.UserAppDataPath, "gridMonitoringLayout.xml")
GridView5.SaveLayoutToXml(layoutPath)
GridViewMonitoring.SaveLayoutToXml(layoutPath)
MessageBox.Show("Layout gespeichert!")
End Sub
@@ -1104,8 +1102,17 @@ Public Class frmMain
If System.IO.File.Exists(layoutPath) Then
System.IO.File.Delete(layoutPath)
End If
' Grid neu laden, damit das Defaultlayout angezeigt wird
GridViewMonitoring.Columns.Clear()
gridMonitoring.DataSource = Nothing
LoadMonitoringIntoGrid()
MessageBox.Show("Standardlayout wurde wiederhergestellt!")
End Sub
Private Sub LoadLayoutMonitoring()
Dim layoutPath As String = System.IO.Path.Combine(Application.UserAppDataPath, "gridMonitoringLayout.xml")
If System.IO.File.Exists(layoutPath) Then
GridViewMonitoring.RestoreLayoutFromXml(layoutPath)
End If
End Sub
End Class