143 lines
4.5 KiB
VB.net
143 lines
4.5 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
Imports EgtBEAMWALL.Core
|
|
|
|
Public Class ProjectTypeWndVM
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Friend Event m_CloseWindow(bDialogResult As Boolean)
|
|
|
|
Private m_MachineList As ObservableCollection(Of Machine)
|
|
Public ReadOnly Property MachineList As ObservableCollection(Of Machine)
|
|
Get
|
|
Return m_MachineList
|
|
End Get
|
|
End Property
|
|
|
|
Private m_SelMachine As MyMachine
|
|
Public Property SelMachine As MyMachine
|
|
Get
|
|
Return m_SelMachine
|
|
End Get
|
|
Set(value As MyMachine)
|
|
If value IsNot m_SelMachine Then
|
|
m_SelMachine = value
|
|
' Se la Macchina selezionata è di tipo BOTH verrà selezionato di default il Tipo del progetto corrente
|
|
Select Case SelMachine.nType
|
|
Case MachineType.BEAM
|
|
m_nSelType = BWType.BEAM
|
|
Case MachineType.WALL
|
|
m_nSelType = BWType.WALL
|
|
Case MachineType.BOTH
|
|
m_nSelType = If(Not IsNothing(ProjectManagerVM.CurrProd), ProjectManagerVM.CurrProd.nType, BWType.BEAM)
|
|
End Select
|
|
' Se la Macchina selezionata è di tipo BOTH verrà mostrata anche la selezione del Tipo
|
|
m_IsBoth_Visibility = If(SelMachine.nType = MachineType.BOTH, Visibility.Visible, Visibility.Collapsed)
|
|
NotifyPropertyChanged(NameOf(IsBoth_Visibility))
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_IsBoth_Visibility As Visibility = Visibility.Collapsed
|
|
Public Property IsBoth_Visibility As Visibility
|
|
Get
|
|
Return m_IsBoth_Visibility
|
|
End Get
|
|
Set(value As Visibility)
|
|
If value <> m_IsBoth_Visibility Then
|
|
m_IsBoth_Visibility = value
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_TypeList As New ObservableCollection(Of BWType)({BWType.BEAM, BWType.WALL})
|
|
Public ReadOnly Property TypeList As ObservableCollection(Of BWType)
|
|
Get
|
|
Return m_TypeList
|
|
End Get
|
|
End Property
|
|
|
|
' Se la Macchina selezionata è di tipo BOTH verrà selezionato di default il Tipo del progetto corrente
|
|
Private m_nSelType As BWType = BWType.BEAM
|
|
Public Property nSelType As BWType
|
|
Get
|
|
Return m_nSelType
|
|
End Get
|
|
Set(value As BWType)
|
|
If value <> m_nSelType Then
|
|
m_nSelType = value
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
' Definizione comandi
|
|
Private m_cmdOk As ICommand
|
|
|
|
#End Region ' FIELDS & PROPERTIES
|
|
|
|
#Region "MESSAGES"
|
|
|
|
Public ReadOnly Property ChooseMachine_Msg As String
|
|
Get
|
|
Return EgtMsg(61884)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property ChooseType_Msg As String
|
|
Get
|
|
Return EgtMsg(61879)
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' MESSAGES
|
|
|
|
Sub New()
|
|
' recupero la lista delle Macchine da MachinePanel
|
|
m_MachineList = Map.refMachinePanelVM.MachineList
|
|
' La Macchina selezionata di default sarà quella correntemente selezionata in MachinePanel
|
|
If Not IsNothing(Map.refMachinePanelVM.SelectedMachine) Then
|
|
m_SelMachine = MachineList.FirstOrDefault(Function(x) x.Name = Map.refMachinePanelVM.SelectedMachine.Name)
|
|
' Se la Macchina selezionata è di tipo BOTH verrà selezionato di default il Tipo del progetto corrente
|
|
Select Case SelMachine.nType
|
|
Case MachineType.BEAM
|
|
m_nSelType = BWType.BEAM
|
|
Case MachineType.WALL
|
|
m_nSelType = BWType.WALL
|
|
Case MachineType.BOTH
|
|
m_nSelType = If(Not IsNothing(ProjectManagerVM.CurrProd), ProjectManagerVM.CurrProd.nType, BWType.BEAM)
|
|
End Select
|
|
' Se la Macchina selezionata è di tipo BOTH verrà mostrata anche la selezione del Tipo
|
|
m_IsBoth_Visibility = If(SelMachine.nType = MachineType.BOTH, Visibility.Visible, Visibility.Collapsed)
|
|
End If
|
|
End Sub
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "Ok"
|
|
|
|
Public ReadOnly Property Ok_Command As ICommand
|
|
Get
|
|
If m_cmdOk Is Nothing Then
|
|
m_cmdOk = New Command(AddressOf Ok)
|
|
End If
|
|
Return m_cmdOk
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub Ok()
|
|
If Not IsNothing(m_SelMachine) AndAlso Not IsNothing(m_nSelType) Then
|
|
RaiseEvent m_CloseWindow(True)
|
|
Else
|
|
' se non seleziono nessuna macchina lo segnalo con un MessageBox
|
|
MessageBox.Show(EgtMsg(61880), EgtMsg(30009))
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' Ok
|
|
|
|
#End Region ' COMMANDS
|
|
|
|
End Class |