From de85fac9a601d6d77b1933bea33a2ecfdc76e182 Mon Sep 17 00:00:00 2001 From: Emmanuele Sassi Date: Tue, 20 Nov 2018 10:12:25 +0000 Subject: [PATCH] EgtCAM5 : - Aggiunta verifica nome in rinomina lavorazione e segno progetto modificato. --- .../OperationExpanderV.xaml.vb | 4 ++- .../MachiningOpListBoxItem.vb | 33 ++++++++++++------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderV.xaml.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderV.xaml.vb index 7097a5f..22ed066 100644 --- a/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderV.xaml.vb +++ b/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderV.xaml.vb @@ -38,7 +38,9 @@ Public Class OperationExpanderV If IsNothing(TextBox) Then Return Dim SelOp As MachiningOpListBoxItem = TryCast(TextBox.DataContext, MachiningOpListBoxItem) If IsNothing(SelOp) Then Return - SelOp.ModifyNameEsc() + If MachiningOpListBoxItem.m_CloseModifyLostFocus Then + SelOp.ModifyNameEsc() + End If End Sub #End Region ' EVENTS diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/OperationListBoxItem/MachiningOpListBoxItem.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/OperationListBoxItem/MachiningOpListBoxItem.vb index 1c688b3..ba68b0c 100644 --- a/OptionPanel/MachiningOptionPanel/OperationExpander/OperationListBoxItem/MachiningOpListBoxItem.vb +++ b/OptionPanel/MachiningOptionPanel/OperationExpander/OperationListBoxItem/MachiningOpListBoxItem.vb @@ -87,17 +87,6 @@ Public Class MachiningOpListBoxItem ' do il focus al nome RaiseEvent m_ModifyNameGetFocus() ' se esco da modifica - Else - 'se premuto enter - If m_ModifyNameOk Then - ' Imposto il nuovo nome - If Not EgtSetOperationName(Id, m_ModifiedName) Then Return - ' aggiorno il nome con quello modificato - Name = m_ModifiedName - Else - ' resetto il nome modificato - m_ModifiedName = "" - End If End If NotifyPropertyChanged("ModifiedName") NotifyPropertyChanged("Name") @@ -194,9 +183,31 @@ Public Class MachiningOpListBoxItem ''' Public Sub ModifyNameEnter() m_ModifyNameOk = True + ' verifico che il nome non inizi con disp + If m_ModifiedName.StartsWith("disp", StringComparison.InvariantCultureIgnoreCase) Then + m_CloseModifyLostFocus = False + MessageBox.Show(EgtMsg(MSG_OPERATION + 21), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Warning) + Return + End If + ' Imposto il nuovo nome + If String.Compare(m_ModifiedName, Name, True) <> 0 Then + If Not EgtSetOperationName(Id, m_ModifiedName) Then + m_CloseModifyLostFocus = False + MessageBox.Show(EgtMsg(MSG_OPERATION + 22), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Warning) + Return + End If + ' aggiorno il nome con quello modificato + Name = m_ModifiedName + End If + ' aggiorno titolo + Application.Msn.NotifyColleagues(Application.EMITTITLE) + ' termino il rinomina + m_CloseModifyLostFocus = True IsActive_ModifyName = False End Sub + Friend Shared m_CloseModifyLostFocus As Boolean = True + #End Region ' ModifyNameEnterCommand #Region "ModifyNameEscCommand"