Files
egtbeamwall/EgtBEAMWALL.Supervisor/MachGroupPanel/MyMachGroupPanelVM.vb
T
Emmanuele Sassi 4d20011478 - Aggiunta gestione errori NUM
- Correzioni e miglioramenti a comunicazione con NUM
- Correzioni e miglioramenti invio programmi a NUM
- Aggiunta gestione separata errori NUM e TPA
- Aggiunta gestione separata OPState e OPMode
2021-11-06 12:48:39 +01:00

105 lines
3.6 KiB
VB.net

Imports System.Collections.ObjectModel
Imports System.ComponentModel
Imports System.IO
Imports EgtBEAMWALL.Core
Imports EgtUILib
Imports EgtWPFLib5
Public Class MyMachGroupPanelVM
Inherits Core.MyMachGroupPanelVM
#Region "FIELDS & PROPERTIES"
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New(MachGroupPanelM As MachGroupPanelM)
MyBase.New(MachGroupPanelM)
' Recupero la macchina di default
Dim sDefaultMachine As String = String.Empty
GetMainPrivateProfileString(S_MACH, K_CURRMACH, "", sDefaultMachine)
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Protected Overrides Sub CreateMachGroupVMList()
Dim all As New List(Of MachGroupVM)
For Each MachGroupM In m_MachGroupPanelM.GetMachGroups()
all.Add(New MyMachGroupVM(MachGroupM))
Next
For Each MachGroupvM As MachGroupVM In all
AddHandler MachGroupvM.PropertyChanged, AddressOf OnMachGroupVMPropertyChanged
Next
MachGroupVMList = New ObservableCollection(Of MachGroupVM)(all)
AddHandler MachGroupVMList.CollectionChanged, AddressOf OnMachGroupVMListChanged
End Sub
Protected Overrides Sub OnMachGroupAdded(sender As Object, e As MachGroupAddedEventArgs)
Dim MachGroupVM As MachGroupVM = Nothing
Select Case DirectCast(e.NewMachGroupM, MyMachGroupM).nType
Case Core.ConstBeam.MachineType.BEAM, Core.ConstBeam.MachineType.WALL
MachGroupVM = New MyMachGroupVM(e.NewMachGroupM)
Case Core.ConstBeam.MachineType.NULL
Return
End Select
MachGroupVMList.Add(MachGroupVM)
NotifyPropertyChanged(NameOf(MachGroupVMList))
End Sub
Public Overrides Function OnPostSetCurrMachGroup() As Boolean
' resetto eventuale selezione pezzo
Dim SelMachGroup As MyMachGroupVM = DirectCast(SelectedMachGroup, MyMachGroupVM)
' resetto eventuale selezione pezzo
SelMachGroup.SelPart = Nothing
' Imposto vista solo tavola
EgtSetMachineLook(MCH_LOOK.TAB)
Dim View As VT
For Each Mach As MyMachine In Map.refMachinePanelVM.MachineList
If Mach.Name = SelectedMachGroup.Machine Then
If Mach.nType = Core.ConstBeam.MachineType.BEAM Then
View = VT.ISO_SW
Else
View = VT.TOP
End If
Exit For
End If
Next
Map.refFeatureInPartInRawPartListVM.SetFeatureListVisibility(SelMachGroup.bResetWhileCutting)
EgtSetView(View, False)
EgtZoom(ZM.ALL)
Return True
End Function
Public Function FirstNotToBeProducedIndex() As Integer
Return MachGroupVMList.IndexOf(MachGroupVMList.FirstOrDefault(Function(x) DirectCast(x, MyMachGroupVM).bToBeProduced = False))
End Function
Friend Sub ResetAllMachGroups()
For Each Machgroup As MyMachGroupVM In MachGroupVMList
' se iniziato ma non finito
If Machgroup.dtStartTime <> DateTime.MinValue AndAlso Machgroup.dtEndTime = DateTime.MinValue Then
' segno come resettato
Machgroup.SetResetWhileCutting(True)
End If
Machgroup.ResetProduce()
Machgroup.NotifyPropertyChanged(NameOf(Machgroup.Produce_IsEnabled))
Next
End Sub
Public Overrides Sub AddMachGroup()
Dim SelMyMachine As MyMachine = Map.refMachinePanelVM.SelectedMachine
Dim MyMachGroupM As MyMachGroupM = m_MyMachGroupPanelM.NewMyMachGroup(SelMyMachine.Name, SelMyMachine.nType)
If Not IsNothing(MyMachGroupM) Then Return
' e lo seleziono
SelectedMachGroup = MachGroupVMList.FirstOrDefault(Function(x) x.MachGroupM Is MyMachGroupM)
End Sub
#End Region ' METHODS
End Class