Files
EgtCAM5/OptionPanel/MachiningOptionPanelVM.vb
Renzo Lanza 7eb8240749 EgtCAM5 2.2i2 :
- MachGroupPanelVM, MachinePanelVM, StatusBarVM spostati in EgtWPFLib5. Ora qua sono presenti le versioni My_ che ereditano quelle della Libreria. 
- ComboBox della Macchina corrente spostata in MachinePanel (accanto a Db Ut./Lav./SetUp). 
- modificato OptionPanel in modo da gestire i nuovi DrawOptionPanel e MachiningOptionPanel in base alle modalità DISEGNA e LAVORA. 
- ogni Expander di MachiningOptionPanel ora ha il suo VM e il suo V. 
- nuova gestione degli Expander di MachiningOptionPanel tramite funzioni Init e Exit. 
- barra TOPTRAY ora può estendersi su una seconda riga in base a larghezza finestra. 
- eliminati molti Application.Msn.Register/NotifyColleagues. Ora le funzioni che chiamavano sono chiamate tramite i riferimenti in Map. 
- corretta selezione superfici quando si sceglie Nuova Lav. in LAVORA.
2020-09-14 09:42:54 +00:00

198 lines
6.8 KiB
VB.net

Imports EgtUILib
Public Class MachiningOptionPanelVM
Inherits ViewModelBase
' GRAPHICAL ELEMENTS
Private m_OperationsListExpander As OperationsListExpanderV
Public ReadOnly Property OperationsListExpander As ContentControl
Get
If IsNothing(m_OperationsListExpander) Then
m_OperationsListExpander = New OperationsListExpanderV With {
.DataContext = New OperationsListExpanderVM}
End If
Map.refOperationsListExpanderVM.LoadOperationList(GDB_ID.NULL)
Return m_OperationsListExpander
End Get
End Property
Private m_OperationParametersExpander As OperationParametersExpanderV
Public ReadOnly Property OperationParametersExpander As ContentControl
Get
If IsNothing(m_OperationParametersExpander) Then
m_OperationParametersExpander = New OperationParametersExpanderV With {
.DataContext = New OperationParametersExpanderVM}
End If
Return m_OperationParametersExpander
End Get
End Property
Private m_MachiningsTreeExpander As MachiningTreeExpanderV
Public ReadOnly Property MachiningsTreeExpander As ContentControl
Get
If IsNothing(m_MachiningsTreeExpander) Then
m_MachiningsTreeExpander = New MachiningTreeExpanderV
m_MachiningsTreeExpander.DataContext = New MachiningTreeExpanderVM
End If
Return m_MachiningsTreeExpander
End Get
End Property
Private m_SimulationExpander As SimulationExpanderV
Public ReadOnly Property SimulationExpander As ContentControl
Get
If IsNothing(m_SimulationExpander) Then
m_SimulationExpander = New SimulationExpanderV
m_SimulationExpander.DataContext = New SimulationExpanderVM
End If
Map.refSimulationExpanderVM.Simulation_IsEnabled = True
Return m_SimulationExpander
End Get
End Property
Private m_EstimationsExpander As EstimationsExpanderV
Public ReadOnly Property EstimationsExpander As ContentControl
Get
If IsNothing(m_EstimationsExpander) Then
m_EstimationsExpander = New EstimationsExpanderV
m_EstimationsExpander.DataContext = New EstimationsExpanderVM
End If
Map.refEstimationsExpanderVM.Estimation_IsEnabled =
(EgtUILib.GetPrivateProfileInt(S_ESTIMATIONS, K_EST_ENABLE, 0, IniFile.m_sCurrMachIniFilePath) <> 0)
Return m_EstimationsExpander
End Get
End Property
'Expander aperto tra quelli presenti nel MachiningOptionPanel
Friend Enum MachiningOptionPanelExpander
NONE
OPERATIONLIST
OPERATIONPARAMETERS
NEWMACHININGS
SIMULATION
ESTIMATIONS
End Enum
Friend Sub Set_IsExpanded(exp As MachiningOptionPanelExpander, flag As Boolean)
If flag Then
OpenExpander = exp
Else
' se il flag passato è False vuol dire che nessun Expander è attualmente aperto
OpenExpander = MachiningOptionPanelExpander.NONE
End If
End Sub
Private m_OpenExpander As Integer = MachiningOptionPanelExpander.OPERATIONLIST
Public Property OpenExpander As Integer
Get
Return m_OpenExpander
End Get
Set(value As Integer)
Dim bOk As Boolean = False
' Esco dallo stato corrente
Select Case m_OpenExpander
Case MachiningOptionPanelExpander.OPERATIONLIST
bOk = Map.refOperationsListExpanderVM.ExitOperationsList()
Case MachiningOptionPanelExpander.OPERATIONPARAMETERS
bOk = Map.refOperationParametersExpanderVM.ExitOperationParameters()
Case MachiningOptionPanelExpander.NEWMACHININGS
bOk = Map.refOperationsListExpanderVM.ExitOperationsList()
bOk = Map.refMachiningTreeExpanderVM.ExitMachiningTreeExpander()
Case MachiningOptionPanelExpander.SIMULATION
bOk = Map.refSimulationExpanderVM.ExitSimulation()
Case MachiningOptionPanelExpander.ESTIMATIONS
bOk = Map.refEstimationsExpanderVM.ExitEstimations()
Case MachiningOptionPanelExpander.NONE
bOk = True
End Select
If bOk Then
' Entro nel nuovo stato
m_OpenExpander = value
Select Case m_OpenExpander
Case MachiningOptionPanelExpander.OPERATIONLIST
Map.refOperationsListExpanderVM.InitOperationsList()
Case MachiningOptionPanelExpander.OPERATIONPARAMETERS
Map.refOperationParametersExpanderVM.InitOperationParameters()
Case MachiningOptionPanelExpander.NEWMACHININGS
Map.refOperationsListExpanderVM.InitOperationsList()
Map.refMachiningTreeExpanderVM.InitMachiningTreeExpander()
Case MachiningOptionPanelExpander.SIMULATION
Map.refSimulationExpanderVM.InitSimulation()
Case MachiningOptionPanelExpander.ESTIMATIONS
Map.refEstimationsExpanderVM.InitEstimations()
End Select
OnPropertyChanged("OpenExpander")
End If
End Set
End Property
Public ReadOnly Property GenerateIsEnabled As Boolean
Get
Return Not Map.refSimulationExpanderVM.Simulation_IsExpanded
End Get
End Property
#Region "Messages"
Public ReadOnly Property GenerateMsg As String
Get
Return EgtMsg(MSG_SIMULATION + 30) 'GENERA
End Get
End Property
#End Region
#Region "CONSTRUCTOR"
Sub New()
' Creo riferimento a questa classe in Map
Map.SetRefMachiningOptionPanelVM(Me)
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Friend Function InitMachiningOptionPanel() As Boolean
'EgtZoom(ZM.ALL)
Return True
End Function
Friend Function ExitMachiningOptionPanel() As Boolean
Return True
End Function
#End Region ' METHODS
#Region "COMMANDS"
' Definizione comandi
Private m_cmdGenerate As ICommand
#Region "GenerateCommand"
''' <summary>
''' Returns a command that create a new tool.
''' </summary>
Public ReadOnly Property GenerateCommand As ICommand
Get
If m_cmdGenerate Is Nothing Then
m_cmdGenerate = New RelayCommand(AddressOf Generate)
End If
Return m_cmdGenerate
End Get
End Property
''' <summary>
''' Creata the new tool. This method is invoked by the NewCommand.
''' </summary>
Public Sub Generate(ByVal param As Object)
Map.refSimulationExpanderVM.Generate(param)
End Sub
#End Region ' GenerateCommand
#End Region ' COMMANDS
End Class