Imports System.ComponentModel Imports System.Collections.ObjectModel Imports EgtUILib Public Class OperationListBoxItem Implements INotifyPropertyChanged Private m_Type As Integer Public ReadOnly Property Type As Integer Get Return m_Type End Get End Property Private m_Id As Integer Public Property Id As Integer Get Return m_Id End Get Set(value As Integer) m_Id = value End Set End Property Private m_Name As String Public Property Name As String Get Return m_Name End Get Set(value As String) m_Name = value End Set End Property Private m_Image As String Public Property Image As String Get Return m_Image End Get Set(value As String) m_Image = value End Set End Property Private m_Tool As String Public Property Tool As String Get Return m_Tool End Get Set(value As String) m_Tool = value End Set End Property Public Property Invert As Boolean Get Dim bInvert As Boolean = False EgtGetMachiningParam(MCH_MP.INVERT, bInvert) Return bInvert End Get Set(value As Boolean) EgtSetMachiningParam(MCH_MP.INVERT, value) End Set End Property Public Property Depth As String Get Dim sDepth As String = String.Empty EgtGetMachiningParam(MCH_MP.DEPTH_STR, sDepth) Return sDepth End Get Set(value As String) EgtSetMachiningParam(MCH_MP.DEPTH_STR, value) 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 EgtGetMachiningParam(MCH_MP.WORKSIDE, nWorkSide) Return IdNameStruct.SearchToId(nWorkSide, WorkSideList) End Get Set(value As Integer) EgtSetMachiningParam(MCH_MP.WORKSIDE, IdNameStruct.SearchFromId(value, WorkSideList)) End Set End Property Public Property StartPos As String Get Dim dStartPos As Double = 0 EgtGetMachiningParam(MCH_MP.STARTPOS, dStartPos) Return LenToString(dStartPos, 3) End Get Set(value As String) Dim dStartPos As Double = 0 StringToLen(value, dStartPos) EgtSetMachiningParam(MCH_MP.STARTPOS, dStartPos) End Set End Property Public Property OverLap As String Get Dim sOverLap As String = String.Empty Dim x = EgtGetMachiningParam(MCH_MP.OVERLAP_STR, sOverLap) Return sOverLap End Get Set(value As String) EgtSetMachiningParam(MCH_MP.OVERLAP_STR, value) End Set End Property Public Property ThrouAddLen As String Get Dim dThrouAddLen As Double = 0 EgtGetMachiningParam(MCH_MP.THROUADDLEN, dThrouAddLen) Return LenToString(dThrouAddLen, 3) End Get Set(value As String) Dim dThrouAddLen As Double = 0 StringToLen(value, dThrouAddLen) EgtSetMachiningParam(MCH_MP.THROUADDLEN, dThrouAddLen) 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 EgtGetMachiningParam(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 EgtSetMachiningParam(MCH_MP.STEPTYPE, IdNameStruct.SearchFromId(value, m_StepTypeList)) End If End If End Set End Property Public Property StepPar As String Get Dim dStepPar As Double = 0 EgtGetMachiningParam(MCH_MP.STEP_, dStepPar) Return LenToString(dStepPar, 3) End Get Set(value As String) Dim dStepPar As Double = 0 StringToLen(value, dStepPar) EgtSetMachiningParam(MCH_MP.STEP_, dStepPar) End Set End Property Public Property StartSlowLen As String Get Dim dStartSlowLen As Double = 0 EgtGetMachiningParam(MCH_MP.STARTSLOWLEN, dStartSlowLen) Return LenToString(dStartSlowLen, 3) End Get Set(value As String) Dim dStartSlowLen As Double = 0 StringToLen(value, dStartSlowLen) EgtSetMachiningParam(MCH_MP.STARTSLOWLEN, dStartSlowLen) End Set End Property Public Property EndSlowLen As String Get Dim dEndSlowLen As Double = 0 EgtGetMachiningParam(MCH_MP.ENDSLOWLEN, dEndSlowLen) Return LenToString(dEndSlowLen, 3) End Get Set(value As String) Dim dEndSlowLen As Double = 0 StringToLen(value, dEndSlowLen) EgtSetMachiningParam(MCH_MP.ENDSLOWLEN, dEndSlowLen) End Set End Property Public Property SideAngle As String Get Dim dSideAngle As Double = 0 EgtGetMachiningParam(MCH_MP.SIDEANGLE, dSideAngle) Return LenToString(dSideAngle, 3) End Get Set(value As String) Dim dSideAngle As Double = 0 StringToLen(value, dSideAngle) EgtSetMachiningParam(MCH_MP.SIDEANGLE, dSideAngle) End Set End Property Public Property OffsetSr As String Get Dim dOffsetSr As Double = 0 EgtGetMachiningParam(MCH_MP.OFFSR, dOffsetSr) Return LenToString(dOffsetSr, 3) End Get Set(value As String) Dim dOffsetSr As Double = 0 StringToLen(value, dOffsetSr) EgtSetMachiningParam(MCH_MP.OFFSR, dOffsetSr) End Set End Property Public Property OffsetSl As String Get Dim dOffsetSl As Double = 0 EgtGetMachiningParam(MCH_MP.OFFSL, dOffsetSl) Return LenToString(dOffsetSl, 3) End Get Set(value As String) Dim dOffsetSl As Double = 0 StringToLen(value, dOffsetSl) EgtSetMachiningParam(MCH_MP.OFFSL, dOffsetSl) End Set End Property Public Property LeaveTab As Boolean Get Dim bLeaveTab As Boolean = False EgtGetMachiningParam(MCH_MP.LEAVETAB, bLeaveTab) Return bLeaveTab End Get Set(value As Boolean) EgtSetMachiningParam(MCH_MP.LEAVETAB, value) End Set End Property Public Property TabLen As String Get Dim dTabLen As Double = 0 EgtGetMachiningParam(MCH_MP.TABLEN, dTabLen) Return LenToString(dTabLen, 3) End Get Set(value As String) Dim dTabLen As Double = 0 StringToLen(value, dTabLen) EgtSetMachiningParam(MCH_MP.TABLEN, dTabLen) End Set End Property Public Property TabHeight As String Get Dim dTabHeight As Double = 0 EgtGetMachiningParam(MCH_MP.TABHEIGHT, dTabHeight) Return LenToString(dTabHeight, 3) End Get Set(value As String) Dim dTabHeight As Double = 0 StringToLen(value, dTabHeight) EgtSetMachiningParam(MCH_MP.TABHEIGHT, dTabHeight) End Set End Property Public Property TabAngle As String Get Dim dTabAngle As Double = 0 EgtGetMachiningParam(MCH_MP.TABANGLE, dTabAngle) Return LenToString(dTabAngle, 3) End Get Set(value As String) Dim dTabAngle As Double = 0 StringToLen(value, dTabAngle) EgtSetMachiningParam(MCH_MP.TABANGLE, dTabAngle) End Set End Property Public Property TabDist As String Get Dim dTabDist As Double = 0 EgtGetMachiningParam(MCH_MP.TABDIST, dTabDist) Return LenToString(dTabDist, 3) End Get Set(value As String) Dim dTabDist As Double = 0 StringToLen(value, dTabDist) EgtSetMachiningParam(MCH_MP.TABDIST, dTabDist) 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 EgtGetMachiningParam(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 EgtSetMachiningParam(MCH_MP.LEADINTYPE, IdNameStruct.SearchFromId(value, m_LeadInTypeList)) End If End If End Set End Property Public Property StartAddLen As String Get Dim dStartAddLen As Double = 0 EgtGetMachiningParam(MCH_MP.STARTADDLEN, dStartAddLen) Return LenToString(dStartAddLen, 3) End Get Set(value As String) Dim dStartAddLen As Double = 0 StringToLen(value, dStartAddLen) EgtSetMachiningParam(MCH_MP.STARTADDLEN, dStartAddLen) End Set End Property Public Property LiTang As String Get Dim dLiTang As Double = 0 EgtGetMachiningParam(MCH_MP.LITANG, dLiTang) Return LenToString(dLiTang, 3) End Get Set(value As String) Dim dLiTang As Double = 0 StringToLen(value, dLiTang) EgtSetMachiningParam(MCH_MP.LITANG, dLiTang) End Set End Property Public Property LiPerp As String Get Dim dLiPerp As Double = 0 EgtGetMachiningParam(MCH_MP.LIPERP, dLiPerp) Return LenToString(dLiPerp, 3) End Get Set(value As String) Dim dLiPerp As Double = 0 StringToLen(value, dLiPerp) EgtSetMachiningParam(MCH_MP.LIPERP, dLiPerp) End Set End Property Public Property LiElev As String Get Dim dLiElev As Double = 0 EgtGetMachiningParam(MCH_MP.LIELEV, dLiElev) Return LenToString(dLiElev, 3) End Get Set(value As String) Dim dLiElev As Double = 0 StringToLen(value, dLiElev) EgtSetMachiningParam(MCH_MP.LIELEV, dLiElev) End Set End Property Public Property LiCompLen As String Get Dim dLiCompLen As Double = 0 EgtGetMachiningParam(MCH_MP.LICOMPLEN, dLiCompLen) Return LenToString(dLiCompLen, 3) End Get Set(value As String) Dim dLiCompLen As Double = 0 StringToLen(value, dLiCompLen) EgtSetMachiningParam(MCH_MP.LICOMPLEN, dLiCompLen) 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 EgtGetMachiningParam(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 EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, IdNameStruct.SearchFromId(value, m_LeadOutTypeList)) End If End If End Set End Property Public Property EndAddLen As String Get Dim dEndAddLen As Double = 0 EgtGetMachiningParam(MCH_MP.ENDADDLEN, dEndAddLen) Return LenToString(dEndAddLen, 3) End Get Set(value As String) Dim dEndAddLen As Double = 0 StringToLen(value, dEndAddLen) EgtSetMachiningParam(MCH_MP.ENDADDLEN, dEndAddLen) End Set End Property Public Property LoTang As String Get Dim dLoTang As Double = 0 EgtGetMachiningParam(MCH_MP.LOTANG, dLoTang) Return LenToString(dLoTang, 3) End Get Set(value As String) Dim dLoTang As Double = 0 StringToLen(value, dLoTang) EgtSetMachiningParam(MCH_MP.LOTANG, dLoTang) End Set End Property Public Property LoPerp As String Get Dim dLoPerp As Double = 0 EgtGetMachiningParam(MCH_MP.LOPERP, dLoPerp) Return LenToString(dLoPerp, 3) End Get Set(value As String) Dim dLoPerp As Double = 0 StringToLen(value, dLoPerp) EgtSetMachiningParam(MCH_MP.LOPERP, dLoPerp) End Set End Property Public Property LoElev As String Get Dim dLoElev As Double = 0 EgtGetMachiningParam(MCH_MP.LOELEV, dLoElev) Return LenToString(dLoElev, 3) End Get Set(value As String) Dim dLoElev As Double = 0 StringToLen(value, dLoElev) EgtSetMachiningParam(MCH_MP.LOELEV, dLoElev) End Set End Property Public Property LoCompLen As String Get Dim dLoCompLen As Double = 0 EgtGetMachiningParam(MCH_MP.LOCOMPLEN, dLoCompLen) Return LenToString(dLoCompLen, 3) End Get Set(value As String) Dim dLoCompLen As Double = 0 StringToLen(value, dLoCompLen) EgtSetMachiningParam(MCH_MP.LOCOMPLEN, dLoCompLen) End Set End Property Public Property Speed As String Get Dim dSpeed As Double = 0 EgtGetMachiningParam(MCH_MP.SPEED, dSpeed) Return LenToString(dSpeed, 3) End Get Set(value As String) Dim dSpeed As Double = 0 StringToLen(value, dSpeed) EgtSetMachiningParam(MCH_MP.SPEED, dSpeed) End Set End Property Public Property Feed As String Get Dim dFeed As Double = 0 EgtGetMachiningParam(MCH_MP.FEED, dFeed) Return LenToString(dFeed, 3) End Get Set(value As String) Dim dFeed As Double = 0 StringToLen(value, dFeed) EgtSetMachiningParam(MCH_MP.FEED, dFeed) End Set End Property Public Property TipFeed As String Get Dim dTipFeed As Double = 0 EgtGetMachiningParam(MCH_MP.TIPFEED, dTipFeed) Return LenToString(dTipFeed, 3) End Get Set(value As String) Dim dTipFeed As Double = 0 StringToLen(value, dTipFeed) EgtSetMachiningParam(MCH_MP.TIPFEED, dTipFeed) End Set End Property Public Property StartFeed As String Get Dim dStartFeed As Double = 0 EgtGetMachiningParam(MCH_MP.STARTFEED, dStartFeed) Return LenToString(dStartFeed, 3) End Get Set(value As String) Dim dStartFeed As Double = 0 StringToLen(value, dStartFeed) EgtSetMachiningParam(MCH_MP.STARTFEED, dStartFeed) End Set End Property Public Property EndFeed As String Get Dim dEndFeed As Double = 0 EgtGetMachiningParam(MCH_MP.ENDFEED, dEndFeed) Return LenToString(dEndFeed, 3) End Get Set(value As String) Dim dEndFeed As Double = 0 StringToLen(value, dEndFeed) EgtSetMachiningParam(MCH_MP.ENDFEED, dEndFeed) End Set End Property Sub New(Id As Integer, Name As String, Type As Integer, Tool As String) Me.Id = Id Me.Name = Name Me.m_Type = Type Me.Image = ConvertTypeToImage(Type) Me.Tool = If(Not String.IsNullOrEmpty(Tool), "(" & Tool & ")", String.Empty) End Sub Private Function ConvertTypeToImage(Type As Integer) As String Select Case Type Case MCH_OY.DISP Return "" Case MCH_OY.DRILLING Return "" Case MCH_OY.SAWING Return "" Case MCH_OY.MILLING Return "" Case MCH_OY.POCKETING Return "" Case MCH_OY.MORTISING Return "" Case MCH_OY.SAWROUGHING Return "" Case MCH_OY.SAWFINISHING Return "" Case Else Return String.Empty End Select End Function Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged Public Sub NotifyPropertyChanged(propName As String) RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) 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 OperationParamVisibilityConverter 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_OY.NONE Return Visibility.Hidden Case MCH_OY.DISP Return SharedFieldsClass.OperationDisposition(CInt(parameter)) Case MCH_OY.DRILLING Return SharedFieldsClass.OperationDrilling(CInt(parameter)) Case MCH_OY.SAWING Return SharedFieldsClass.OperationSawing(CInt(parameter)) Case MCH_OY.MILLING Return SharedFieldsClass.OperationMilling(CInt(parameter)) Case MCH_OY.POCKETING Return SharedFieldsClass.OperationPocketing(CInt(parameter)) Case MCH_OY.MORTISING Return SharedFieldsClass.OperationMortising(CInt(parameter)) Case MCH_OY.SAWROUGHING Return SharedFieldsClass.OperationSawroughing(CInt(parameter)) Case MCH_OY.SAWFINISHING Return SharedFieldsClass.OperationSawfinishing(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