Imports System.Collections.ObjectModel Imports System.ComponentModel Imports EgtUILib Imports EgtCAM5.Utility ''' ''' Class that represent a Machining in the treeview. ''' It's an element in the treeview that represent the child of familymachiningtreeviewitem, but also the class that read and write in the machining's database ''' Public Class MachiningTreeViewItem Inherits ChildItem Implements IDataErrorInfo #Region "Machining Property" Private m_Type As MCH_MY Public ReadOnly Property Type As Integer Get Return m_Type End Get End Property Private m_ErrorOnTool As Boolean Public Property ErrorOnTool As Boolean Get Return m_ErrorOnTool End Get Set(value As Boolean) If IsValid Then m_ErrorOnTool = False Application.Msn.NotifyColleagues(Application.ERRORONMACHINING, Nothing) Else m_ErrorOnTool = True Application.Msn.NotifyColleagues(Application.ERRORONMACHINING, Me) End If End Set End Property 'ObservableCollection che contiene le variabili per il combobox WorkSide Private m_WorkSideList As New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAW_WS.CENTER, EgtMsg(MSG_MACHININGSDBPAGE + 120)), New IdNameStruct(MCH_SAW_WS.LEFT, EgtMsg(MSG_MACHININGSDBPAGE + 121)), New IdNameStruct(MCH_SAW_WS.RIGHT, EgtMsg(MSG_MACHININGSDBPAGE + 122))}) Public ReadOnly Property WorkSideList As ObservableCollection(Of IdNameStruct) Get Return m_WorkSideList End Get End Property ' Proprietà che indica il WorkSide (MCH_SAW_WS) Public Property SelectedWorkSide As Integer Get Dim nWorkSide As Integer = 0 EgtMdbGetCurrMachiningParam(MCH_MP.WORKSIDE, nWorkSide) Return IdNameStruct.SearchToId(nWorkSide, WorkSideList) End Get Set(value As Integer) EgtMdbSetCurrMachiningParam(MCH_MP.WORKSIDE, IdNameStruct.SearchFromId(value, WorkSideList)) End Set End Property 'ObservableCollection che contiene le variabili per il combobox LeadLinkType Private m_LeadLinkTypeList As ObservableCollection(Of IdNameStruct) Public ReadOnly Property LeadLinkTypeList As ObservableCollection(Of IdNameStruct) Get Select Case m_Type Case MCH_MY.SAWROUGHING m_LeadLinkTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAWROU_LL.CENT, EgtMsg(MSG_MACHININGSDBPAGE + 120)), New IdNameStruct(MCH_SAWROU_LL.EXT, EgtMsg(MSG_MACHININGSDBPAGE + 123))}) Case MCH_MY.SAWFINISHING m_LeadLinkTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAWFIN_LL.STD, EgtMsg(MSG_MACHININGSDBPAGE + 124)), New IdNameStruct(MCH_SAWFIN_LL.CENT, EgtMsg(MSG_MACHININGSDBPAGE + 120)), New IdNameStruct(MCH_SAWFIN_LL.EXT, EgtMsg(MSG_MACHININGSDBPAGE + 123))}) Case Else m_LeadLinkTypeList = Nothing End Select Return m_LeadLinkTypeList End Get End Property Private m_LeadLinkTypeGetError As Boolean = False ' Proprietà che indica il LeadLinkType Public Property SelectedLeadLinkType As Integer Get If Not IsNothing(m_LeadLinkTypeList) Then Dim nLeadLinkType As Integer = 0 If EgtMdbGetCurrMachiningParam(MCH_MP.LEADLINKTYPE, nLeadLinkType) Then m_LeadLinkTypeGetError = True Else m_LeadLinkTypeGetError = False End If Return IdNameStruct.SearchToId(nLeadLinkType, m_LeadLinkTypeList) Else Return 0 End If End Get Set(value As Integer) If Not IsNothing(m_LeadLinkTypeList) Then If m_LeadLinkTypeGetError Then EgtMdbSetCurrMachiningParam(MCH_MP.LEADLINKTYPE, IdNameStruct.SearchFromId(value, m_LeadLinkTypeList)) End If End If End Set End Property ' Variabile che indica se c'è un errore nel nome della lavorazione (ad esempio nome già utilizzato) Dim bErrorMachiningName As Boolean = False Private m_IsModifiedName As Boolean = False ''' ''' Property that read and write to the machining's database the Name ''' Public Property NamePar As String Get EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim sNamePar As String = String.Empty EgtMdbGetCurrMachiningParam(MCH_MP.NAME, sNamePar) Return sNamePar End Get Set(value As String) bErrorMachiningName = False EgtSetCurrentContext(IniFile.m_ProjectSceneContext) If EgtMdbSetCurrMachiningParam(MCH_MP.NAME, value) Then Name = value Else bErrorMachiningName = True End If ' Verifico se il nome è diverso da quello nel database e imposto l'apposito flag Dim DbName As String = String.Empty EgtSetCurrentContext(IniFile.m_ProjectSceneContext) EgtMdbGetCurrMachiningParam(MCH_MP.NAME, DbName) m_IsModifiedName = If(Name <> DbName, True, False) End Set End Property ' Variabile che indica se la lavorazione è appena stata creata Dim m_NewMachining As Boolean = False Public Property NewMachining As Boolean Get Return m_NewMachining End Get Set(value As Boolean) m_NewMachining = value End Set End Property ''' ''' Property that determines if the Machining is selected or not ''' Public Overrides Property IsSelected As Boolean Get Return m_IsSelected End Get Set(value As Boolean) If (value <> m_IsSelected) Then m_IsSelected = value ' If Machining is selected, set it as current and notify all machining's property ' to refresh them values with those of the new selected machining If value Then EgtMdbSetCurrMachining(Me.Name) NotifyPropertyChanged("Type") NotifyPropertyChanged("Invert") NotifyPropertyChanged("LeaveTab") NotifyPropertyChanged("SelectedWorkSide") NotifyPropertyChanged("SelectedHeadSide") NotifyPropertyChanged("SelectedLeadInType") NotifyPropertyChanged("SelectedExtLinkType") NotifyPropertyChanged("SelectedLeadOutType") NotifyPropertyChanged("SelectedCurveUse") NotifyPropertyChanged("SelectedStepType") NotifyPropertyChanged("SelectedLeadLinkType") NotifyPropertyChanged("Speed") NotifyPropertyChanged("Feed") NotifyPropertyChanged("StartFeed") NotifyPropertyChanged("EndFeed") NotifyPropertyChanged("TipFeed") NotifyPropertyChanged("OffSr") NotifyPropertyChanged("OffSl") NotifyPropertyChanged("SideAngle") NotifyPropertyChanged("Approx") NotifyPropertyChanged("Startpos") NotifyPropertyChanged("StartSlowLen") NotifyPropertyChanged("EndSlowLen") NotifyPropertyChanged("ThrouAddLen") NotifyPropertyChanged("StepPar") NotifyPropertyChanged("ReturnPos") NotifyPropertyChanged("TabLen") NotifyPropertyChanged("TabDist") NotifyPropertyChanged("Tabheight") NotifyPropertyChanged("TabAngle") NotifyPropertyChanged("LiTang") NotifyPropertyChanged("LiPerp") NotifyPropertyChanged("LiElev") NotifyPropertyChanged("LiCompLen") NotifyPropertyChanged("LoTang") NotifyPropertyChanged("LoPerp") NotifyPropertyChanged("LoElev") NotifyPropertyChanged("LoCompLen") NotifyPropertyChanged("StartAddlen") NotifyPropertyChanged("EndAddlen") NotifyPropertyChanged("StepExtArc") NotifyPropertyChanged("StepIntArc") NotifyPropertyChanged("SideStep") NotifyPropertyChanged("VertFeed") NotifyPropertyChanged("NamePar") NotifyPropertyChanged("SelectedTool") NotifyPropertyChanged("DepthStr") NotifyPropertyChanged("UserNotes") NotifyPropertyChanged("OverLapStr") NotifyPropertyChanged("OffsetStr") ' Otherwhise Tool is deselected, so it and the database will be saved to ' keep the modify effective Else If EgtMdbIsCurrMachiningModified() And Me.IsValid Or Me.NewMachining Then Select Case MsgBox(EgtMsg(MSG_MACHININGSERRORS + 30), MsgBoxStyle.YesNo, EgtMsg(MSG_MACHININGSERRORS + 31)) Case MsgBoxResult.Yes Name = Name.Trim m_NewMachining = False EgtMdbSaveCurrMachining() EgtMdbSave() Case MsgBoxResult.No If m_NewMachining Then Application.Msn.NotifyColleagues(Application.REMOVEMACHINING, Me) End If End Select End If End If End If End Set End Property ''' ''' Property that read and write to the Machining's database the Invert ''' Public Property Invert As Boolean Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim bInvert As Boolean = False EgtMdbGetCurrMachiningParam(MCH_MP.INVERT, bInvert) Return bInvert End Get Set(value As Boolean) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) EgtMdbSetCurrMachiningParam(MCH_MP.INVERT, value) End Set End Property ''' ''' Property that read and write to the Machining's database the Leave Tab ''' Public Property LeaveTab As Boolean Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim bLeaveTab As Boolean = False EgtMdbGetCurrMachiningParam(MCH_MP.LEAVETAB, bLeaveTab) Return bLeaveTab End Get Set(value As Boolean) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) EgtMdbSetCurrMachiningParam(MCH_MP.LEAVETAB, value) End Set End Property 'ObservableCollection che contiene le variabili per il combobox HeadSide Private m_HeadSideList As New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAW_HS.LEFT, EgtMsg(MSG_MACHININGSDBPAGE + 121)), New IdNameStruct(MCH_SAW_HS.RIGHT, EgtMsg(MSG_MACHININGSDBPAGE + 122))}) Public ReadOnly Property HeadSideList As ObservableCollection(Of IdNameStruct) Get Return m_HeadSideList End Get End Property ' Proprietà che indica il HeadSide (MCH_SAW_HS) Public Property SelectedHeadSide As Integer Get Dim nHeadSide As Integer = 0 EgtMdbGetCurrMachiningParam(MCH_MP.HEADSIDE, nHeadSide) Return IdNameStruct.SearchToId(nHeadSide, HeadSideList) End Get Set(value As Integer) EgtMdbSetCurrMachiningParam(MCH_MP.HEADSIDE, IdNameStruct.SearchFromId(value, HeadSideList)) End Set End Property 'ObservableCollection che contiene le variabili per il combobox LeadInType Private m_LeadInTypeList As ObservableCollection(Of IdNameStruct) Public ReadOnly Property LeadInTypeList As ObservableCollection(Of IdNameStruct) Get Select Case m_Type Case MCH_MY.SAWING m_LeadInTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAW_LI.CENT, EgtMsg(MSG_MACHININGSDBPAGE + 120)), New IdNameStruct(MCH_SAW_LI.STRICT, EgtMsg(MSG_MACHININGSDBPAGE + 125)), New IdNameStruct(MCH_SAW_LI.OUT, EgtMsg(MSG_MACHININGSDBPAGE + 126)), New IdNameStruct(MCH_SAW_LI.EXT_CENT, EgtMsg(MSG_MACHININGSDBPAGE + 127)), New IdNameStruct(MCH_SAW_LI.EXT_OUT, EgtMsg(MSG_MACHININGSDBPAGE + 128))}) Case MCH_MY.MILLING m_LeadInTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_MIL_LI.NONE, EgtMsg(MSG_MACHININGSDBPAGE + 129)), New IdNameStruct(MCH_MIL_LI.LINEAR, EgtMsg(MSG_MACHININGSDBPAGE + 130)), New IdNameStruct(MCH_MIL_LI.TANGENT, EgtMsg(MSG_MACHININGSDBPAGE + 131)), New IdNameStruct(MCH_MIL_LI.GLIDE, EgtMsg(MSG_MACHININGSDBPAGE + 132)), New IdNameStruct(MCH_MIL_LI.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), New IdNameStruct(MCH_MIL_LI.HELIX, EgtMsg(MSG_MACHININGSDBPAGE + 133))}) Case Else m_LeadInTypeList = Nothing End Select Return m_LeadInTypeList End Get End Property Private m_LeadInTypeGetError As Boolean = False ' Proprietà che indica il LeadInType Public Property SelectedLeadInType As Integer Get If Not IsNothing(m_LeadInTypeList) Then Dim nLeadInType As Integer = 0 If EgtMdbGetCurrMachiningParam(MCH_MP.LEADINTYPE, nLeadInType) Then m_LeadInTypeGetError = True Else m_LeadInTypeGetError = False End If Return IdNameStruct.SearchToId(nLeadInType, m_LeadInTypeList) Else Return 0 End If End Get Set(value As Integer) If Not IsNothing(m_LeadInTypeList) Then If m_LeadInTypeGetError Then EgtMdbSetCurrMachiningParam(MCH_MP.LEADINTYPE, IdNameStruct.SearchFromId(value, m_LeadInTypeList)) End If End If End Set End Property 'ObservableCollection che contiene le variabili per il combobox ExtLinkType Private m_ExtLinkTypeList As New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAW_EL.CENT, EgtMsg(MSG_MACHININGSDBPAGE + 120)), New IdNameStruct(MCH_SAW_EL.EXT_PREV, EgtMsg(MSG_MACHININGSDBPAGE + 134)), New IdNameStruct(MCH_SAW_EL.EXT_NEXT, EgtMsg(MSG_MACHININGSDBPAGE + 135)), New IdNameStruct(MCH_SAW_EL.EXT_BOTH, EgtMsg(MSG_MACHININGSDBPAGE + 136))}) Public ReadOnly Property ExtLinkTypeList As ObservableCollection(Of IdNameStruct) Get Return m_ExtLinkTypeList End Get End Property ' Proprietà che indica il ExtLinkType (MCH_SAW_EL) Public Property SelectedExtLinkType As Integer Get Dim nExtLinkType As Integer = 0 EgtMdbGetCurrMachiningParam(MCH_MP.EXTLINKTYPE, nExtLinkType) Return IdNameStruct.SearchToId(nExtLinkType, ExtLinkTypeList) End Get Set(value As Integer) EgtMdbSetCurrMachiningParam(MCH_MP.EXTLINKTYPE, IdNameStruct.SearchFromId(value, ExtLinkTypeList)) End Set End Property 'ObservableCollection che contiene le variabili per il combobox LeadOutType Private m_LeadOutTypeList As ObservableCollection(Of IdNameStruct) Public ReadOnly Property LeadOutTypeList As ObservableCollection(Of IdNameStruct) Get Select Case m_Type Case MCH_MY.SAWING m_LeadOutTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAW_LO.CENT, EgtMsg(MSG_MACHININGSDBPAGE + 120)), New IdNameStruct(MCH_SAW_LO.STRICT, EgtMsg(MSG_MACHININGSDBPAGE + 125)), New IdNameStruct(MCH_SAW_LO.EXT, EgtMsg(MSG_MACHININGSDBPAGE + 123))}) Case MCH_MY.MILLING m_LeadOutTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_MIL_LO.NONE, EgtMsg(MSG_MACHININGSDBPAGE + 129)), New IdNameStruct(MCH_MIL_LO.LINEAR, EgtMsg(MSG_MACHININGSDBPAGE + 130)), New IdNameStruct(MCH_MIL_LO.TANGENT, EgtMsg(MSG_MACHININGSDBPAGE + 131)), New IdNameStruct(MCH_MIL_LO.GLIDE, EgtMsg(MSG_MACHININGSDBPAGE + 132)), New IdNameStruct(MCH_MIL_LO.AS_LI, EgtMsg(MSG_MACHININGSDBPAGE + 137))}) Case Else m_LeadOutTypeList = Nothing End Select Return m_LeadOutTypeList End Get End Property Private m_LeadOutTypeGetError As Boolean = False ' Proprietà che indica il LeadOutType Public Property SelectedLeadOutType As Integer Get If Not IsNothing(m_LeadOutTypeList) Then Dim nLeadOutType As Integer = 0 If EgtMdbGetCurrMachiningParam(MCH_MP.LEADOUTTYPE, nLeadOutType) Then m_LeadOutTypeGetError = True Else m_LeadOutTypeGetError = False End If Return IdNameStruct.SearchToId(nLeadOutType, m_LeadOutTypeList) Else Return 0 End If End Get Set(value As Integer) If Not IsNothing(m_LeadOutTypeList) Then If m_LeadOutTypeGetError Then EgtMdbSetCurrMachiningParam(MCH_MP.LEADOUTTYPE, IdNameStruct.SearchFromId(value, m_LeadOutTypeList)) End If End If End Set End Property 'ObservableCollection che contiene le variabili per il combobox CurveUse Private m_CurveUseList As New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAW_CU.SKIP, EgtMsg(MSG_MACHININGSDBPAGE + 138)), New IdNameStruct(MCH_SAW_CU.APPROX, EgtMsg(MSG_MACHININGSDBPAGE + 139)), New IdNameStruct(MCH_SAW_CU.CONVEX, EgtMsg(MSG_MACHININGSDBPAGE + 140)), New IdNameStruct(MCH_SAW_CU.KEEP, EgtMsg(MSG_MACHININGSDBPAGE + 141))}) Public ReadOnly Property CurveUseList As ObservableCollection(Of IdNameStruct) Get Return m_CurveUseList End Get End Property ' Proprietà che indica il CurveUse (MCH_SAW_CU) Public Property SelectedCurveUse As Integer Get Dim nCurveUse As Integer = 0 EgtMdbGetCurrMachiningParam(MCH_MP.CURVEUSE, nCurveUse) Return IdNameStruct.SearchToId(nCurveUse, CurveUseList) End Get Set(value As Integer) EgtMdbSetCurrMachiningParam(MCH_MP.CURVEUSE, IdNameStruct.SearchFromId(value, CurveUseList)) End Set End Property 'ObservableCollection che contiene le variabili per il combobox StepType Private m_StepTypeList As ObservableCollection(Of IdNameStruct) Public ReadOnly Property StepTypeList As ObservableCollection(Of IdNameStruct) Get Select Case m_Type Case MCH_MY.SAWING m_StepTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAW_ST.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), New IdNameStruct(MCH_SAW_ST.ONEWAY, EgtMsg(MSG_MACHININGSDBPAGE + 143)), New IdNameStruct(MCH_SAW_ST.TOANDFROM, EgtMsg(MSG_MACHININGSDBPAGE + 145))}) Case MCH_MY.MILLING m_StepTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_MIL_ST.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), New IdNameStruct(MCH_MIL_ST.ONEWAY, EgtMsg(MSG_MACHININGSDBPAGE + 143)), New IdNameStruct(MCH_MIL_ST.SPIRAL, EgtMsg(MSG_MACHININGSDBPAGE + 144))}) Case MCH_MY.SAWROUGHING, MCH_MY.SAWFINISHING m_StepTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAWROU_ST.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), New IdNameStruct(MCH_SAWROU_ST.ONEWAY, EgtMsg(MSG_MACHININGSDBPAGE + 143))}) Case Else m_StepTypeList = Nothing End Select Return m_StepTypeList End Get End Property Private m_StepTypeGetError As Boolean = False ' Proprietà che indica il StepType Public Property SelectedStepType As Integer Get If Not IsNothing(m_StepTypeList) Then Dim nStepType As Integer = 0 If EgtMdbGetCurrMachiningParam(MCH_MP.STEPTYPE, nStepType) Then m_StepTypeGetError = True Else m_StepTypeGetError = False End If Return IdNameStruct.SearchToId(nStepType, m_StepTypeList) Else Return 0 End If End Get Set(value As Integer) If Not IsNothing(m_StepTypeList) Then If m_StepTypeGetError Then EgtMdbSetCurrMachiningParam(MCH_MP.STEPTYPE, IdNameStruct.SearchFromId(value, m_StepTypeList)) End If End If End Set End Property Dim m_Speed As Double ''' ''' Property that read and write to the Machining's database the Speed ''' Public Property Speed As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dSpeed As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.SPEED, dSpeed) Return LenToString(dSpeed, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dSpeed As Double = 0 StringToLen(value, dSpeed) m_Speed = dSpeed EgtMdbSetCurrMachiningParam(MCH_MP.SPEED, dSpeed) End Set End Property ''' ''' Property that read and write to the Machining's database the Feed ''' Public Property Feed As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dFeed As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.FEED, dFeed) Return LenToString(dFeed, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dFeed As Double = 0 StringToLen(value, dFeed) EgtMdbSetCurrMachiningParam(MCH_MP.FEED, dFeed) End Set End Property ''' ''' Property that read and write to the Machining's database the Start Feed ''' Public Property StartFeed As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dStartFeed As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.STARTFEED, dStartFeed) Return LenToString(dStartFeed, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dStartFeed As Double = 0 StringToLen(value, dStartFeed) EgtMdbSetCurrMachiningParam(MCH_MP.STARTFEED, dStartFeed) End Set End Property ''' ''' Property that read and write to the Machining's database the End Feed ''' Public Property EndFeed As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dEndFeed As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.ENDFEED, dEndFeed) Return LenToString(dEndFeed, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dEndFeed As Double = 0 StringToLen(value, dEndFeed) EgtMdbSetCurrMachiningParam(MCH_MP.ENDFEED, dEndFeed) End Set End Property ''' ''' Property that read and write to the Machining's database the Tip Feed ''' Public Property TipFeed As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dTipFeed As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.TIPFEED, dTipFeed) Return LenToString(dTipFeed, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dTipFeed As Double = 0 StringToLen(value, dTipFeed) EgtMdbSetCurrMachiningParam(MCH_MP.TIPFEED, dTipFeed) End Set End Property ''' ''' Property that read and write to the Machining's database the Offset Sr ''' Public Property OffSr As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dOffSr As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.OFFSR, dOffSr) Return LenToString(dOffSr, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dOffSr As Double = 0 StringToLen(value, dOffSr) EgtMdbSetCurrMachiningParam(MCH_MP.OFFSR, dOffSr) End Set End Property ''' ''' Property that read and write to the Machining's database the Offset Sl ''' Public Property OffSl As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dOffSl As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.OFFSL, dOffSl) Return LenToString(dOffSl, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dOffSl As Double = 0 StringToLen(value, dOffSl) EgtMdbSetCurrMachiningParam(MCH_MP.OFFSL, dOffSl) End Set End Property ''' ''' Property that read and write to the Machining's database the Side Angle ''' Public Property SideAngle As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dSideAngle As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.SIDEANGLE, dSideAngle) Return LenToString(dSideAngle, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dSideAngle As Double = 0 StringToLen(value, dSideAngle) EgtMdbSetCurrMachiningParam(MCH_MP.SIDEANGLE, dSideAngle) End Set End Property ''' ''' Property that read and write to the Machining's database the Approx ''' Public Property Approx As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dApprox As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.APPROX, dApprox) Return LenToString(dApprox, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dApprox As Double = 0 StringToLen(value, dApprox) EgtMdbSetCurrMachiningParam(MCH_MP.APPROX, dApprox) End Set End Property ''' ''' Property that read and write to the Machining's database the Start Position ''' Public Property StartPos As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dStartPos As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.STARTPOS, dStartPos) Return LenToString(dStartPos, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dStartPos As Double = 0 StringToLen(value, dStartPos) EgtMdbSetCurrMachiningParam(MCH_MP.STARTPOS, dStartPos) End Set End Property ''' ''' Property that read and write to the Machining's database the Start Slow Len ''' Public Property StartSlowLen As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dStartSlowLen As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.STARTSLOWLEN, dStartSlowLen) Return LenToString(dStartSlowLen, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dStartSlowLen As Double = 0 StringToLen(value, dStartSlowLen) EgtMdbSetCurrMachiningParam(MCH_MP.STARTSLOWLEN, dStartSlowLen) End Set End Property ''' ''' Property that read and write to the Machining's database the End Slow Len ''' Public Property EndSlowLen As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dEndSlowLen As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.ENDSLOWLEN, dEndSlowLen) Return LenToString(dEndSlowLen, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dEndSlowLen As Double = 0 StringToLen(value, dEndSlowLen) EgtMdbSetCurrMachiningParam(MCH_MP.ENDSLOWLEN, dEndSlowLen) End Set End Property ''' ''' Property that read and write to the Machining's database the Throu Add Len ''' Public Property ThrouAddLen As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dThrouAddLen As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.THROUADDLEN, dThrouAddLen) Return LenToString(dThrouAddLen, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dThrouAddLen As Double = 0 StringToLen(value, dThrouAddLen) EgtMdbSetCurrMachiningParam(MCH_MP.THROUADDLEN, dThrouAddLen) End Set End Property ''' ''' Property that read and write to the Machining's database the Step Par ''' Public Property StepPar As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dStepPar As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.STEP_, dStepPar) Return LenToString(dStepPar, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dStepPar As Double = 0 StringToLen(value, dStepPar) EgtMdbSetCurrMachiningParam(MCH_MP.STEP_, dStepPar) End Set End Property ''' ''' Property that read and write to the Machining's database the Return Position ''' Public Property ReturnPos As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dReturnpPos As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.RETURNPOS, dReturnpPos) Return LenToString(dReturnpPos, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dReturnpPos As Double = 0 StringToLen(value, dReturnpPos) EgtMdbSetCurrMachiningParam(MCH_MP.RETURNPOS, dReturnpPos) End Set End Property ''' ''' Property that read and write to the Machining's database the Tab Len ''' Public Property TabLen As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dTabLen As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.TABLEN, dTabLen) Return LenToString(dTabLen, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dTabLen As Double = 0 StringToLen(value, dTabLen) EgtMdbSetCurrMachiningParam(MCH_MP.TABLEN, dTabLen) End Set End Property ''' ''' Property that read and write to the Machining's database the Tab Dist ''' Public Property TabDist As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dTabDist As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.TABDIST, dTabDist) Return LenToString(dTabDist, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dTabDist As Double = 0 StringToLen(value, dTabDist) EgtMdbSetCurrMachiningParam(MCH_MP.TABDIST, dTabDist) End Set End Property ''' ''' Property that read and write to the Machining's database the Tab Height ''' Public Property TabHeight As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dTabHeight As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.TABHEIGHT, dTabHeight) Return LenToString(dTabHeight, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dTabHeight As Double = 0 StringToLen(value, dTabHeight) EgtMdbSetCurrMachiningParam(MCH_MP.TABHEIGHT, dTabHeight) End Set End Property ''' ''' Property that read and write to the Machining's database the Tab Angle ''' Public Property TabAngle As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dTabAngle As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.TABANGLE, dTabAngle) Return LenToString(dTabAngle, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dTabAngle As Double = 0 StringToLen(value, dTabAngle) EgtMdbSetCurrMachiningParam(MCH_MP.TABANGLE, dTabAngle) End Set End Property ''' ''' Property that read and write to the Machining's database the Li Tang ''' Public Property LiTang As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dLiTang As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.LITANG, dLiTang) Return LenToString(dLiTang, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dLiTang As Double = 0 StringToLen(value, dLiTang) EgtMdbSetCurrMachiningParam(MCH_MP.LITANG, dLiTang) End Set End Property ''' ''' Property that read and write to the Machining's database the Li Perp ''' Public Property LiPerp As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dLiPerp As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.LIPERP, dLiPerp) Return LenToString(dLiPerp, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dLiPerp As Double = 0 StringToLen(value, dLiPerp) EgtMdbSetCurrMachiningParam(MCH_MP.LIPERP, dLiPerp) End Set End Property ''' ''' Property that read and write to the Machining's database the Li Elev ''' Public Property LiElev As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dLiElev As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.LIELEV, dLiElev) Return LenToString(dLiElev, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dLiElev As Double = 0 StringToLen(value, dLiElev) EgtMdbSetCurrMachiningParam(MCH_MP.LIELEV, dLiElev) End Set End Property ''' ''' Property that read and write to the Machining's database the Li Comp Len ''' Public Property LiCompLen As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dLiCompLen As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.LICOMPLEN, dLiCompLen) Return LenToString(dLiCompLen, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dLiCompLen As Double = 0 StringToLen(value, dLiCompLen) EgtMdbSetCurrMachiningParam(MCH_MP.LICOMPLEN, dLiCompLen) End Set End Property ''' ''' Property that read and write to the Machining's database the Lo Tang ''' Public Property LoTang As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dLoTang As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.LOTANG, dLoTang) Return LenToString(dLoTang, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dLoTang As Double = 0 StringToLen(value, dLoTang) EgtMdbSetCurrMachiningParam(MCH_MP.LOTANG, dLoTang) End Set End Property ''' ''' Property that read and write to the Machining's database the Lo Perp ''' Public Property LoPerp As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dLoPerp As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.LOPERP, dLoPerp) Return LenToString(dLoPerp, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dLoPerp As Double = 0 StringToLen(value, dLoPerp) EgtMdbSetCurrMachiningParam(MCH_MP.LOPERP, dLoPerp) End Set End Property ''' ''' Property that read and write to the Machining's database the Lo Elev ''' Public Property LoElev As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dLoElev As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.LOELEV, dLoElev) Return LenToString(dLoElev, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dLoElev As Double = 0 StringToLen(value, dLoElev) EgtMdbSetCurrMachiningParam(MCH_MP.LOELEV, dLoElev) End Set End Property ''' ''' Property that read and write to the Machining's database the Lo Comp Len ''' Public Property LoCompLen As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dLoCompLen As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.LOCOMPLEN, dLoCompLen) Return LenToString(dLoCompLen, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dLoCompLen As Double = 0 StringToLen(value, dLoCompLen) EgtMdbSetCurrMachiningParam(MCH_MP.LOCOMPLEN, dLoCompLen) End Set End Property ''' ''' Property that read and write to the Machining's database the Start Add Len ''' Public Property StartAddLen As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dStartAddLen As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.STARTADDLEN, dStartAddLen) Return LenToString(dStartAddLen, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dStartAddLen As Double = 0 StringToLen(value, dStartAddLen) EgtMdbSetCurrMachiningParam(MCH_MP.STARTADDLEN, dStartAddLen) End Set End Property ''' ''' Property that read and write to the Machining's database the End Add Len ''' Public Property EndAddLen As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dEndAddLen As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.ENDADDLEN, dEndAddLen) Return LenToString(dEndAddLen, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dEndAddLen As Double = 0 StringToLen(value, dEndAddLen) EgtMdbSetCurrMachiningParam(MCH_MP.ENDADDLEN, dEndAddLen) End Set End Property ''' ''' Property that read and write to the Machining's database the Step Ext Arc ''' Public Property StepExtArc As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dStepExtArc As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.STEPEXTARC, dStepExtArc) Return LenToString(dStepExtArc, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dStepExtArc As Double = 0 StringToLen(value, dStepExtArc) EgtMdbSetCurrMachiningParam(MCH_MP.STEPEXTARC, dStepExtArc) End Set End Property ''' ''' Property that read and write to the Machining's database the Step Int Arc ''' Public Property StepIntArc As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dStepIntArc As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.STEPINTARC, dStepIntArc) Return LenToString(dStepIntArc, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dStepIntArc As Double = 0 StringToLen(value, dStepIntArc) EgtMdbSetCurrMachiningParam(MCH_MP.STEPINTARC, dStepIntArc) End Set End Property ''' ''' Property that read and write to the Machining's database the Side Step ''' Public Property SideStep As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dSideStep As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.SIDESTEP, dSideStep) Return LenToString(dSideStep, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dSideStep As Double = 0 StringToLen(value, dSideStep) EgtMdbSetCurrMachiningParam(MCH_MP.SIDESTEP, dSideStep) End Set End Property ''' ''' Property that read and write to the Machining's database the Vert Feed ''' Public Property VertFeed As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dVertFeed As Double = 0 EgtMdbGetCurrMachiningParam(MCH_MP.VERTFEED, dVertFeed) Return LenToString(dVertFeed, 3) End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim dVertFeed As Double = 0 StringToLen(value, dVertFeed) EgtMdbSetCurrMachiningParam(MCH_MP.VERTFEED, dVertFeed) End Set End Property ''' ''' ObservableCollection che contiene le variabili per il combobox Tool ''' Private m_ToolList As ObservableCollection(Of String) Public ReadOnly Property ToolList As ObservableCollection(Of String) Get Select Case m_Type Case MCH_MY.DRILLING m_ToolList = New ObservableCollection(Of String) FindToolByType(MCH_TY.DRILL_STD, m_ToolList) FindToolByType(MCH_TY.DRILL_LONG, m_ToolList) FindToolByType(MCH_TY.MILL_STD, m_ToolList) Case MCH_MY.SAWING, MCH_MY.SAWROUGHING, MCH_MY.SAWFINISHING m_ToolList = New ObservableCollection(Of String) FindToolByType(MCH_TY.SAW_STD, m_ToolList) FindToolByType(MCH_TY.SAW_FLAT, m_ToolList) Case MCH_MY.MILLING m_ToolList = New ObservableCollection(Of String) FindToolByType(MCH_TY.SAW_STD, m_ToolList) FindToolByType(MCH_TY.SAW_FLAT, m_ToolList) FindToolByType(MCH_TY.MILL_STD, m_ToolList) FindToolByType(MCH_TY.MILL_NOTIP, m_ToolList) FindToolByType(MCH_TY.COMPO, m_ToolList) Case MCH_MY.POCKETING m_ToolList = New ObservableCollection(Of String) FindToolByType(MCH_TY.MILL_STD, m_ToolList) FindToolByType(MCH_TY.MILL_NOTIP, m_ToolList) Case MCH_MY.MORTISING m_ToolList = New ObservableCollection(Of String) FindToolByType(MCH_TY.MORTISE_STD, m_ToolList) Case Else m_ToolList = Nothing End Select Return m_ToolList End Get End Property ''' ''' Method that search all tools in Db of a specified type ''' Private Sub FindToolByType(ToolType As MCH_TY, ToolList As ObservableCollection(Of String)) Dim nType As Integer = 0 Dim ToolName As String = String.Empty If EgtTdbGetFirstTool(ToolType, ToolName, nType) Then If nType = ToolType Then ToolList.Add(ToolName) While EgtTdbGetNextTool(ToolType, ToolName, nType) If nType = ToolType Then ToolList.Add(ToolName) End While End If End Sub ''' ''' Property that read and write to the Machining's database the Tool ''' Public Property SelectedTool As Integer Get Dim nUUID As String = String.Empty Dim sName As String = String.Empty EgtMdbGetCurrMachiningParam(MCH_MP.TUUID, nUUID) EgtTdbGetToolFromUUID(nUUID, sName) For i = 0 To ToolList.Count - 1 If ToolList(i) = sName Then Return i End If Next Return 0 End Get Set(value As Integer) EgtMdbSetCurrMachiningParam(MCH_MP.TOOL, ToolList(value)) End Set End Property ''' ''' Property that read and write to the Machining's database the Depth Str ''' Public Property DepthStr As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim sDepthStr As String = String.Empty EgtMdbGetCurrMachiningParam(MCH_MP.DEPTH_STR, sDepthStr) Return sDepthStr End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) EgtMdbSetCurrMachiningParam(MCH_MP.DEPTH_STR, value) End Set End Property ''' ''' Property that read and write to the Machining's database the User Notes ''' Public Property UserNotes As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim sUserNotes As String = String.Empty EgtMdbGetCurrMachiningParam(MCH_MP.USERNOTES, sUserNotes) Return sUserNotes End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) EgtMdbSetCurrMachiningParam(MCH_MP.USERNOTES, value) End Set End Property ''' ''' Property that read and write to the Machining's database the Over Lap Str ''' Public Property OverLapStr As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim sOverLapStr As String = String.Empty EgtMdbGetCurrMachiningParam(MCH_MP.OVERLAP_STR, sOverLapStr) Return sOverLapStr End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) EgtMdbSetCurrMachiningParam(MCH_MP.OVERLAP_STR, value) End Set End Property ''' ''' Property that read and write to the Machining's database the Offset Str ''' Public Property OffsetStr As String Get 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim sOffsetStr As String = String.Empty EgtMdbGetCurrMachiningParam(MCH_MP.OFFSET_STR, sOffsetStr) Return sOffsetStr End Get Set(value As String) 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) EgtMdbSetCurrMachiningParam(MCH_MP.OFFSET_STR, value) End Set End Property 'ObservableCollection che contiene le variabili per il combobox SubType Private m_SubTypeList As ObservableCollection(Of IdNameStruct) 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.DRILLING m_SubTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(0, "Prova 1"), New IdNameStruct(1, "Prova 2")}) Case Else m_SubTypeList = Nothing End Select Return m_SubTypeList End Get End Property Private m_SubTypeGetError As Boolean = False ' Proprietà che indica il SubType Public Property SelectedSubType As Integer Get If Not IsNothing(m_SubTypeList) Then Dim nSubType As Integer = 0 If EgtMdbGetCurrMachiningParam(MCH_MP.SUBTYPE, nSubType) Then m_SubTypeGetError = True Else m_SubTypeGetError = False End If Return IdNameStruct.SearchToId(nSubType, m_SubTypeList) Else Return 0 End If End Get Set(value As Integer) If Not IsNothing(m_SubTypeList) Then If m_SubTypeGetError Then EgtMdbSetCurrMachiningParam(MCH_MP.SUBTYPE, IdNameStruct.SearchFromId(value, m_SubTypeList)) End If End If End Set End Property #End Region ' Machining Property #Region "Constructors" Sub New(Name As String, Type As MCH_MY) MyBase.New(Name) Me.m_Type = Type End Sub Sub New(Name As String, IsSelected As Boolean, IsExpanded As Boolean, IsActive As Boolean) MyBase.New(Name, IsSelected, IsExpanded, IsActive) End Sub #End Region ' Constructors #Region "IDataErrorInfo Members" Private ReadOnly Property IDataErrorInfo_Error() As String Implements IDataErrorInfo.Error Get Return Nothing End Get End Property Public ReadOnly Property IDataErrorInfo_Item(ByVal propertyName As String) As String Implements IDataErrorInfo.Item Get ErrorOnTool = True Return Me.GetValidationError(propertyName) End Get End Property #End Region ' IDataErrorInfo Members #Region "Validation" ''' ''' Returns true if this object has no validation errors. ''' Public ReadOnly Property IsValid() As Boolean Get For Each [property] As String In ValidatedProperties If GetValidationError([property]) IsNot Nothing Then Return False End If Next [property] Return True End Get End Property Private Shared ReadOnly ValidatedProperties() As String = {"Speed", "NamePar"} Private Function GetValidationError(ByVal propertyName As String) As String If Array.IndexOf(ValidatedProperties, propertyName) < 0 Then Return Nothing End If Dim [error] As String = Nothing Select Case propertyName Case "Speed" [error] = Me.ValidateSpeed() Case "NamePar" [error] = Me.ValidateName() Case Else 'Debug.Fail("Unexpected property being validated on Tool: " & propertyName) End Select Return [error] End Function Private Function ValidateSpeed() As String 'Dim MaxSpeed As Double '' Da leggere dall'utensile impostato per questa lavorazione 'If m_Speed > m_MaxSpeed Then ' Return "Il valore di Speed non può essere maggiore di quello di MaxSpeed" 'End If Return Nothing End Function Private Function ValidateName() As String If bErrorMachiningName Then Return EgtMsg(MSG_MACHININGSERRORS + 2) End If Return Nothing End Function #End Region ' Validation End Class ''' ''' Class that represent a FamilyMachining in the treeview. ''' It's an element in the treeview that represent a folder, but also a machining family ''' Public Class FamilyMachiningTreeViewItem Inherits ParentItem Private m_MachiningType As MCH_MY ''' ''' Property that determines the machining type of the family ''' Public Property MachiningType As MCH_MY Get Return m_MachiningType End Get Set(value As MCH_MY) m_MachiningType = value End Set End Property ''' ''' Property that determines if the Machining is selected or not ''' Public Overrides Property IsSelected As Boolean Get Return m_IsSelected End Get Set(value As Boolean) If (value <> m_IsSelected) Then m_IsSelected = value End If End Set End Property ' Proprietà che permette di nascondere tutti i parametri di lavorazione grazie al binding ed al converter Public ReadOnly Property Type As Integer Get Return MCH_MY.NONE End Get End Property ''' ''' Constructor that receive the name of the FamilyMachiningTreeViewItem, the MachiningType, and set ''' the picture(Folder.png) ''' Sub New(Name As String, MachiningType As MCH_MY) MyBase.New(Name) Me.MachiningType = MachiningType Me.PictureString = "/Resources/TreeView/Folder.png" End Sub Sub New(Name As String, PicturePath As String) MyBase.New(Name) Me.PictureString = PicturePath End Sub Sub New(Name As String, IsSelected As Boolean, IsExpanded As Boolean, IsActive As Boolean) MyBase.New(Name, IsSelected, IsExpanded, IsActive) End Sub End Class ''' ''' Class that represent a Converter that use machining type and param type, to set the visibility state of the param type. ''' Public Class MachiningParamVisibilityConverter Implements IValueConverter Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert Select Case CInt(value) Case MCH_MY.NONE Return Visibility.Hidden Case MCH_MY.DRILLING Return SharedFieldsClass.Drilling(CInt(parameter)) Case MCH_MY.SAWING Return SharedFieldsClass.Sawing(CInt(parameter)) Case MCH_MY.MILLING Return SharedFieldsClass.Milling(CInt(parameter)) Case MCH_MY.POCKETING Return SharedFieldsClass.Pocketing(CInt(parameter)) Case MCH_MY.MORTISING Return SharedFieldsClass.Mortising(CInt(parameter)) Case MCH_MY.SAWROUGHING Return SharedFieldsClass.Sawroughing(CInt(parameter)) Case MCH_MY.SAWFINISHING Return SharedFieldsClass.Sawfinishing(CInt(parameter)) Case Else Return Visibility.Hidden End Select End Function Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack Throw New NotImplementedException End Function End Class