111 lines
2.6 KiB
VB.net
111 lines
2.6 KiB
VB.net
Imports EgtUILib.EgtInterface
|
|
Imports EgtWPFLib5
|
|
|
|
Public Class MainWindowVM
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
' Riferimento al Model della MainWindow
|
|
Private m_MainWindowM As MainWindowM
|
|
Friend ReadOnly Property MainWindowM As MainWindowM
|
|
Get
|
|
Return m_MainWindowM
|
|
End Get
|
|
End Property
|
|
|
|
Private m_OptionWindowVM As OptionWindowVM
|
|
Friend ReadOnly Property OptionWindowVM As OptionWindowVM
|
|
Get
|
|
Return m_OptionWindowVM
|
|
End Get
|
|
End Property
|
|
|
|
Private m_SceneButtonVM As SceneButtonVM
|
|
Friend ReadOnly Property SceneButtonVM As SceneButtonVM
|
|
Get
|
|
Return m_SceneButtonVM
|
|
End Get
|
|
End Property
|
|
|
|
' Definizione Comandi
|
|
Private m_cmdAboutBox As ICommand
|
|
Private m_cmdCloseApplication As ICommand
|
|
|
|
#End Region ' Fields & Properties
|
|
|
|
#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
|
|
' Creo Option
|
|
m_OptionWindowVM = New OptionWindowVM
|
|
' Creo SceneButton
|
|
m_SceneButtonVM = New SceneButtonVM
|
|
End Sub
|
|
|
|
#End Region ' Constructor
|
|
|
|
#Region "METHODS"
|
|
|
|
Friend Sub ContentRendered()
|
|
EgtSetView(VT.ISO_SE, False)
|
|
End Sub
|
|
|
|
Friend Sub CloseApplication()
|
|
If (Keyboard.Modifiers And ModifierKeys.Alt) = ModifierKeys.Alt OrElse Keyboard.IsKeyDown(Key.F4) Then
|
|
Return
|
|
End If
|
|
' Termino il Model
|
|
m_MainWindowM.Close()
|
|
' Termino il programma
|
|
Application.Current.Shutdown()
|
|
End Sub
|
|
|
|
#End Region ' Methods
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "AboutBoxCommand"
|
|
|
|
Public ReadOnly Property AboutBoxCommand As ICommand
|
|
Get
|
|
If m_cmdAboutBox Is Nothing Then
|
|
m_cmdAboutBox = New Command(AddressOf AboutBox)
|
|
End If
|
|
Return m_cmdAboutBox
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub AboutBox(ByVal param As Object)
|
|
Dim AboutBoxWindow As New AboutBoxV
|
|
AboutBoxWindow.Owner = Application.Current.MainWindow
|
|
AboutBoxWindow.ShowDialog()
|
|
End Sub
|
|
|
|
#End Region ' AboutBoxCommand
|
|
|
|
#Region "CloseApplicationCommand"
|
|
|
|
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
|
|
|
|
Public Sub CloseApplication(ByVal param As Object)
|
|
CloseApplication()
|
|
End Sub
|
|
|
|
#End Region ' CloseApplicationCommand
|
|
|
|
#End Region ' COMMANDS
|
|
|
|
End Class
|