Imports EgtWPFLib5 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 ' Variabile che indica che il programma è stato avviato correttamente (sia la mappa che l'ambiente Egt) Private m_bInitStatus As Boolean Friend ReadOnly Property bInitStatus As Boolean Get Return m_bInitStatus End Get End Property ' Titolo Private m_Title As String Public Property Title As String Get Return m_Title End Get Set(value As String) m_Title = value NotifyPropertyChanged("Title") End Set End Property #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 ' imposto titolo finestra m_Title = "EgtDOORProbe" NotifyPropertyChanged("Title") If m_MainWindowM.GetKeyOption(KEY_OPT.BASE) And m_MainWindowM.GetKeyOption(KEY_OPT.DOORS) Then Return ElseIf m_MainWindowM.nKeyLevel = -1 Or m_MainWindowM.nKeyLevel = -2 Then MessageBox.Show("Missing dongle. Insert it and restart", "Error") End Else MessageBox.Show("Missing licence. Set it and restart", "Error") End End If End Sub #End Region ' CONSTRUCTOR #Region "METHODS" Friend Sub SetTitle(sTitle As String) m_Title = sTitle NotifyPropertyChanged("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 ' Se istanza oltre la prima, chiedo cosa aprire If Not m_MainWindowM.bFirstInstance Then ' OmagOFFICEMap.refTopCommandBarVM.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 ' OmagOFFICEMap.refTopCommandBarVM.OpenProject(sLastProjectPath) ' Else ' OmagOFFICEMap.refTopCommandBarVM.NewCmd() ' End If ' altrimenti nuovo progetto End If End Sub #End Region ' METHODS End Class