Files
egtbeamwall/EgtBEAMWALL.Supervisor/MachGroupPanel/BeamVM.vb
T
2021-04-15 20:06:18 +02:00

150 lines
5.0 KiB
VB.net

Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
Public Class BeamVM
Inherits PartVM
Public ReadOnly Property m_BeamM As BeamM
Get
Return m_PartM
End Get
End Property
Public Property sOffset As String
Get
Return LenToString(m_BeamM.dOffset, 3)
End Get
Set(value As String)
Dim dValue As Double
If StringToLen(value, dValue) Then
Dim dOldValue As Double = m_BeamM.dOffset
m_BeamM.dOffset = dValue
'''Dim BeamMachGroup As BeamMachGroupVM = DirectCast(ParentMachGroup, BeamMachGroupVM)
'''If Not BeamMachGroup.ReDrawBeamMachgroup() Then
''' ' rispristino vecchio valore
''' m_BeamM.dOffset = dOldValue
''' BeamMachGroup.ReDrawBeamMachgroup()
'''End If
Else
NotifyPropertyChanged("sOffset")
End If
End Set
End Property
Public ReadOnly Property dOffset As Double
Get
Return m_BeamM.dOffset
End Get
End Property
Friend Sub ResetOffset()
'm_BeamM.dOffset = RawPartConfiguration.dBeamDist
'NotifyPropertyChanged(NameOf(sOffset))
End Sub
#Region "CONSTRUCTOR"
Sub New(BeamM As BeamM)
MyBase.New(BeamM)
End Sub
#Region "METHODS"
#End Region ' METHODS
'Sub New(nParentMachGroup As Core.MyMachGroupM, nPartId As Integer, nRawPartId As Integer)
' MyBase.New(nParentMachGroup, nPartId, nRawPartId)
' ' leggo info pezzo
' EgtGetInfo(nPartId, BTL_PRT_PROJ, nProjId)
' EgtGetInfo(nPartId, BTL_PRT_PDN, nPDN)
' EgtGetInfo(nPartId, BTL_PRT_NAM, sNAM)
' EgtGetInfo(nPartId, BTL_PRT_L, dL)
' EgtGetInfo(nPartId, BTL_PRT_W, dW)
' EgtGetInfo(nPartId, BTL_PRT_H, dH)
' EgtGetInfo(nPartId, BTL_PRT_CNT, nCNT)
' Dim nTemp As Integer = 0
' If Not EgtGetInfo(nPartId, BTL_PRT_ROTATED, nTemp) Then
' nTemp = 0
' End If
' SetRotated(nTemp)
' If Not EgtGetInfo(nPartId, BTL_PRT_INVERTED, nTemp) Then
' nTemp = 0
' End If
' SetInverted(nTemp)
' ' leggo PosX
' Dim sInfo As String = ""
' Dim Index = 1
' Dim sSplitInfo() As String
' Dim bFound As Boolean = False
' While EgtGetInfo(m_ParentMachGroup.Id, MGR_RPT_PART & Index, sInfo)
' If Not String.IsNullOrWhiteSpace(sInfo) Then
' sSplitInfo = sInfo.Split(","c)
' If sSplitInfo(0) = nPartId Then
' bFound = True
' Exit While
' End If
' End If
' Index += 1
' End While
' If bFound Then
' StringToDouble(sSplitInfo(1), dPOSX)
' End If
' ' leggo feature
' Dim nProcessingId As Integer = EgtGetFirstNameInGroup(nPartId, PROCESSINGS)
' Dim nFeatureId As Integer = EgtGetFirstInGroup(nProcessingId)
' While nFeatureId <> GDB_ID.NULL
' ' verifico che sia una feature
' Dim nGRP As Integer
' If EgtGetInfo(nFeatureId, BTL_FTR_GRP, nGRP) Then
' ' creo la feature
' '''FeatureList.Add(New BTLFeatureVM(Nothing, nFeatureId))
' End If
' nFeatureId = EgtGetNext(nFeatureId)
' End While
'End Sub
#End Region ' CONSTRUCTOR
Friend Sub UpdateOffset()
' calcolo offset
'''Dim nBeamIndex As Integer = ParentMachGroup.PartMList.IndexOf(Me)
'''If nBeamIndex > 0 Then
''' m_BeamM.dOffset = dPOSX - (ParentMachGroup.PartMList(nBeamIndex - 1).dPOSX + ParentMachGroup.PartMList(nBeamIndex - 1).dL)
'''Else
''' Dim BeamMachGroup As BeamMachGroupVM = DirectCast(ParentMachGroup, BeamMachGroupVM)
''' m_BeamM.dOffset = BeamMachGroup.dStartCut
'''End If
End Sub
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
Public Overrides Sub DeletePart()
' elimino pezzo copia
EgtRemovePartFromRawPart(Me.nPartId)
EgtErase(Me.nPartId)
'''' rimuovo dalla lista pezzi
'''Dim Index As Integer = ParentMachGroup.PartMList.IndexOf(Function(x) x.nPartId = Me.nPartId)
'''If Index = 0 Then
''' If ParentMachGroup.PartMList.Count > 0 Then
''' ParentMachGroup.SelPart = ParentMachGroup.PartMList(0)
''' Else
''' ParentMachGroup.SelPart = Nothing
''' End If
'''ElseIf Index = ParentMachGroup.PartMList.Count - 1 Then
''' If ParentMachGroup.PartMList.Count > 1 Then
''' ParentMachGroup.SelPart = ParentMachGroup.PartMList(ParentMachGroup.PartMList.Count - 2)
''' Else
''' ParentMachGroup.SelPart = Nothing
''' End If
'''Else
''' ParentMachGroup.SelPart = ParentMachGroup.PartMList(Index - 1)
'''End If
'''ParentMachGroup.PartMList.Remove(Me)
'''Dim BeamParentMachGroup As BeamMachGroupVM = DirectCast(ParentMachGroup, BeamMachGroupVM)
'''If Not IsNothing(BeamParentMachGroup) Then BeamParentMachGroup.ReDrawBeamMachgroup()
EgtDraw()
End Sub
End Class