2ff390d577
- Primo commit.
283 lines
9.9 KiB
VB.net
283 lines
9.9 KiB
VB.net
Imports EgtWPFLib5
|
|
|
|
Public Class MainWindowVM
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Friend Enum ProjectModeOpt As Integer
|
|
MAINMENU = 0
|
|
NEWCLIENT = 1
|
|
NEWKEY = 2
|
|
NEWLICENCE = 3
|
|
NEWPRODUCT = 4
|
|
NEWVERSION = 5
|
|
NEWRESELLER = 6
|
|
SEARCHCLIENT = 7
|
|
SEARCHKEY = 8
|
|
SEARCHLICENCE = 9
|
|
SEARCHPRODUCT = 10
|
|
SEARCHVERSION = 11
|
|
SEARCHRESELLER = 12
|
|
UPDATECLIENT = 13
|
|
UPDATEKEY = 14
|
|
UPDATELICENCE = 15
|
|
UPDATEPRODUCT = 16
|
|
UPDATEVERSION = 17
|
|
UPDATERESELLER = 18
|
|
|
|
End Enum
|
|
|
|
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 InitStatus 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
|
|
|
|
Private m_SelProjectMode As ProjectModeOpt
|
|
Friend Property SelProjectMode As ProjectModeOpt
|
|
Get
|
|
Return m_SelProjectMode
|
|
End Get
|
|
Set(value As ProjectModeOpt)
|
|
' Esco dallo stato corrente
|
|
Select Case m_SelProjectMode
|
|
Case ProjectModeOpt.MAINMENU
|
|
|
|
Case ProjectModeOpt.NEWCLIENT
|
|
|
|
Case ProjectModeOpt.NEWKEY
|
|
|
|
Case ProjectModeOpt.NEWLICENCE
|
|
|
|
Case ProjectModeOpt.NEWPRODUCT
|
|
|
|
Case ProjectModeOpt.NEWVERSION
|
|
|
|
Case ProjectModeOpt.NEWRESELLER
|
|
|
|
Case ProjectModeOpt.SEARCHCLIENT
|
|
|
|
Case ProjectModeOpt.SEARCHKEY
|
|
|
|
Case ProjectModeOpt.SEARCHLICENCE
|
|
|
|
Case ProjectModeOpt.SEARCHPRODUCT
|
|
|
|
Case ProjectModeOpt.SEARCHVERSION
|
|
|
|
Case ProjectModeOpt.SEARCHRESELLER
|
|
|
|
Case ProjectModeOpt.UPDATECLIENT
|
|
|
|
Case ProjectModeOpt.UPDATEKEY
|
|
|
|
Case ProjectModeOpt.UPDATELICENCE
|
|
|
|
Case ProjectModeOpt.UPDATEPRODUCT
|
|
|
|
Case ProjectModeOpt.UPDATEVERSION
|
|
|
|
Case ProjectModeOpt.UPDATERESELLER
|
|
|
|
End Select
|
|
' Entro nel nuovo stato
|
|
m_SelProjectMode = value
|
|
Select Case m_SelProjectMode
|
|
Case ProjectModeOpt.MAINMENU
|
|
|
|
Case ProjectModeOpt.NEWCLIENT
|
|
Try
|
|
Map.refNewClientPageVM.InitNewClientPage()
|
|
Catch ex As Exception
|
|
MsgBox("Eccezione generata" & vbCrLf & ex.Message)
|
|
End Try
|
|
Case ProjectModeOpt.NEWKEY
|
|
Map.refNewKeyPageVM.InitNewKeyPage()
|
|
Case ProjectModeOpt.NEWLICENCE
|
|
Map.refNewLicencePageVM.InitNewLicencePage()
|
|
Case ProjectModeOpt.NEWPRODUCT
|
|
Map.refNewProductPageVM.InitNewProductPage()
|
|
Case ProjectModeOpt.NEWVERSION
|
|
Map.refNewVersionPageVM.InitVersionPage()
|
|
Case ProjectModeOpt.NEWRESELLER
|
|
Map.refNewResellerPageVM.InitNewResellerPage()
|
|
Case ProjectModeOpt.SEARCHCLIENT
|
|
Map.refSearchClientPageVM.InitSearchClientPage()
|
|
Case ProjectModeOpt.SEARCHKEY
|
|
Map.refSearchKeyPageVM.InitSearchKeyPage()
|
|
Case ProjectModeOpt.SEARCHLICENCE
|
|
Map.refSearchLicencePageVM.InitSearchLicencePage()
|
|
Case ProjectModeOpt.SEARCHPRODUCT
|
|
Map.refSearchProductPageVM.InitSearchProductPage()
|
|
Case ProjectModeOpt.SEARCHVERSION
|
|
Map.refSearchVersionPageVM.InitSearchVersionPage()
|
|
Case ProjectModeOpt.SEARCHRESELLER
|
|
Map.refSearchResellerPageVM.InitSearchResellerPage()
|
|
Case ProjectModeOpt.UPDATECLIENT
|
|
Map.refUpdateClientPageVM.InitUpdateClientPage()
|
|
Case ProjectModeOpt.UPDATEKEY
|
|
Map.refUpdateKeyPageVM.InitUpdateKeyPage()
|
|
Case ProjectModeOpt.UPDATELICENCE
|
|
Map.refUpdateLicencePageVM.InitUpdateLicencePage()
|
|
Case ProjectModeOpt.UPDATEPRODUCT
|
|
Map.refUpdateProductPageVM.InitUpdateProductPage()
|
|
Case ProjectModeOpt.UPDATEVERSION
|
|
Map.refUpdateVersionPageVM.InitUpdateVersionPage()
|
|
Case ProjectModeOpt.UPDATERESELLER
|
|
Map.refUpdateResellerPageVM.InitUpdateResellerPage()
|
|
End Select
|
|
NotifyPropertyChanged("ProjectContent")
|
|
End Set
|
|
End Property
|
|
|
|
Private m_MainMenuV As New MainMenuV
|
|
Private m_NewClientPageV As New NewClientPageV
|
|
Private m_NewKeyPageV As New NewKeyPageV
|
|
Private m_NewLicencePageV As New NewLicencePageV
|
|
Private m_NewProductPageV As New NewProductPageV
|
|
Private m_NewVersionPageV As New NewVersionPageV
|
|
Private m_NewResellerPageV As New NewResellerPageV
|
|
Private m_SearchClientPageV As New SearchClientPageV
|
|
Private m_SearchKeyPageV As New SearchKeyPageV
|
|
Private m_SearchLicencePageV As New SearchLicencePageV
|
|
Private m_SearchProductPageV As New SearchProductPageV
|
|
Private m_SearchVersionPageV As New SearchVersionPageV
|
|
Private m_SearchResellerPageV As New SearchResellerPageV
|
|
Private m_UpdateClientPageV As New UpdateClientPageV
|
|
Private m_UpdateKeyPageV As New UpdateKeyPageV
|
|
Private m_UpdateLicencePageV As New UpdateLicencePageV
|
|
Private m_UpdateProductPageV As New UpdateProductPageV
|
|
Private m_UpdateVersionPageV As New UpdateVersionPageV
|
|
Private m_UpdateResellerPageV As New UpdateResellerPageV
|
|
|
|
Public ReadOnly Property ProjectContent As FrameworkElement
|
|
Get
|
|
Select Case m_SelProjectMode
|
|
Case ProjectModeOpt.MAINMENU
|
|
Return m_MainMenuV
|
|
Case ProjectModeOpt.NEWCLIENT
|
|
Return m_NewClientPageV
|
|
Case ProjectModeOpt.NEWKEY
|
|
Return m_NewKeyPageV
|
|
Case ProjectModeOpt.NEWLICENCE
|
|
Return m_NewLicencePageV
|
|
Case ProjectModeOpt.NEWPRODUCT
|
|
Return m_NewProductPageV
|
|
Case ProjectModeOpt.NEWVERSION
|
|
Return m_NewVersionPageV
|
|
Case ProjectModeOpt.NEWRESELLER
|
|
Return m_NewResellerPageV
|
|
Case ProjectModeOpt.SEARCHCLIENT
|
|
Return m_SearchClientPageV
|
|
Case ProjectModeOpt.SEARCHKEY
|
|
Return m_SearchKeyPageV
|
|
Case ProjectModeOpt.SEARCHLICENCE
|
|
Return m_SearchLicencePageV
|
|
Case ProjectModeOpt.SEARCHPRODUCT
|
|
Return m_SearchProductPageV
|
|
Case ProjectModeOpt.SEARCHVERSION
|
|
Return m_SearchVersionPageV
|
|
Case ProjectModeOpt.SEARCHRESELLER
|
|
Return m_SearchResellerPageV
|
|
Case ProjectModeOpt.UPDATECLIENT
|
|
Return m_UpdateClientPageV
|
|
Case ProjectModeOpt.UPDATEKEY
|
|
Return m_UpdateKeyPageV
|
|
Case ProjectModeOpt.UPDATELICENCE
|
|
Return m_UpdateLicencePageV
|
|
Case ProjectModeOpt.UPDATEPRODUCT
|
|
Return m_UpdateProductPageV
|
|
Case ProjectModeOpt.UPDATEVERSION
|
|
Return m_UpdateVersionPageV
|
|
Case ProjectModeOpt.UPDATERESELLER
|
|
Return m_UpdateResellerPageV
|
|
Case Else
|
|
Return m_MainMenuV
|
|
End Select
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' FIELDS & PROPERTIES
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New()
|
|
' Avvio l'inizializzazione della mappa passandogli il riferimento al MainWindowVM
|
|
Map.BeginInit(Me)
|
|
' Costruisco model della MainWindow
|
|
m_MainWindowM = New MainWindowM
|
|
' Imposto pagina MainMenu all'avvio
|
|
SelProjectMode = MainWindowVM.ProjectModeOpt.MAINMENU
|
|
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
|
|
'ManageDb.CreateTable()
|
|
End Sub
|
|
|
|
#End Region ' METHODS
|
|
|
|
#Region "COMMANDS"
|
|
|
|
'#Region "AboutBoxCommand"
|
|
|
|
' ' Returns a command that manage the MainWindow_Unloaded command
|
|
' 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
|
|
|
|
' ' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
|
' Public Sub AboutBox(ByVal param As Object)
|
|
' Dim AboutBoxWindow As New AboutBoxV
|
|
' AboutBoxWindow.Owner = Application.Current.MainWindow
|
|
' AboutBoxWindow.ShowDialog()
|
|
' End Sub
|
|
|
|
'#End Region ' AboutBoxCommand
|
|
|
|
#End Region ' COMMANDS
|
|
|
|
End Class
|