Imports EgtBEAMWALL.Core Public Class MainWindowVM Inherits VMBase ' Riferimento al Model della MainWindow Private m_MainWindowM As MainWindowM Friend ReadOnly Property MainWindowM As MainWindowM Get Return m_MainWindowM End Get End Property ' Titolo Private m_Title As String Public ReadOnly Property Title As String Get Return m_Title End Get End Property ' Definizione comandi Private m_cmdCloseApplication As ICommand #Region "CONSTRUCTOR" Sub New() ' Avvio l'inizializzazione della mappa passandogli il riferimento al MainWindowVM Map.BeginInit(Me) '' Creo Model della MainWindow m_MainWindowM = New MainWindowM End Sub #End Region ' CONSTRUCTOR #Region "METHODS" Friend Sub SetTitle(sTitle As String) m_Title = sTitle NotifyPropertyChanged(NameOf(Title)) End Sub Public Sub UpdateTitle() m_Title = Map.refSupervisorManagerVM.CurrProd.nProdId.ToString("0000") & " - EgtBEAMWALL" NotifyPropertyChanged(NameOf(Title)) End Sub 'Friend Sub ContentRendered() ' Verifico che l'inizializzazione di tutte le parti del programma sia andata a buon fine ' If Map.EndInit() Then ' m_bInitStatus = True ' altrimenti chiudo il programma ' Else ' m_bInitStatus = False ' End If ' Aggiorno visualizzazione unità di misura ' Map.refStatusBarVM.SetMeasureUnit(If(EgtUiUnitsAreMM(), MeasureUnitOpt.MM, MeasureUnitOpt.INCH)) ' Se istanza oltre la prima, chiedo cosa aprire ' If Not m_MainWindowM.bFirstInstance Then ' Map.refProjectManagerVM.Open() ' ' altrimenti verifico se richiesto ultimo progetto ' ElseIf GetMainPrivateProfileInt(S_GENERAL, K_AUTOLOADLASTPROJ, 0) = 1 Then ' Dim sLastProjectPath As String = String.Empty ' GetMainPrivateProfileString(S_GENERAL, K_LASTPROJ, String.Empty, sLastProjectPath) ' If Not String.IsNullOrWhiteSpace(sLastProjectPath) AndAlso File.Exists(sLastProjectPath) Then ' Map.refProjectManagerVM.OpenProject(sLastProjectPath) ' Else ' Map.refProjectManagerVM.NewCmd() ' End If ' ' altrimenti nuovo progetto ' Else ' Map.refProjectManagerVM.NewCmd() ' End If ' apro in modalita' VIEW ' Map.refMainMenuVM.SelPage = Pages.VIEW 'End Sub #End Region ' METHODS #Region "COMMANDS" #Region "CloseApplication" ''' ''' Returns a command that do Exec. ''' Public ReadOnly Property CloseApplication_Command As ICommand Get If m_cmdCloseApplication Is Nothing Then m_cmdCloseApplication = New Command(AddressOf CloseApplication) End If Return m_cmdCloseApplication End Get End Property ''' ''' Execute the Exec. This method is invoked by the ExecCommand. ''' Public Sub CloseApplication() ' disconnetto comunicazione con macchina MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.DISCONNECT)) ' Chiudo la finestra principale del programma Application.Current.MainWindow.Close() End Sub #End Region ' CloseApplication #End Region ' COMMANDS End Class