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(ParentMachGroupVM, BeamMachGroupVM) If Not BeamMachGroup.ReDrawBeamMachgroup() Then ' rispristino vecchio valore m_BeamM.dOffset = dOldValue BeamMachGroup.ReDrawBeamMachgroup() End If Else NotifyPropertyChanged(NameOf(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, ParentMachGroupVM As BeamMachGroupVM) MyBase.New(BeamM, ParentMachGroupVM) End Sub #End Region ' CONSTRUCTOR #Region "METHODS" #End Region ' METHODS ' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded. Public Overrides Sub DeletePart() ' elimino pezzo copia EgtRemovePartFromRawPart(Me.nPartId) ' Recupero Id BTLPart originale Dim BTLPart As BTLPartVM = RetrieveBTLPartFromPart() EgtErase(Me.nPartId) ' rimuovo dalla lista pezzi Dim Index As Integer = ParentMachGroupVM.PartVMList.IndexOf(ParentMachGroupVM.PartVMList.FirstOrDefault(Function(x) x.nPartId = nPartId)) If Index = 0 Then If ParentMachGroupVM.PartVMList.Count > 1 Then ParentMachGroupVM.SelPart = ParentMachGroupVM.PartVMList(0) Else ParentMachGroupVM.SelPart = Nothing End If ElseIf Index = ParentMachGroupvm.PartvMList.Count - 1 Then If ParentMachGroupVM.PartVMList.Count > 1 Then ParentMachGroupVM.SelPart = ParentMachGroupVM.PartVMList(ParentMachGroupVM.PartVMList.Count - 2) Else ParentMachGroupVM.SelPart = Nothing End If Else ParentMachGroupVM.SelPart = ParentMachGroupVM.PartVMList(Index - 1) End If ParentMachGroupVM.PartVMList.Remove(Me) Dim BeamParentMachGroup As BeamMachGroupVM = DirectCast(ParentMachGroupVM, BeamMachGroupVM) If Not IsNothing(BeamParentMachGroup) Then BeamParentMachGroup.ReDrawBeamMachgroup() ' aggiorno contatore pezzi usati in Prod If Not IsNothing(BTLPart) Then BTLPart.RefreshPartInProd() EgtDraw() End Sub End Class