6b9ea51d2a
- aggiunta gestione completa del nesting.
91 lines
2.6 KiB
VB.net
91 lines
2.6 KiB
VB.net
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
|
|
|
|
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
|
|
OmagOFFICEMap.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("Title")
|
|
End Sub
|
|
|
|
Friend Sub ContentRendered()
|
|
' Verifico che l'inizializzazione di tutte le parti del programma sia andata a buon fine
|
|
If OmagOFFICEMap.EndInit() Then
|
|
m_bInitStatus = True
|
|
Else
|
|
'altrimenti chiudo il programma
|
|
m_bInitStatus = False
|
|
End If
|
|
' Nuovo progetto
|
|
OmagOFFICEMap.refTopCommandBarVM.NewCmd()
|
|
End Sub
|
|
|
|
#End Region ' METHODS
|
|
|
|
#Region "CloseApplicationCommand"
|
|
|
|
' Returns a command that manage the MainWindow_Unloaded command
|
|
Public ReadOnly Property CloseApplicationCommand() As ICommand
|
|
Get
|
|
If m_cmdCloseApplication Is Nothing Then
|
|
m_cmdCloseApplication = New Command(AddressOf CloseApplication)
|
|
End If
|
|
Return m_cmdCloseApplication
|
|
End Get
|
|
End Property
|
|
|
|
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
|
Public Sub CloseApplication(ByVal param As Object)
|
|
' Gestisco eventuale file corrente modificato
|
|
Dim bAllowClose As Boolean = OmagOFFICEMap.refSceneHostV.Controller.ManageModified()
|
|
' Se non confermata chiusura, esco
|
|
If Not bAllowClose Then Return
|
|
' Termino il Model
|
|
m_MainWindowM.Close()
|
|
' Termino il programma
|
|
Application.Current.Shutdown()
|
|
End Sub
|
|
|
|
#End Region ' CloseApplicationCommand
|
|
|
|
End Class
|