diff --git a/ToolsDbWindow/ToolTreeView.vb b/ToolsDbWindow/ToolTreeView.vb index 2495bd8..d28941d 100644 --- a/ToolsDbWindow/ToolTreeView.vb +++ b/ToolsDbWindow/ToolTreeView.vb @@ -1000,24 +1000,22 @@ Public Class ToolTreeViewItem End Get End Property - Private m_PreviousCurrentTool As String = String.Empty Public Property Active As Boolean Get EgtSetCurrentContext(IniFile.m_ProjectSceneContext) ' salvo utensile corrente precedente - EgtTdbGetCurrToolParam(MCH_TP.NAME, m_PreviousCurrentTool) - Dim bChangeTool As Boolean = m_PreviousCurrentTool <> Me.Name + Dim PreviousCurrentTool As String = String.Empty + EgtTdbGetCurrToolParam(MCH_TP.NAME, PreviousCurrentTool) + Dim bChangeTool As Boolean = PreviousCurrentTool <> Me.Name If bChangeTool Then EgtTdbSetCurrTool(Me.Name) Dim bActive As Boolean = False EgtTdbGetCurrToolParam(MCH_TP.ACTIVE, bActive) ' ripristino utensile corrente - If bChangeTool Then EgtTdbSetCurrTool(m_PreviousCurrentTool) + If bChangeTool Then EgtTdbSetCurrTool(PreviousCurrentTool) Return bActive End Get Set(value As Boolean) EgtSetCurrentContext(IniFile.m_ProjectSceneContext) - ' salvo utensile corrente precedente - EgtTdbGetCurrToolParam(MCH_TP.NAME, m_PreviousCurrentTool) ' verifico se l'utensile selezionato è modificato Dim SelTool As ToolTreeViewItem = m_delGetSelectedTool() If Not IsNothing(SelTool) AndAlso SelTool.IsModified Then @@ -1034,13 +1032,16 @@ Public Class ToolTreeViewItem m_delIsEnabledBtns(SelTool.IsValid And Not SelTool.IsModified, SelTool.IsValid, True) End If End If + ' salvo utensile corrente precedente + Dim PreviousCurrentTool As String = String.Empty + EgtTdbGetCurrToolParam(MCH_TP.NAME, PreviousCurrentTool) ' se attivato, verifico che non sia in conflitto con altri utensili If value Then ' verifico se c'è un utensile con la stessa posizione If Not VerifyAllPositions() Then MessageBox.Show(EgtMsg(6145), EgtMsg(6126), MessageBoxButton.OK, MessageBoxImage.Exclamation) ' ripristino utensile corrente - EgtTdbSetCurrTool(m_PreviousCurrentTool) + EgtTdbSetCurrTool(PreviousCurrentTool) Return End If End If @@ -1050,7 +1051,7 @@ Public Class ToolTreeViewItem EgtTdbSaveCurrTool() NotifyPropertyChanged("Active") ' ripristino utensile corrente - EgtTdbSetCurrTool(m_PreviousCurrentTool) + EgtTdbSetCurrTool(PreviousCurrentTool) End Set End Property #End Region ' Tool Property