From e88e19ed3fc5c09b063227daf658e5440c25b3ca Mon Sep 17 00:00:00 2001 From: Demetrio Cassarino Date: Fri, 13 Mar 2026 09:48:53 +0100 Subject: [PATCH] -migliorata gestione griglia dinamica chiusura expander --- OptionPanel/DrawOptionPanelV.xaml | 6 ++-- OptionPanel/DrawOptionPanelV.xaml.vb | 1 + OptionPanel/DrawOptionPanelVM.vb | 34 +++++++++++++++++-- .../EstimationsExpander.vb | 1 + .../OperationParametersExpanderVM.vb | 1 + .../SimulationExpanderVM.vb | 1 + OptionPanel/MachiningOptionPanelV.xaml | 4 ++- OptionPanel/MachiningOptionPanelV.xaml.vb | 2 ++ OptionPanel/MachiningOptionPanelVM.vb | 30 +++++++++++++++- Utility/Map.vb | 20 +++++++++++ 10 files changed, 94 insertions(+), 6 deletions(-) diff --git a/OptionPanel/DrawOptionPanelV.xaml b/OptionPanel/DrawOptionPanelV.xaml index b32bf3a..f4cefa2 100644 --- a/OptionPanel/DrawOptionPanelV.xaml +++ b/OptionPanel/DrawOptionPanelV.xaml @@ -8,10 +8,12 @@ + EgtCAM5:DrawOptionPanelVM.IsExpanded="{Binding ManageLayerRowIsExpanded}" + EgtCAM5:DrawOptionPanelVM.TargetSplitter="{Binding ElementName=ManagerLayerGridSplitter}"/> + EgtCAM5:DrawOptionPanelVM.IsExpanded="{Binding InfoRowIsExpanded}" + EgtCAM5:DrawOptionPanelVM.TargetSplitter="{Binding ElementName=InfoGridSplitter}"/> diff --git a/OptionPanel/DrawOptionPanelV.xaml.vb b/OptionPanel/DrawOptionPanelV.xaml.vb index 22e893c..4e30a6c 100644 --- a/OptionPanel/DrawOptionPanelV.xaml.vb +++ b/OptionPanel/DrawOptionPanelV.xaml.vb @@ -6,6 +6,7 @@ InitializeComponent() ' Add any initialization after the InitializeComponent() call. + Map.SetRefDrawOptionPanelV(Me) If Not IsActivePlugin() Then AddHandler DrawGrid.Loaded, Sub() diff --git a/OptionPanel/DrawOptionPanelVM.vb b/OptionPanel/DrawOptionPanelVM.vb index 3f3cd9f..2608e8d 100644 --- a/OptionPanel/DrawOptionPanelVM.vb +++ b/OptionPanel/DrawOptionPanelVM.vb @@ -1,4 +1,6 @@ -Public Class DrawOptionPanelVM +Imports System.IO + +Public Class DrawOptionPanelVM Inherits ViewModelBase ' GRAPHICAL ELEMENTS @@ -114,12 +116,34 @@ Return CType(element.GetValue(IsExpandedProperty), Boolean) End Function + Public Shared Function GetTargetSplitter(d As DependencyObject) As GridSplitter + Return CType(d.GetValue(TargetSplitterProperty), GridSplitter) + End Function + + Public Shared Sub SetTargetSplitter(d As DependencyObject, value As GridSplitter) + d.SetValue(TargetSplitterProperty, value) + End Sub + + Public Shared ReadOnly TargetSplitterProperty As DependencyProperty = + DependencyProperty.RegisterAttached( + "TargetSplitter", + GetType(GridSplitter), + GetType(DrawOptionPanelVM), + New PropertyMetadata(Nothing) + ) + Private Shared Sub OnIsExpandedChanged(d As DependencyObject, e As DependencyPropertyChangedEventArgs) Dim row As RowDefinition = TryCast(d, RowDefinition) If IsNothing(row) Then Return Dim isExpanded As Boolean = CBool(e.NewValue) + Dim splitter = DrawOptionPanelVM.GetTargetSplitter(row) + If splitter IsNot Nothing Then + splitter.IsEnabled = isExpanded + splitter.Visibility = If(isExpanded, Visibility.Visible, Visibility.Collapsed) + End If + Dim rowId As String = GetRowId(row) Dim rowHeight As Double = 0 @@ -134,7 +158,13 @@ row.Height = New GridLength(1, GridUnitType.Auto) Else - row.Height = New GridLength(rowHeight) + If File.Exists(Map.refMainWindowVM.DimensionDir) Then + DynamicGridModule.RestoreDrawGridLayout(Map.refDrawOptionPanelV.DrawGrid, "ManageLayer", 0, If(IniFile.IsActivePlugin(), DynamicGridModule.PROJECT_DRAW_PLUGIN, DynamicGridModule.PROJECT_DRAW)) + DynamicGridModule.RestoreDrawGridLayout(Map.refDrawOptionPanelV.DrawGrid, "Info", 1, If(IniFile.IsActivePlugin(), DynamicGridModule.PROJECT_DRAW_PLUGIN, DynamicGridModule.PROJECT_DRAW)) + Map.refDrawOptionPanelV.DrawGrid.UpdateLayout() + Else + row.Height = New GridLength(rowHeight) + End If End If End Sub diff --git a/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpander.vb b/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpander.vb index a1d9a27..00844bf 100644 --- a/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpander.vb +++ b/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpander.vb @@ -18,6 +18,7 @@ Public Class EstimationsExpanderVM Set(value As Boolean) If value <> m_Estimation_IsExpanded Then Map.refMachiningOptionPanelVM.Set_IsExpanded(MachiningOptionPanelVM.MachiningOptionPanelExpander.ESTIMATIONS, value) + Map.refMachiningOptionPanelVM.SetOperationsListRowIsExpanded(False) End If End Set End Property diff --git a/OptionPanel/MachiningOptionPanel/OperationParametersExpander/OperationParametersExpanderVM.vb b/OptionPanel/MachiningOptionPanel/OperationParametersExpander/OperationParametersExpanderVM.vb index 2e9be37..0c73a29 100644 --- a/OptionPanel/MachiningOptionPanel/OperationParametersExpander/OperationParametersExpanderVM.vb +++ b/OptionPanel/MachiningOptionPanel/OperationParametersExpander/OperationParametersExpanderVM.vb @@ -29,6 +29,7 @@ Public Class OperationParametersExpanderVM ' disattivo MTable e SpecialPanel se vado sulla modifica di una lavorazione Map.refDoorPanelVM.MTableIsEnabled(Not m_ParametersIsExpanded) Map.refSpecialPanelVM.SpecialPanelIsEnabled(Not m_ParametersIsExpanded) + Map.refMachiningOptionPanelVM.SetOperationsListRowIsExpanded(False) End Set End Property diff --git a/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderVM.vb b/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderVM.vb index 7f5ce83..52d5948 100644 --- a/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderVM.vb +++ b/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderVM.vb @@ -20,6 +20,7 @@ Public Class SimulationExpanderVM Map.refOperationsListExpanderVM.StatusLampList.Clear() Dim tmpStatusLamp As New StatusLamp() Map.refOperationsListExpanderVM.StatusLampList = tmpStatusLamp.LoadStatusLamp() + Map.refMachiningOptionPanelVM.SetOperationsListRowIsExpanded(False) End If End Set End Property diff --git a/OptionPanel/MachiningOptionPanelV.xaml b/OptionPanel/MachiningOptionPanelV.xaml index 6e8e10c..c368965 100644 --- a/OptionPanel/MachiningOptionPanelV.xaml +++ b/OptionPanel/MachiningOptionPanelV.xaml @@ -6,7 +6,9 @@ - + diff --git a/OptionPanel/MachiningOptionPanelV.xaml.vb b/OptionPanel/MachiningOptionPanelV.xaml.vb index 1be084a..728e9ca 100644 --- a/OptionPanel/MachiningOptionPanelV.xaml.vb +++ b/OptionPanel/MachiningOptionPanelV.xaml.vb @@ -6,6 +6,8 @@ InitializeComponent() ' Add any initialization after the InitializeComponent() call. + Map.SetRefMachiningOptionPanelV(Me) + If Not IsActivePlugin() Then AddHandler MachiningGrid.Loaded, Sub() diff --git a/OptionPanel/MachiningOptionPanelVM.vb b/OptionPanel/MachiningOptionPanelVM.vb index 7a4cb27..0dc9bf2 100644 --- a/OptionPanel/MachiningOptionPanelVM.vb +++ b/OptionPanel/MachiningOptionPanelVM.vb @@ -1,4 +1,5 @@ Imports EgtUILib +Imports System.IO Public Class MachiningOptionPanelVM Inherits ViewModelBase @@ -224,18 +225,45 @@ Public Class MachiningOptionPanelVM Return CType(element.GetValue(IsExpandedProperty), Boolean) End Function + Public Shared Function GetTargetSplitter(d As DependencyObject) As GridSplitter + Return CType(d.GetValue(TargetSplitterProperty), GridSplitter) + End Function + + Public Shared Sub SetTargetSplitter(d As DependencyObject, value As GridSplitter) + d.SetValue(TargetSplitterProperty, value) + End Sub + + Public Shared ReadOnly TargetSplitterProperty As DependencyProperty = + DependencyProperty.RegisterAttached( + "TargetSplitter", + GetType(GridSplitter), + GetType(MachiningOptionPanelVM), + New PropertyMetadata(Nothing) + ) + Private Shared Sub OnIsExpandedChanged(d As DependencyObject, e As DependencyPropertyChangedEventArgs) Dim row As RowDefinition = TryCast(d, RowDefinition) If IsNothing(row) Then Return Dim isExpanded As Boolean = CBool(e.NewValue) + Dim splitter = MachiningOptionPanelVM.GetTargetSplitter(row) + If Not IsNothing(splitter) Then + splitter.IsEnabled = isExpanded + splitter.Visibility = If(isExpanded, Visibility.Visible, Visibility.Collapsed) + End If + If Not isExpanded Then row.ClearValue(RowDefinition.HeightProperty) row.Height = New GridLength(1, GridUnitType.Auto) Else - row.Height = New GridLength(350) + If File.Exists(Map.refMainWindowVM.DimensionDir) Then + DynamicGridModule.RestoreMachiningGridLayout(Map.refMachiningOptionPanelV.MachiningGrid, If(IniFile.IsActivePlugin(), DynamicGridModule.PROJECT_MACHINING_PLUGIN, DynamicGridModule.PROJECT_MACHINING)) + Map.refMachiningOptionPanelV.MachiningGrid.UpdateLayout() + Else + row.Height = New GridLength(350) + End If End If End Sub diff --git a/Utility/Map.vb b/Utility/Map.vb index 4eca329..f737704 100644 --- a/Utility/Map.vb +++ b/Utility/Map.vb @@ -38,6 +38,8 @@ Module Map Private m_refReversePostPanelVM As ReversePostPanelVM Private m_refGunStockPanelVM As GunStockPanelVM Private m_refMachiningParameterExpanderVM As MachiningParameterExpanderVM + Private m_refMachiningOptionPanelV As MachiningOptionPanelV + Private m_refDrawOptionPanelV As DrawOptionPanelV #Region "Get" @@ -211,6 +213,16 @@ Module Map Return m_refMachiningParameterExpanderVM End Get End Property + Public ReadOnly Property refMachiningOptionPanelV As MachiningOptionPanelV + Get + Return m_refMachiningOptionPanelV + End Get + End Property + Public ReadOnly Property refDrawOptionPanelV As DrawOptionPanelV + Get + Return m_refDrawOptionPanelV + End Get + End Property #End Region ' Get @@ -349,6 +361,14 @@ Module Map m_refMachiningParameterExpanderVM = MachiningParameterExpanderVM Return Not IsNothing(m_refMachiningParameterExpanderVM) End Function + Friend Function SetRefMachiningOptionPanelV(MachiningOptionPanelV As MachiningOptionPanelV) As Boolean + m_refMachiningOptionPanelV = MachiningOptionPanelV + Return Not IsNothing(m_refMachiningOptionPanelV) + End Function + Friend Function SetRefDrawOptionPanelV(DrawOptionPanelV As DrawOptionPanelV) As Boolean + m_refDrawOptionPanelV = DrawOptionPanelV + Return Not IsNothing(m_refDrawOptionPanelV) + End Function #End Region ' Set