From 4e2a005b5aa742253af5a53d43eebe169c1cd897 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Wed, 8 Mar 2017 19:43:18 +0000 Subject: [PATCH] EgtCAM5 : - corretta gestione subtype nel dialogo lavorazione. --- MachiningsDbWindow/MachiningTreeView.vb | 12 ++-- .../MachiningParameterExpanderViewModel.vb | 58 +++++++++---------- 2 files changed, 34 insertions(+), 36 deletions(-) diff --git a/MachiningsDbWindow/MachiningTreeView.vb b/MachiningsDbWindow/MachiningTreeView.vb index 0c8c62d..3f8bb43 100644 --- a/MachiningsDbWindow/MachiningTreeView.vb +++ b/MachiningsDbWindow/MachiningTreeView.vb @@ -486,6 +486,12 @@ Public Class MachiningTreeViewItem Public ReadOnly Property SubTypeList As ObservableCollection(Of IdNameStruct) Get Select Case m_Type + Case MCH_MY.POCKETING + m_SubTypeList = New ObservableCollection(Of IdNameStruct)( + {New IdNameStruct(MCH_POCK_SUB.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), + New IdNameStruct(MCH_POCK_SUB.ONEWAY, EgtMsg(MSG_MACHININGSDBPAGE + 143)), + New IdNameStruct(MCH_POCK_SUB.SPIRALIN, EgtMsg(MSG_MACHININGSDBPAGE + 148)), + New IdNameStruct(MCH_POCK_SUB.SPIRALOUT, EgtMsg(MSG_MACHININGSDBPAGE + 149))}) Case MCH_MY.SAWFINISHING m_SubTypeList = New ObservableCollection(Of IdNameStruct)( {New IdNameStruct(MCH_SAWFIN_SUB.ALONG, EgtMsg(MSG_MACHININGSDBPAGE + 146)), @@ -501,12 +507,6 @@ Public Class MachiningTreeViewItem If m_SubTypeList.Count = 0 Then m_SubTypeList.Add(New IdNameStruct(0, "")) End If - Case MCH_MY.POCKETING - m_SubTypeList = New ObservableCollection(Of IdNameStruct)( - {New IdNameStruct(MCH_POCK_SUB.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), - New IdNameStruct(MCH_POCK_SUB.ONEWAY, EgtMsg(MSG_MACHININGSDBPAGE + 143)), - New IdNameStruct(MCH_POCK_SUB.SPIRALIN, EgtMsg(MSG_MACHININGSDBPAGE + 148)), - New IdNameStruct(MCH_POCK_SUB.SPIRALOUT, EgtMsg(MSG_MACHININGSDBPAGE + 149))}) Case Else m_SubTypeList = Nothing End Select diff --git a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderViewModel.vb b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderViewModel.vb index ab4f1a5..7b00167 100644 --- a/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderViewModel.vb +++ b/ProjectPage/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderViewModel.vb @@ -347,19 +347,30 @@ Namespace EgtCAM5 Public ReadOnly Property SubTypeList As ObservableCollection(Of IdNameStruct) Get Select Case m_Type - Case MCH_MY.SAWFINISHING - m_SubTypeList = New ObservableCollection(Of IdNameStruct)( - {New IdNameStruct(MCH_SAWFIN_SUB.ALONG, EgtMsg(MSG_MACHININGSDBPAGE + 146)), - New IdNameStruct(MCH_SAWFIN_SUB.ACROSS, EgtMsg(MSG_MACHININGSDBPAGE + 147))}) Case MCH_MY.POCKETING m_SubTypeList = New ObservableCollection(Of IdNameStruct)( {New IdNameStruct(MCH_POCK_SUB.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), New IdNameStruct(MCH_POCK_SUB.ONEWAY, EgtMsg(MSG_MACHININGSDBPAGE + 143)), New IdNameStruct(MCH_POCK_SUB.SPIRALIN, EgtMsg(MSG_MACHININGSDBPAGE + 148)), New IdNameStruct(MCH_POCK_SUB.SPIRALOUT, EgtMsg(MSG_MACHININGSDBPAGE + 149))}) + Case MCH_MY.SAWFINISHING + m_SubTypeList = New ObservableCollection(Of IdNameStruct)( + {New IdNameStruct(MCH_SAWFIN_SUB.ALONG, EgtMsg(MSG_MACHININGSDBPAGE + 146)), + New IdNameStruct(MCH_SAWFIN_SUB.ACROSS, EgtMsg(MSG_MACHININGSDBPAGE + 147))}) + Case MCH_MY.GENMACHINING + Dim Index = 1 + Dim sGenScript As String = String.Empty + m_SubTypeList = New ObservableCollection(Of IdNameStruct) + While EgtUILib.GetPrivateProfileString(S_GENMACHINING, K_GENSCRIPT & Index, "", sGenScript, IniFile.m_sCurrMachIniFilePath) > 0 + m_SubTypeList.Add(New IdNameStruct(Index, sGenScript)) + Index += 1 + End While + If m_SubTypeList.Count = 0 Then + m_SubTypeList.Add(New IdNameStruct(0, "")) + End If Case Else - m_SubTypeList = Nothing - End Select + m_SubTypeList = Nothing + End Select Return m_SubTypeList End Get End Property @@ -370,14 +381,15 @@ Namespace EgtCAM5 Public Property SelectedSubType As Integer Get If IsNothing(SubTypeList) Then Return Nothing - Return IdNameStruct.IdFromInd(m_SelectedSubType, SubTypeList) + Return m_SelectedSubType End Get Set(value As Integer) If value <> m_SelectedSubType Then If Not IsNothing(SubTypeList) Then - m_SelectedSubType = IdNameStruct.IndFromId(value, SubTypeList) + m_SelectedSubType = value Dim OrigSubType As Integer = 0 EgtGetMachiningParam(MCH_MP.SUBTYPE, OrigSubType) + OrigSubType = IdNameStruct.IndFromId(OrigSubType, SubTypeList) m_IsModifiedSelectedSubType = If(value <> OrigSubType, True, False) NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") End If @@ -2225,19 +2237,11 @@ Namespace EgtCAM5 NotifyPropertyChanged("LeaveTab") m_IsModifiedLeaveTab = False EgtGetMachiningParam(MCH_MP.WORKSIDE, nValue) - If Not IsNothing(WorkSideList) Then - m_SelectedWorkSide = IdNameStruct.IndFromId(nValue, WorkSideList) - Else - m_SelectedWorkSide = nValue - End If + m_SelectedWorkSide = If(IsNothing(WorkSideList), nValue, IdNameStruct.IndFromId(nValue, WorkSideList)) NotifyPropertyChanged("SelectedWorkSide") m_IsModifiedSelectedWorkSide = False EgtGetMachiningParam(MCH_MP.HEADSIDE, nValue) - If Not IsNothing(HeadSideList) Then - m_SelectedHeadSide = IdNameStruct.IndFromId(nValue, HeadSideList) - Else - m_SelectedHeadSide = nValue - End If + m_SelectedHeadSide = If(IsNothing(HeadSideList), nValue, IdNameStruct.IndFromId(nValue, HeadSideList)) NotifyPropertyChanged("SelectedHeadSide") m_IsModifiedSelectedHeadSide = False NotifyPropertyChanged("LeadInTypeList") @@ -2260,7 +2264,8 @@ Namespace EgtCAM5 NotifyPropertyChanged("SelectedStepType") m_IsModifiedSelectedStepType = False NotifyPropertyChanged("SubTypeList") - EgtGetMachiningParam(MCH_MP.SUBTYPE, m_SelectedSubType) + EgtGetMachiningParam(MCH_MP.SUBTYPE, nValue) + m_SelectedSubType = If(IsNothing(SubTypeList), nValue, IdNameStruct.IndFromId(nValue, SubTypeList)) NotifyPropertyChanged("SelectedSubType") m_IsModifiedSelectedSubType = False NotifyPropertyChanged("LeadLinkTypeList") @@ -2432,21 +2437,13 @@ Namespace EgtCAM5 End If End If If m_IsModifiedSelectedWorkSide Then - If Not IsNothing(WorkSideList) Then - nValue = IdNameStruct.IdFromInd(m_SelectedWorkSide, WorkSideList) - Else - nValue = m_SelectedWorkSide - End If + nValue = If(IsNothing(WorkSideList), m_SelectedWorkSide, IdNameStruct.IdFromInd(m_SelectedWorkSide, WorkSideList)) If EgtSetMachiningParam(MCH_MP.WORKSIDE, nValue) Then m_IsModifiedSelectedWorkSide = False End If End If If m_IsModifiedSelectedHeadSide Then - If Not IsNothing(HeadSideList) Then - nValue = IdNameStruct.IdFromInd(m_SelectedHeadSide, HeadSideList) - Else - nValue = m_SelectedHeadSide - End If + nValue = If(IsNothing(HeadSideList), m_SelectedHeadSide, IdNameStruct.IdFromInd(m_SelectedHeadSide, HeadSideList)) If EgtSetMachiningParam(MCH_MP.HEADSIDE, nValue) Then m_IsModifiedSelectedHeadSide = False End If @@ -2477,7 +2474,8 @@ Namespace EgtCAM5 End If End If If m_IsModifiedSelectedSubType Then - If EgtSetMachiningParam(MCH_MP.SUBTYPE, m_SelectedSubType) Then + nValue = If(IsNothing(SubTypeList), m_SelectedSubType, IdNameStruct.IdFromInd(m_SelectedSubType, SubTypeList)) + If EgtSetMachiningParam(MCH_MP.SUBTYPE, nValue) Then m_IsModifiedSelectedSubType = False End If End If