- introdotti combo e check per i parametri del singolo Rib

- Aggiunto parametro RibType nel singolo Rib
This commit is contained in:
Emmanuele Sassi
2022-10-27 20:34:28 +02:00
parent a47a5ed09a
commit 2b5bb35e21
3 changed files with 252 additions and 9 deletions
+8
View File
@@ -953,6 +953,10 @@ Public Class ComboMachiningParam
End Get
End Property
Sub New(Type As Params)
MyBase.New(Type)
End Sub
Sub New(Type As Params, nIndex As Integer)
MyBase.New(Type)
If nIndex = 0 Then
@@ -1084,6 +1088,10 @@ Public Class CheckMachiningParam
End Get
End Property
Sub New(Type As Params)
MyBase.New(Type)
End Sub
Sub New(Type As Params, nIndex As Integer)
MyBase.New(Type)
If nIndex = 0 Then
+2 -2
View File
@@ -58,7 +58,7 @@
<Button Grid.Column="2"
Content="R"
Command="{Binding ResetParam_Command}"
IsEnabled="{Binding bIsModifiedFromDb}"
IsEnabled="{Binding bIsModifiedFromPart}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="5,0,0,0"
@@ -80,7 +80,7 @@
<Button Grid.Column="2"
Content="R"
Command="{Binding ResetParam_Command}"
IsEnabled="{Binding bIsModifiedFromDb}"
IsEnabled="{Binding bIsModifiedFromPart}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Margin="5,0,0,0"
+242 -7
View File
@@ -41,12 +41,13 @@ Public Class RibParamPanelVM
m_Type = Cathegories.RIBS
m_sName = "Ribs"
m_MachiningParamList = New List(Of MachiningParam)({New RibNumericMachiningParam(MachiningParam.Params.RIBSOVERLAP, nRibId, nPartId),
m_MachiningParamList = New List(Of MachiningParam)({New RibComboMachiningParam(MachiningParam.Params.RIBSTYPE, nRibId, nPartId),
New RibNumericMachiningParam(MachiningParam.Params.RIBSOVERLAP, nRibId, nPartId),
New RibNumericMachiningParam(MachiningParam.Params.RIBSSTRANDCOUNT, nRibId, nPartId),
New RibNumericMachiningParam(MachiningParam.Params.RIBSINVERTDIRECTION, nRibId, nPartId),
New RibNumericMachiningParam(MachiningParam.Params.RIBSLEADININVERT, nRibId, nPartId),
New RibCheckMachiningParam(MachiningParam.Params.RIBSINVERTDIRECTION, nRibId, nPartId),
New RibCheckMachiningParam(MachiningParam.Params.RIBSLEADININVERT, nRibId, nPartId),
New RibNumericMachiningParam(MachiningParam.Params.RIBSLEADINLEN, nRibId, nPartId),
New RibNumericMachiningParam(MachiningParam.Params.RIBSLEADOUTINVERT, nRibId, nPartId),
New RibCheckMachiningParam(MachiningParam.Params.RIBSLEADOUTINVERT, nRibId, nPartId),
New RibNumericMachiningParam(MachiningParam.Params.RIBSLEADOUTLEN, nRibId, nPartId),
New RibNumericMachiningParam(MachiningParam.Params.RIBSLEADOUTCOASTING, nRibId, nPartId),
New RibNumericMachiningParam(MachiningParam.Params.RIBSLEADOUTWIPE, nRibId, nPartId),
@@ -70,9 +71,21 @@ Public Class RibParamPanelVM
Friend Sub WriteParamsInRib(nRibId As Integer)
' se parametri modificati
Dim bModified As Boolean = False
For Each Param As RibNumericMachiningParam In m_MachiningParamList
If Param.bIsModified AndAlso Not bModified Then bModified = True
Param.WriteParamInRib(nRibId)
For Each Param In m_MachiningParamList
Select Case Param.GetType()
Case GetType(RibNumericMachiningParam)
Dim NumericParam As RibNumericMachiningParam = TryCast(Param, RibNumericMachiningParam)
If NumericParam.bIsModified AndAlso Not bModified Then bModified = True
NumericParam.WriteParamInRib(nRibId)
Case GetType(RibComboMachiningParam)
Dim ComboParam As RibComboMachiningParam = TryCast(Param, RibComboMachiningParam)
If ComboParam.bIsModified AndAlso Not bModified Then bModified = True
ComboParam.WriteParamInRib(nRibId)
Case GetType(RibCheckMachiningParam)
Dim CheckParam As RibCheckMachiningParam = TryCast(Param, RibCheckMachiningParam)
If CheckParam.bIsModified AndAlso Not bModified Then bModified = True
CheckParam.WriteParamInRib(nRibId)
End Select
Next
If bModified Then
' Imposto flag di ricalcolo slice
@@ -324,4 +337,226 @@ Public Class RibNumericMachiningParam
#End Region ' COMMANDS
End Class
Public Class RibComboMachiningParam
Inherits ComboMachiningParam
Public Overrides Property SelValue As IdNameStruct
Get
Return m_SelValue
End Get
Set(value As IdNameStruct)
m_SelValue = value
NotifyPropertyChanged(NameOf(SelValue))
NotifyPropertyChanged(NameOf(bIsModifiedFromPart))
End Set
End Property
Protected m_PartSelValue As IdNameStruct
Public ReadOnly Property PartSelValue As IdNameStruct
Get
Return m_PartSelValue
End Get
End Property
Public ReadOnly Property bIsModifiedFromPart As Boolean
Get
Return m_SelValue.Id <> m_PartSelValue.Id
End Get
End Property
' Definizione comandi
Private m_cmdResetParam As ICommand
Sub New(Type As Params, nRibId As Integer, nPartId As Integer)
MyBase.New(Type)
Dim bReadFromRib As Boolean = False
Dim bReadFromPart As Boolean = False
Select Case Type
Case Params.RIBSTYPE
m_ValueList = New List(Of IdNameStruct)({New IdNameStruct(Machining.MPAR_RIBSTYPE.INTERNAL, "Internal"),
New IdNameStruct(Machining.MPAR_RIBSTYPE.EXTERNAL, "External"),
New IdNameStruct(Machining.MPAR_RIBSTYPE.UNBOUNDED, "Unbounded")})
Dim nSelValue As Integer = 1
bReadFromRib = EgtGetInfo(nRibId, MAC_RIBSTYPE, nSelValue)
If bReadFromRib Then
m_SelValue = m_ValueList.FirstOrDefault(Function(x) x.Id = nSelValue)
End If
bReadFromPart = EgtGetInfo(nPartId, MAC_RIBSTYPE, nSelValue)
m_PartSelValue = m_ValueList.FirstOrDefault(Function(x) x.Id = nSelValue)
End Select
m_OrigSelValue = m_SelValue
If Not bReadFromRib Then
If bReadFromPart Then
m_SelValue = m_PartSelValue
m_OrigSelValue = m_PartSelValue
ElseIf Type = Params.RIBSTYPE Then
m_OrigSelValue = m_ValueList.FirstOrDefault(Function(x) x.Id = Machining.MPAR_RIBSTYPE.INTERNAL)
m_SelValue = m_OrigSelValue
End If
End If
End Sub
Friend Sub WriteParamInRib(nRibId As Integer)
Select Case Type
Case Params.RIBSTYPE
If bIsModifiedFromPart Then
EgtSetInfo(nRibId, MAC_RIBSTYPE, m_SelValue.Id)
Else
EgtRemoveInfo(nRibId, MAC_RIBSTYPE)
End If
End Select
End Sub
Friend Overrides Sub SaveParam()
m_OrigSelValue = m_SelValue
End Sub
Friend Overrides Sub ResetParam()
m_SelValue = m_OrigSelValue
End Sub
#Region "COMMANDS"
#Region "ResetParam"
Public ReadOnly Property ResetParam_Command As ICommand
Get
If m_cmdResetParam Is Nothing Then
m_cmdResetParam = New Command(AddressOf ResetParamCmd)
End If
Return m_cmdResetParam
End Get
End Property
Public Sub ResetParamCmd()
m_SelValue = m_PartSelValue
NotifyPropertyChanged(NameOf(SelValue))
NotifyPropertyChanged(NameOf(bIsModifiedFromPart))
End Sub
#End Region ' ResetParam
#End Region ' COMMANDS
End Class
Public Class RibCheckMachiningParam
Inherits CheckMachiningParam
Public Overrides Property bValue As Boolean
Get
Return m_bValue
End Get
Set(value As Boolean)
m_bValue = value
NotifyPropertyChanged(NameOf(bValue))
NotifyPropertyChanged(NameOf(bIsModifiedFromPart))
End Set
End Property
Protected m_bPartValue As String
Public ReadOnly Property bPartValue As String
Get
Return m_bPartValue
End Get
End Property
Public ReadOnly Property bIsModifiedFromPart As Boolean
Get
Return m_bValue <> m_bPartValue
End Get
End Property
' Definizione comandi
Private m_cmdResetParam As ICommand
Sub New(Type As Params, nRibId As Integer, nPartId As Integer)
MyBase.New(Type)
Dim bReadFromPart As Boolean = False
Select Case Type
'Case Params.RIBSLINK
' bReadFromPart = EgtGetInfo(nRibId, MAC_RIBSLINK, m_bValue)
' EgtGetInfo(nPartId, MAC_RIBSOVERLAP, m_bPartValue)
Case Params.RIBSINVERTDIRECTION
bReadFromPart = EgtGetInfo(nRibId, MAC_RIBSINVERTDIRECTION, m_bValue)
EgtGetInfo(nPartId, MAC_RIBSINVERTDIRECTION, m_bPartValue)
Case Params.RIBSLEADININVERT
bReadFromPart = EgtGetInfo(nRibId, MAC_RIBSLEADININVERT, m_bValue)
EgtGetInfo(nPartId, MAC_RIBSLEADININVERT, m_bPartValue)
Case Params.RIBSLEADOUTINVERT
bReadFromPart = EgtGetInfo(nRibId, MAC_RIBSLEADOUTINVERT, m_bValue)
EgtGetInfo(nPartId, MAC_RIBSLEADOUTINVERT, m_bPartValue)
End Select
m_bOrigValue = m_bValue
If Not bReadFromPart Then
m_bValue = m_bPartValue
m_bOrigValue = m_bPartValue
End If
End Sub
Friend Sub WriteParamInRib(nRibId As Integer)
Select Case Type
'Case Params.RIBSLINK
' If bIsModifiedFromPart Then
' EgtSetInfo(nRibId, MAC_RIBSLINK, If(m_bValue, 1, 0))
' Else
' EgtRemoveInfo(nRibId, MAC_RIBSLINK)
' End If
Case Params.RIBSINVERTDIRECTION
If bIsModifiedFromPart Then
EgtSetInfo(nRibId, MAC_RIBSINVERTDIRECTION, If(m_bValue, 1, 0))
Else
EgtRemoveInfo(nRibId, MAC_RIBSINVERTDIRECTION)
End If
Case Params.RIBSLEADININVERT
If bIsModifiedFromPart Then
EgtSetInfo(nRibId, MAC_RIBSLEADININVERT, If(m_bValue, 1, 0))
Else
EgtRemoveInfo(nRibId, MAC_RIBSLEADININVERT)
End If
Case Params.RIBSLEADOUTINVERT
If bIsModifiedFromPart Then
EgtSetInfo(nRibId, MAC_RIBSLEADOUTINVERT, If(m_bValue, 1, 0))
Else
EgtRemoveInfo(nRibId, MAC_RIBSLEADOUTINVERT)
End If
End Select
End Sub
Friend Overrides Sub SaveParam()
m_bOrigValue = m_bValue
End Sub
Friend Overrides Sub ResetParam()
m_bValue = m_bOrigValue
NotifyPropertyChanged(NameOf(bValue))
End Sub
#Region "COMMANDS"
#Region "ResetParam"
Public ReadOnly Property ResetParam_Command As ICommand
Get
If m_cmdResetParam Is Nothing Then
m_cmdResetParam = New Command(AddressOf ResetParamCmd)
End If
Return m_cmdResetParam
End Get
End Property
Public Sub ResetParamCmd()
m_bValue = m_bPartValue
NotifyPropertyChanged(NameOf(bValue))
NotifyPropertyChanged(NameOf(bIsModifiedFromPart))
End Sub
#End Region ' ResetParam
#End Region ' COMMANDS
End Class