Files
egtbeamwall/EgtBEAMWALL.ViewerOptimizer/MachGroupPanel/BeamVM.vb
T
Emmanuele Sassi bab90cf7dc - selezione dei pezzi btl in prod
- implementazione copia rawpart travi
- selezione dei pezzi btl in prod
- implementazione accesso Db con codice chiave
2021-05-20 18:05:02 +02:00

97 lines
3.2 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
' se prima trave della barra sostituisco valore anche a startoffset
Dim BeamMachGroup As BeamMachGroupVM = DirectCast(ParentMachGroupVM, BeamMachGroupVM)
If ParentMachGroupVM.PartVMList(0) Is Me Then
BeamMachGroup.dStartCut = dValue
End If
If Not BeamMachGroup.ReDrawBeamMachgroup() Then
' rispristino vecchio valore
m_BeamM.dOffset = dOldValue
BeamMachGroup.dStartCut = 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