Files
OmagVIEWPlus/StatusMachine2/StatusMachine2VM.vb
T
Nicola Pievani 65dee8bf4c OmagVIEWPlus 2.3a1:
-> aggiornamento automatico della lista "PartList";
-> verifica funzionamento ultima versione.
2021-01-07 14:08:14 +00:00

140 lines
4.3 KiB
VB.net

Imports EgtUILib
Imports EgtWPFLib5
Public Class StatusMachine2VM
Inherits VMBase
Friend m_RefStusMachine2V As StatusMachine2V
Private m_Title As String = "Status machine 2"
Public ReadOnly Property Title As String
Get
Return m_Title
End Get
End Property
Private m_MessagesIsHang As String = "Part is hanging"
Public ReadOnly Property MessagesIsHang As String
Get
Return m_MessagesIsHang
End Get
End Property
Private m_MessagesStatus As String = "Status machine"
Public ReadOnly Property MessagesStatus As String
Get
Return m_MessagesStatus
End Get
End Property
Private m_MessagesIsManual As String = "Unloaded manual"
Public ReadOnly Property MessagesIsManual As String
Get
Return m_MessagesIsManual
End Get
End Property
Private m_IsHanging As Boolean = False
Public Property IsHanging As Boolean
Get
Return m_IsHanging
End Get
Set(value As Boolean)
m_IsHanging = value
End Set
End Property
Private m_StatusMachine As String = String.Empty
Public Property StatusMachine As String
Get
Return m_StatusMachine
End Get
Set(value As String)
m_StatusMachine = value
NotifyPropertyChanged("StatusMachine")
End Set
End Property
Public Sub SetStatusMachine()
Dim nVal As Integer = 0
If Map.refMainWindowVM.m_CNCommunication.ReadInt("StatusMachine2Read", nVal) Then
m_StatusMachine = nVal.ToString
NotifyPropertyChanged("StatusMachine")
End If
End Sub
Private m_IsManualUnloaded As Boolean = False
Public Property IsManulaUnloaded As Boolean
Get
Return m_IsManualUnloaded
End Get
Set(value As Boolean)
m_IsManualUnloaded = value
NotifyPropertyChanged("IsManulaUnloaded")
End Set
End Property
Private m_Apply As Boolean = False
Public Property Apply As Boolean
Get
Return m_Apply
End Get
Set(value As Boolean)
m_Apply = value
m_Cancel = Not value
If value Then
m_RefStusMachine2V.Close()
Map.refUnloadingAreaVM.StatusMachine2 = False
If Not IsNothing(Map.refMainWindowVM.m_CNCommunication) Then
' definisco lo stato attuale del pezzo
If m_IsManualUnloaded And Not IsNothing(Map.refUnloadingAreaVM.CurrPartTable2) Then
Map.refUnloadingAreaVM.CurrPartTable2.enUnloading = Unloading.MANUAL
Map.refUnloadingAreaVM.CurrPartTable2.enPlace = Place.ON_WASTE_BOX
End If
' definisco lo stato della macchina
If m_IsHanging Then
Map.refMainWindowVM.m_CNCommunication.WriteInt("IsHanging", 1)
Map.refMainWindowVM.m_CNCommunication.WriteInt("StatusMachine2", 1)
Else
Map.refMainWindowVM.m_CNCommunication.WriteInt("IsHanging", 0)
Map.refMainWindowVM.m_CNCommunication.WriteInt("StatusMachine2", 0)
End If
End If
End If
End Set
End Property
Private m_Cancel As Boolean = False
Public Property Cancel As Boolean
Get
Return m_Cancel
End Get
Set(value As Boolean)
m_Cancel = value
m_Apply = Not value
Map.refUnloadingAreaVM.StatusMachine2 = False
If value Then
m_RefStusMachine2V.Close()
End If
End Set
End Property
Sub New()
m_RefStusMachine2V = New StatusMachine2V(Application.Current.MainWindow, Me)
Dim nVal1 As Integer = 0
Dim nVal2 As Integer = 0
If Not IsNothing(Map.refMainWindowVM.m_CNCommunication) Then
If Map.refMainWindowVM.m_CNCommunication.ReadInt("IsHangingRead", nVal1) Then
If nVal1 = 1 Then
m_IsHanging = True
Else
m_IsHanging = False
End If
End If
If Map.refMainWindowVM.m_CNCommunication.ReadInt("StatusMachine2Read", nVal2) Then
m_StatusMachine = nVal2.ToString
End If
End If
End Sub
End Class