-introdotto griglia dinamica per gestire spostamento colonne
This commit is contained in:
@@ -0,0 +1,241 @@
|
||||
Imports EgtWPFLib5
|
||||
|
||||
Module DynamicGridModule
|
||||
|
||||
Friend Const PROJECT_EGTCAM5 As String = "Project_EgtCAM5"
|
||||
Friend Const PROJECT_EGTCAM5_PLUGIN As String = "Project_EgtCAM5_PlugIn"
|
||||
|
||||
Friend Const PROJECT_MACHINING As String = "Project_Machinig"
|
||||
Friend Const PROJECT_MACHINING_PLUGIN As String = "Project_Machinig_PlugIn"
|
||||
|
||||
Friend Const PROJECT_DRAW As String = "Project_Draw"
|
||||
Friend Const PROJECT_DRAW_PLUGIN As String = "Project_Draw_PlugIn"
|
||||
|
||||
''' <summary>
|
||||
''' Funzione per popolare la griglia
|
||||
''' </summary>
|
||||
''' <param name="m_TopTrayV"></param>
|
||||
''' <param name="m_LeftTrayV"></param>
|
||||
''' <param name="m_RightTrayV"></param>
|
||||
''' <param name="m_BottomTrayV"></param>
|
||||
''' <param name="m_SceneContentControlV"></param>
|
||||
''' <param name="gridSplitter"></param>
|
||||
Friend Sub PopulateGrid(m_TopTrayV As TopTrayV, m_LeftTrayV As LeftTrayV, m_RightTrayV As RightTrayV, m_BottomTrayV As BottomTrayV, m_SceneContentControlV As SceneContentControlV, gridSplitter As GridSplitter)
|
||||
' aggiungo TopTrayV
|
||||
Grid.SetRow(m_TopTrayV, 0)
|
||||
Grid.SetColumnSpan(m_TopTrayV, 3)
|
||||
|
||||
' aggiungo LeftTrayV
|
||||
Grid.SetRow(m_LeftTrayV, 1)
|
||||
Grid.SetColumn(m_LeftTrayV, 0)
|
||||
Grid.SetRowSpan(m_LeftTrayV, 2)
|
||||
|
||||
' aggiungo RightTrayV
|
||||
Grid.SetRow(m_RightTrayV, 1)
|
||||
Grid.SetColumn(m_RightTrayV, 2)
|
||||
Grid.SetRowSpan(m_RightTrayV, 2)
|
||||
|
||||
'aggiungo gridSplitter
|
||||
Grid.SetRow(gridSplitter, 1)
|
||||
Grid.SetColumn(gridSplitter, 2)
|
||||
|
||||
' aggiungo BottomTrayV
|
||||
Grid.SetRow(m_BottomTrayV, 2)
|
||||
Grid.SetColumn(m_BottomTrayV, 1)
|
||||
|
||||
' aggiungo Scena
|
||||
Grid.SetRow(m_SceneContentControlV, 1)
|
||||
Grid.SetColumn(m_SceneContentControlV, 1)
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Funzione per popolare la griglia con PlugIn
|
||||
''' </summary>
|
||||
''' <param name="m_TopTrayV"></param>
|
||||
''' <param name="m_RightTrayV"></param>
|
||||
''' <param name="m_BottomTrayV"></param>
|
||||
''' <param name="m_SceneContentControlV"></param>
|
||||
''' <param name="gridSplitter"></param>
|
||||
Friend Sub PopolateGridWithPlugIn(m_TopTrayV As TopTrayV, m_RightTrayV As RightTrayV, m_BottomTrayV As BottomTrayV, m_SceneContentControlV As SceneContentControlV, gridSplitter As GridSplitter)
|
||||
' aggiungo TopTrayV
|
||||
Grid.SetRow(m_TopTrayV, 0)
|
||||
Grid.SetColumn(m_TopTrayV, 1)
|
||||
|
||||
' aggiungo RightTrayV
|
||||
Grid.SetRow(m_RightTrayV, 0)
|
||||
Grid.SetColumn(m_RightTrayV, 2)
|
||||
Grid.SetRowSpan(m_RightTrayV, 2)
|
||||
|
||||
'aggiungo gridSplitter
|
||||
Grid.SetRow(gridSplitter, 0)
|
||||
Grid.SetColumn(gridSplitter, 2)
|
||||
Grid.SetRowSpan(gridSplitter, 2)
|
||||
|
||||
' aggiungo BottomTrayV
|
||||
Grid.SetRow(m_BottomTrayV, 2)
|
||||
Grid.SetColumn(m_BottomTrayV, 1)
|
||||
|
||||
' aggiungo Scena
|
||||
Grid.SetRow(m_SceneContentControlV, 1)
|
||||
Grid.SetColumn(m_SceneContentControlV, 1)
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Creazione GridSplitter
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Friend Function CreateGridSplitter() As GridSplitter
|
||||
' creo gridsplitter
|
||||
Dim gridSplitter As New GridSplitter With {
|
||||
.Width = 30,
|
||||
.HorizontalAlignment = HorizontalAlignment.Left,
|
||||
.VerticalAlignment = VerticalAlignment.Stretch,
|
||||
.Background = Brushes.Transparent
|
||||
}
|
||||
AddHandler gridSplitter.DragCompleted,
|
||||
Sub()
|
||||
SaveGridLayout(If(IsActivePlugin(), PROJECT_EGTCAM5_PLUGIN, PROJECT_EGTCAM5))
|
||||
End Sub
|
||||
|
||||
Return gridSplitter
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Creazione Griglia Dinamica
|
||||
''' </summary>
|
||||
Friend Sub CreateDynamicGrid()
|
||||
' creo colonne griglia dinamica
|
||||
Dim gridCol1 As New ColumnDefinition With {
|
||||
.Width = New GridLength(1, GridUnitType.Auto)
|
||||
}
|
||||
Dim gridCol2 As New ColumnDefinition With {
|
||||
.Width = New GridLength(1, GridUnitType.Star)
|
||||
}
|
||||
Dim gridCol3 As New ColumnDefinition With {
|
||||
.Width = New GridLength(250)
|
||||
}
|
||||
' aggiungo le colonne alla griglia
|
||||
Map.refProjectVM.DynamicGrid.ColumnDefinitions.Add(gridCol1)
|
||||
Map.refProjectVM.DynamicGrid.ColumnDefinitions.Add(gridCol2)
|
||||
Map.refProjectVM.DynamicGrid.ColumnDefinitions.Add(gridCol3)
|
||||
|
||||
' creo righe griglia dinamica
|
||||
Dim gridRow1 As New RowDefinition With {
|
||||
.Height = New GridLength(1, GridUnitType.Auto)
|
||||
}
|
||||
Dim gridRow2 As New RowDefinition With {
|
||||
.Height = New GridLength(1, GridUnitType.Star)
|
||||
}
|
||||
Dim gridRow3 As New RowDefinition With {
|
||||
.Height = New GridLength(1, GridUnitType.Auto)
|
||||
}
|
||||
' aggiungo righe alla griglia
|
||||
Map.refProjectVM.DynamicGrid.RowDefinitions.Add(gridRow1)
|
||||
Map.refProjectVM.DynamicGrid.RowDefinitions.Add(gridRow2)
|
||||
Map.refProjectVM.DynamicGrid.RowDefinitions.Add(gridRow3)
|
||||
End Sub
|
||||
|
||||
Friend Sub SaveGridLayout(GridTitle As String)
|
||||
Dim Index As Integer = 0
|
||||
|
||||
' Salvo colonna 2
|
||||
Dim valueCol2 As String = 0 & "," & 0 & "," & Map.refProjectVM.DynamicGrid.ColumnDefinitions(2).ActualWidth.ToString()
|
||||
EgtUILib.WritePrivateProfileString(GridTitle, Index.ToString(), valueCol2, Map.refMainWindowVM.DimensionDir)
|
||||
|
||||
Index = 1
|
||||
For i As Integer = 1 To Map.refProjectVM.DynamicGrid.RowDefinitions.Count - 1
|
||||
Dim row = Map.refProjectVM.DynamicGrid.RowDefinitions(i)
|
||||
Dim value As String = i.ToString() & "," & 1 & "," & row.ActualHeight.ToString()
|
||||
EgtUILib.WritePrivateProfileString(GridTitle, Index.ToString(), value, Map.refMainWindowVM.DimensionDir)
|
||||
Index += 1
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Friend Sub RestoreGridLayout(GridTitle As String)
|
||||
Dim Index As Integer = 0
|
||||
Dim IndexRow As Integer = 1
|
||||
Dim sValue = String.Empty
|
||||
While EgtUILib.GetPrivateProfileString(GridTitle, Index.ToString(), String.Empty, sValue, Map.refMainWindowVM.DimensionDir) > 0
|
||||
Dim sValueParams() As String = sValue.Split(","c)
|
||||
If sValueParams.Count >= 3 Then
|
||||
' cancello spazi
|
||||
For I As Integer = 0 To sValueParams.Count - 1
|
||||
sValueParams(I) = sValueParams(I).Trim()
|
||||
Next
|
||||
' creo valore
|
||||
Dim nDimType As Integer
|
||||
Dim GridLenValue As Double
|
||||
Integer.TryParse(sValueParams(1), nDimType)
|
||||
StringToDoubleAdv(sValueParams(2), GridLenValue)
|
||||
If nDimType = 0 Then
|
||||
Map.refProjectVM.DynamicGrid.ColumnDefinitions(2).Width = New GridLength(GridLenValue)
|
||||
Else
|
||||
Map.refProjectVM.DynamicGrid.RowDefinitions(IndexRow).Height = If(GridLenValue = 0, New GridLength(1, GridUnitType.Auto), New GridLength(GridLenValue))
|
||||
IndexRow += 1
|
||||
End If
|
||||
End If
|
||||
Index += 1
|
||||
End While
|
||||
End Sub
|
||||
|
||||
Friend Sub SaveMachiningGridLayout(MachGrid As Grid, GridTitle As String)
|
||||
Dim Index As Integer = 0
|
||||
' Salvo riga 0
|
||||
Dim valueRow As String = Index & "," & Index & "," & MachGrid.RowDefinitions(Index).ActualHeight.ToString()
|
||||
EgtUILib.WritePrivateProfileString(GridTitle, Index.ToString(), valueRow, Map.refMainWindowVM.DimensionDir)
|
||||
End Sub
|
||||
|
||||
Friend Sub RestoreMachiningGridLayout(MachGrid As Grid, GridTitle As String)
|
||||
Dim Index As Integer = 0
|
||||
Dim sValue = String.Empty
|
||||
While EgtUILib.GetPrivateProfileString(GridTitle, Index.ToString(), String.Empty, sValue, Map.refMainWindowVM.DimensionDir) > 0
|
||||
Dim sValueParams() As String = sValue.Split(","c)
|
||||
If sValueParams.Count >= 3 Then
|
||||
' cancello spazi
|
||||
For I As Integer = 0 To sValueParams.Count - 1
|
||||
sValueParams(I) = sValueParams(I).Trim()
|
||||
Next
|
||||
' creo valore
|
||||
Dim GridLenValue As Double
|
||||
StringToDoubleAdv(sValueParams(2), GridLenValue)
|
||||
MachGrid.RowDefinitions(0).Height = New GridLength(GridLenValue)
|
||||
End If
|
||||
Index += 1
|
||||
End While
|
||||
End Sub
|
||||
|
||||
Friend Sub SaveDrawGridLayout(MachGrid As Grid, RowId As String, GridTitle As String)
|
||||
Dim Index As Integer = 0
|
||||
Dim valueRow As String = String.Empty
|
||||
' Salvo riga 0
|
||||
If RowId = "ManageLayer" Then
|
||||
valueRow = Index & "," & Index & "," & MachGrid.RowDefinitions(Index).ActualHeight.ToString()
|
||||
EgtUILib.WritePrivateProfileString(GridTitle, Index.ToString(), valueRow, Map.refMainWindowVM.DimensionDir)
|
||||
Else
|
||||
Index = 1
|
||||
valueRow = Index & "," & 0 & "," & MachGrid.RowDefinitions(Index).ActualHeight.ToString()
|
||||
EgtUILib.WritePrivateProfileString(GridTitle, Index.ToString(), valueRow, Map.refMainWindowVM.DimensionDir)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Friend Sub RestoreDrawGridLayout(MachGrid As Grid, RowId As String, Index As Integer, GridTitle As String)
|
||||
Dim sValue = String.Empty
|
||||
EgtUILib.GetPrivateProfileString(GridTitle, Index.ToString(), String.Empty, sValue, Map.refMainWindowVM.DimensionDir)
|
||||
Dim sValueParams() As String = sValue.Split(","c)
|
||||
If sValueParams.Count >= 3 Then
|
||||
' cancello spazi
|
||||
For I As Integer = 0 To sValueParams.Count - 1
|
||||
sValueParams(I) = sValueParams(I).Trim()
|
||||
Next
|
||||
' creo valore
|
||||
Dim GridLenValue As Double
|
||||
StringToDoubleAdv(sValueParams(2), GridLenValue)
|
||||
If RowId = "ManageLayer" Then
|
||||
MachGrid.RowDefinitions(0).Height = New GridLength(GridLenValue)
|
||||
Else
|
||||
MachGrid.RowDefinitions(1).Height = New GridLength(GridLenValue)
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
End Module
|
||||
Reference in New Issue
Block a user