Imports System.Collections.ObjectModel Imports System.IO Imports EgtUILib Imports EgtWPFLib5 Public Class MachinePanelVM Inherits EgtWPFLib5.MachinePanelVM #Region "FIELDS & PROPERTIES" ' Radice del direttorio delle macchine Private m_sMachinesRoot As String ' Macchina correntemente selezionata e quindi attiva Private m_SelectedMachine As Machine = Nothing Public Overrides Property SelectedMachine As Machine Get Return m_SelectedMachine End Get Set(value As Machine) If value IsNot m_SelectedMachine Then ' imposto macchina in DbGeometrico If EgtSetCurrMachine(value.Name) Then m_SelectedMachine = value End If ' Salvo impostazione macchina corrente SaveCurrentMachine() NotifyPropertyChanged(NameOf(SelectedMachine)) ' inizializzo la macchina selezionata come macchina corrente InitCurrentMachine(Map.refMainWindowVM.MainWindowM.sMachinesRoot, value.Name) ' aggiorno nome macchina in statusbar Map.refMyStatusBarVM.RefreshMachName() End If End Set End Property Private m_MachPanel_IsEnabled As Boolean = True Public Property MachPanel_IsEnabled As Boolean Get Return m_MachPanel_IsEnabled End Get Set(value As Boolean) m_MachPanel_IsEnabled = value NotifyPropertyChanged("MachPanel_IsEnabled") End Set End Property Private m_BeamTable_Visibility As Visibility Public ReadOnly Property BeamTable_Visibility As Visibility Get Return m_BeamTable_Visibility End Get End Property Private m_WallTable_Visibility As Visibility Public ReadOnly Property WallTable_Visibility As Visibility Get Return m_WallTable_Visibility End Get End Property #Region "Messages" Public ReadOnly Property ToolDBMsg As String Get Return EgtMsg(MSG_MACHINEPAGEUC + 6) End Get End Property Public ReadOnly Property MachiningDbMsg As String Get Return EgtMsg(MSG_MACHINEPAGEUC + 7) End Get End Property Public ReadOnly Property SetUpMsg As String Get Return EgtMsg(MSG_ALARMSPAGEUC + 33) End Get End Property #End Region ' Messages #Region "ToolTip" Public ReadOnly Property ToolDBToolTip As String Get Return EgtMsg(5003) End Get End Property Public ReadOnly Property MachiningDbToolTip As String Get Return EgtMsg(5004) End Get End Property Public ReadOnly Property SetUpToolTip As String Get Return EgtMsg(31501) End Get End Property #End Region ' ToolTip ' Definizione comandi Private m_cmdBeamTable As ICommand Private m_cmdWallTable As ICommand #End Region 'FIELDS & PROPERTIES #Region "CONSTRUCTOR" Sub New() ' Creo riferimento a questa classe in Map Map.SetRefMachinePanelVM(Me) ' recupero cartella radice delle macchine m_sMachinesRoot = Map.refMainWindowVM.MainWindowM.sMachinesRoot ' Carica macchine da cartella delle macchine MyMachine.MachineListInit(m_sMachinesRoot, MachineList) End Sub #End Region ' CONSTRUCTOR #Region "METHODS" Friend Sub LoadCurrentMachine() If MachineList.Count = 0 Then Return Dim CurrMachine As Machine = Nothing Dim CurrMachineName As String = String.Empty GetMainPrivateProfileString(S_MACH, K_CURRMACH, String.Empty, CurrMachineName) Dim bFound As Boolean = False If Not String.IsNullOrEmpty(CurrMachineName) Then For Each Mach In MachineList If Mach.Name = CurrMachineName Then bFound = True CurrMachine = Mach Exit For End If Next End If If Not bFound And MachineList.Count > 0 Then CurrMachine = MachineList(0) End If If Not IsNothing(CurrMachine) Then If EgtSetCurrMachine(CurrMachine.Name) Then SelectedMachine = CurrMachine End If End If End Sub Friend Sub SaveCurrentMachine() If IsNothing(m_SelectedMachine) Then Return WriteMainPrivateProfileString(S_MACH, K_CURRMACH, SelectedMachine.Name) End Sub Friend Sub UpdateCurrentMachine() 'EgtSetCurrentContext(IniFile.m_ProjectSceneContext) Dim sMachName As String = String.Empty If EgtGetCurrMachineName(sMachName) Then For Each Mach In MachineList If Mach.Name = sMachName Then SelectedMachine = Mach Exit For End If Next End If End Sub #End Region End Class