206 lines
7.3 KiB
VB.net
206 lines
7.3 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports System.IO
|
|
Imports EgtBEAMWALL.Core.ConstBeam
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
|
|
Public Class MainMenuVM
|
|
Inherits VMBase
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Public Property View_IsChecked As Boolean
|
|
Get
|
|
Return m_SelPage = Pages.VIEW
|
|
End Get
|
|
Set(value As Boolean)
|
|
If value Then SelPage = Pages.VIEW
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Machining_IsChecked As Boolean
|
|
Get
|
|
Return m_SelPage = Pages.MACHINING
|
|
End Get
|
|
Set(value As Boolean)
|
|
If value Then SelPage = Pages.MACHINING
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Supervisor_IsChecked As Boolean
|
|
Get
|
|
Return m_SelPage = Pages.SUPERVISOR
|
|
End Get
|
|
Set(value As Boolean)
|
|
If value Then SelPage = Pages.SUPERVISOR
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Config_IsChecked As Boolean
|
|
Get
|
|
Return m_SelPage = Pages.CONFIG
|
|
End Get
|
|
Set(value As Boolean)
|
|
If value Then SelPage = Pages.CONFIG
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SelPage As Integer = -1
|
|
Public Property SelPage As Integer
|
|
Get
|
|
Return m_SelPage
|
|
End Get
|
|
Set(value As Integer)
|
|
' lancio selezione pagina con verifica file modificato
|
|
SetSelPage(value)
|
|
End Set
|
|
End Property
|
|
' funzione che permette di cambiare pagina
|
|
' bVerifyModification: se vero verifica modifiche su file e chiede di salvare
|
|
Friend Sub SetSelPage(Page As Pages, Optional bVerifyModification As Boolean = True)
|
|
' Esco dallo stato corrente
|
|
Select Case m_SelPage
|
|
Case Pages.VIEW
|
|
ExitVIEW(bVerifyModification)
|
|
Case Pages.MACHINING
|
|
ExitMACHINING(bVerifyModification)
|
|
Case Pages.SUPERVISOR
|
|
'Map.refSUPERVISORTabVM.ExitSUPERVISOR()
|
|
Case Pages.CONFIG
|
|
ExitCONFIG()
|
|
End Select
|
|
' Entro nel nuovo stato
|
|
m_SelPage = Page
|
|
Select Case m_SelPage
|
|
Case Pages.VIEW
|
|
' Map.refMachGroupPanelVM.SetMachGroupState(False)
|
|
InitVIEW()
|
|
'Map.refTopCommandBarVM.IsEnabled = False
|
|
Case Pages.MACHINING
|
|
' Map.refMachGroupPanelVM.SetMachGroupState(True)
|
|
InitMACHINING()
|
|
'Map.refTopCommandBarVM.IsEnabled = True
|
|
Case Pages.SUPERVISOR
|
|
'Map.refMachGroupPanelVM.SetMachGroupState(False)
|
|
'Map.refSUPERVISORTabVM.InitSUPERVISOR()
|
|
'Map.refTopCommandBarVM.IsEnabled = False
|
|
Case Pages.CONFIG
|
|
InitCONFIG()
|
|
'Map.refMachGroupPanelVM.SetMachGroupState(False)
|
|
'Map.refCONFIGTabVM.InitCONFIGation()
|
|
'Map.refTopCommandBarVM.IsEnabled = False
|
|
End Select
|
|
' aggiorno visualizzazione RadioButton
|
|
NotifyPropertyChanged("View_IsChecked")
|
|
NotifyPropertyChanged("Machining_IsChecked")
|
|
NotifyPropertyChanged("Supervisor_IsChecked")
|
|
NotifyPropertyChanged("Config_IsChecked")
|
|
Map.refProjectVM.NotifyPropertyChanged("SelItem")
|
|
End Sub
|
|
|
|
#End Region ' Fields & Properties
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New()
|
|
' Creo riferimento a questa classe in EgtCAM5Map
|
|
Map.SetRefMainMenuVM(Me)
|
|
|
|
End Sub
|
|
|
|
#End Region ' CONSTRUCTOR
|
|
|
|
#Region "METHODS"
|
|
|
|
Private Function InitVIEW() As Boolean
|
|
Map.refProjectVM.SetBottomPanel_Visibility(True)
|
|
Map.refProjectVM.SetLeftPanel_Visibility(True)
|
|
Map.refLeftPanelVM.UpdateView()
|
|
Map.refProjectVM.SetPartManager_Visibility(True)
|
|
Map.refProjectVM.SetFeatureManager_Visibility(True)
|
|
Map.refProjectVM.SetTopPanel_Visibility(False)
|
|
Map.refProjectVM.SetShowBeamPanel_Visibility(True)
|
|
Map.refProjectVM.SetProjManager_Visibility(True)
|
|
Map.refProjectVM.SetProdManager_Visibility(False)
|
|
Map.refProjectVM.NotifyAllPanelVisibility()
|
|
' apro progetto proj
|
|
If Not IsNothing(Map.refProjManagerVM.CurrProj) Then
|
|
Map.refProjManagerVM.OpenProject(Map.refProjManagerVM.CurrProj)
|
|
End If
|
|
Map.refMainWindowVM.NotifyPropertyChanged("nSelTabPage")
|
|
Return True
|
|
End Function
|
|
|
|
Private Function ExitVIEW(bVerifyModification As Boolean) As Boolean
|
|
Map.refProjectVM.SetBottomPanel_Visibility(False)
|
|
Map.refProjectVM.SetLeftPanel_Visibility(True)
|
|
Map.refProjectVM.SetPartManager_Visibility(False)
|
|
Map.refProjectVM.SetFeatureManager_Visibility(False)
|
|
Map.refProjectVM.SetTopPanel_Visibility(True)
|
|
Map.refProjectVM.SetShowBeamPanel_Visibility(False)
|
|
Map.refProjectVM.SetProjManager_Visibility(False)
|
|
Map.refProjectVM.SetProdManager_Visibility(True)
|
|
' verifico se progetto modificato, e chiedo se salvare
|
|
If bVerifyModification Then ProjFileVM.VerifyProjectModification(Map.refProjManagerVM.CurrProj, ProjectType.PROJ)
|
|
Return True
|
|
End Function
|
|
|
|
Private Function InitMACHINING() As Boolean
|
|
Map.refProjectVM.SetBottomPanel_Visibility(False)
|
|
Map.refProjectVM.SetLeftPanel_Visibility(True)
|
|
Map.refLeftPanelVM.UpdateView()
|
|
Map.refProjectVM.SetPartManager_Visibility(False)
|
|
Map.refProjectVM.SetFeatureManager_Visibility(False)
|
|
Map.refProjectVM.SetTopPanel_Visibility(True)
|
|
Map.refProjectVM.SetShowBeamPanel_Visibility(False)
|
|
Map.refProjectVM.SetProjManager_Visibility(False)
|
|
Map.refProjectVM.SetProdManager_Visibility(True)
|
|
Map.refProjectVM.NotifyAllPanelVisibility()
|
|
' inizializzo gruppi di lavorazione
|
|
If Not IsNothing(Map.refProdManagerVM.CurrProd) AndAlso Not IsNothing(Map.refProdManagerVM.CurrProd.nProdId) AndAlso Map.refProdManagerVM.CurrProd.nProdId > 0 Then
|
|
If File.Exists(Map.refProdManagerVM.CurrProd.sProdPath) Then
|
|
' apro progetto
|
|
Map.refSceneHostVM.MainController.OpenProject(Map.refProdManagerVM.CurrProd.sProdPath, False)
|
|
' inizializzo gruppi di lavorazione
|
|
Map.refMachGroupPanelVM.InitMachGroupList()
|
|
Else
|
|
MessageBox.Show("File non trovato!!")
|
|
End If
|
|
Else
|
|
Map.refSceneHostVM.MainController.NewProject()
|
|
Map.refProjectVM.BTLStructureVM = Nothing
|
|
End If
|
|
Map.refMainWindowVM.NotifyPropertyChanged("nSelTabPage")
|
|
Return True
|
|
End Function
|
|
|
|
Private Function ExitMACHINING(bVerifyModification As Boolean) As Boolean
|
|
Map.refProjectVM.SetBottomPanel_Visibility(True)
|
|
Map.refProjectVM.SetLeftPanel_Visibility(False)
|
|
Map.refProjectVM.SetPartManager_Visibility(True)
|
|
Map.refProjectVM.SetFeatureManager_Visibility(True)
|
|
Map.refProjectVM.SetTopPanel_Visibility(False)
|
|
Map.refProjectVM.SetShowBeamPanel_Visibility(True)
|
|
Map.refProjectVM.SetProjManager_Visibility(True)
|
|
Map.refProjectVM.SetProdManager_Visibility(False)
|
|
' verifico se progetto modificato, e chiedo se salvare
|
|
If bVerifyModification Then ProjFileVM.VerifyProjectModification(Map.refProdManagerVM.CurrProd, ProjectType.PROD)
|
|
EgtResetCurrMachGroup()
|
|
Return True
|
|
End Function
|
|
|
|
Private Function InitCONFIG() As Boolean
|
|
Map.refMainWindowVM.NotifyPropertyChanged("nSelTabPage")
|
|
Return True
|
|
End Function
|
|
|
|
Private Function ExitCONFIG() As Boolean
|
|
Map.refConfigurationPageVM.VerifyConfigPageModification()
|
|
' resetto flag inserimento password
|
|
Map.refConfigurationPageVM.bModifyMachParam = False
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' METHODS
|
|
|
|
End Class |