Files
egtbeamwall/EgtBEAMWALL.Supervisor/MainMenu/MainMenuVM.vb
T

288 lines
11 KiB
VB.net

Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtBEAMWALL.Core
Imports EgtBEAMWALL.Core.ConstBeam
Imports EgtUILib
Imports EgtWPFLib5
Public Class MainMenuVM
Inherits VMBase
#Region "FIELDS & PROPERTIES"
Private m_MainMenu_IsEnabled As Boolean = True
Public ReadOnly Property MainMenu_IsEnabled As Boolean
Get
Return m_MainMenu_IsEnabled
End Get
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
Public Property Inputs_IsChecked As Boolean
Get
Return m_SelPage = Pages.INPUTS
End Get
Set(value As Boolean)
If value Then SelPage = Pages.INPUTS
End Set
End Property
Public Property Outputs_IsChecked As Boolean
Get
Return m_SelPage = Pages.OUTPUTS
End Get
Set(value As Boolean)
If value Then SelPage = Pages.OUTPUTS
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)
Dim bOk As Boolean = True
' Esco dallo stato corrente
Select Case m_SelPage
Case Pages.SUPERVISOR
bOk = ExitSUPERVISOR(bVerifyModification)
Case Pages.CONFIG
bOk = ExitCONFIG()
Case Pages.INPUTS
bOk = ExitINPUTS()
Case Pages.OUTPUTS
bOk = ExitOUTPUTS()
End Select
If bOk Then
' Entro nel nuovo stato
m_SelPage = Page
Select Case m_SelPage
Case Pages.SUPERVISOR
' Map.refMachGroupPanelVM.SetMachGroupState(False)
InitSUPERVISOR()
'Map.refTopCommandBarVM.IsEnabled = False
Case Pages.CONFIG
InitCONFIG()
'Map.refMachGroupPanelVM.SetMachGroupState(False)
'Map.refCONFIGTabVM.InitCONFIGation()
'Map.refTopCommandBarVM.IsEnabled = False
Case Pages.INPUTS
InitINPUTS()
Case Pages.OUTPUTS
InitOUTPUTS()
End Select
End If
' aggiorno visualizzazione RadioButton
NotifyPropertyChanged(NameOf(Supervisor_IsChecked))
NotifyPropertyChanged(NameOf(Config_IsChecked))
NotifyPropertyChanged(NameOf(Inputs_IsChecked))
NotifyPropertyChanged(NameOf(Outputs_IsChecked))
End Sub
#Region "Messages"
Public ReadOnly Property Supervisor_Msg As String
Get
Return EgtMsg(62500)
End Get
End Property
Public ReadOnly Property Optimizer_Msg As String
Get
Return EgtMsg(61831)
End Get
End Property
Public ReadOnly Property Configuration_Msg As String
Get
Return EgtMsg(61832)
End Get
End Property
Public ReadOnly Property Inputs_Msg As String
Get
Return EgtMsg(61930)
End Get
End Property
Public ReadOnly Property Outputs_Msg As String
Get
Return EgtMsg(61931)
End Get
End Property
#End Region ' Messages
#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"
Friend Sub SetMainMenuIsEnabled(bIsEnabled As Boolean)
m_MainMenu_IsEnabled = bIsEnabled
NotifyPropertyChanged(NameOf(MainMenu_IsEnabled))
End Sub
Private Function InitSUPERVISOR() As Boolean
Map.refProjectVM.SetBottomPanel_Visibility(True)
Map.refProjectVM.SetLeftPanel_Visibility(True)
Map.refLeftPanelVM.UpdateView()
Map.refProjectVM.SetPartManager_Visibility(False)
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()
' aggiorno le colonne in base al tipo progetto
If Not IsNothing(Map.refSupervisorManagerVM.CurrProd) Then
Map.refRawPartListVM.UpdateColumns(Map.refSupervisorManagerVM.CurrProd.nType)
Map.refPartInRawPartListVM.UpdateColumns(Map.refSupervisorManagerVM.CurrProd.nType)
Else
Map.refRawPartListVM.UpdateColumns(BWType.BEAM)
Map.refPartInRawPartListVM.UpdateColumns(BWType.BEAM)
End If
' setto la visibilità delle colonne delle EgtDataGrid
For Each col In Map.refFeatureInPartInRawPartListVM.FeatureInPartInRawPartColumns
col.ColumnVisibility = If(col.Visible, Visibility.Visible, Visibility.Collapsed)
Next
'' apro progetto proj
'If Not IsNothing(Map.refProjManagerVM.CurrProj) Then
' If Map.refProjManagerVM.CurrProj.bReloadProject Then
' Map.refProjManagerVM.OpenProject(Map.refProjManagerVM.CurrProj)
' ' aggiorno le colonne in base al tipo progetto
' If Not IsNothing(Map.refProjectVM.BTLStructureVM) Then
' Map.refRawPartListVM.UpdateColumns(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
' Map.refPartInRawPartListVM.UpdateColumns(Map.refProjectVM.BTLStructureVM.nPROJTYPE)
' Else
' Map.refRawPartListVM.UpdateColumns(BWType.BEAM)
' Map.refPartInRawPartListVM.UpdateColumns(BWType.BEAM)
' End If
' DbControllers.m_ProjController.LockByProjId(Map.refProjManagerVM.CurrProj.nProjId, True)
' ' aggiorno titolo
' Map.refMainWindowVM.UpdateTitle()
' Map.refProjManagerVM.NotifyPropertyChanged(NameOf(Map.refProjManagerVM.MruFileNames))
' Else
' ' verifico se il prod di provenienza ha piu' proj
' If Not IsNothing(Map.refProdManagerVM.CurrProd) AndAlso Map.refProdManagerVM.CurrProd.nProjIdList.Count > 1 Then
' ' se si rigenero BTLStructure
' Map.refProjectVM.BTLStructureVM = New BTLStructureVM(BTLStructureM.CreateBTLStructure(Map.refProjManagerVM.CurrProj.nProjId))
' End If
' ' mostro tutti i pezzi
' Map.refShowBeamPanelVM.ShowAll()
' Map.refProjManagerVM.CurrProj.SetReloadProject(True)
' End If
' DbControllers.m_ProjController.LockByProjId(Map.refProjManagerVM.CurrProj.nProjId, True)
'Else
' Map.refSceneHostVM.MainController.NewProject()
' Map.refProjectVM.BTLStructureVM = Nothing
' Map.refProjectVM.MachGroupPanelVM = Nothing
'End If
Map.refMainWindowVM.NotifyPropertyChanged(NameOf(Map.refMainWindowVM.nSelTabPage))
Return True
End Function
Private Function ExitSUPERVISOR(bVerifyModification As Boolean) As Boolean
''' verifico se progetto modificato, e chiedo se salvare
''If bVerifyModification Then
'' If Not ProjFileVM.VerifyProjectModification(Map.refProjManagerVM.CurrProj, ProjectType.PROJ) Then
'' Return False
'' End If
''End If
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)
Return True
End Function
Private Function InitCONFIG() As Boolean
Map.refMainWindowVM.NotifyPropertyChanged(NameOf(Map.refMainWindowVM.nSelTabPage))
'' ricarico la lista delle colonne delle DataGrid in ConfigurationPage
'If Not IsNothing(Map.refConfigurationPageVM) Then Map.refConfigurationPageVM.LoadConfigDGColumns()
Return True
End Function
Private Function ExitCONFIG() As Boolean
Map.refConfigurationPageVM.VerifyConfigPageModification()
' ricarico le EgtDataGrid del programma con le colonne customizzate
Map.refRawPartListVM.RawPartColumns.Clear()
Map.refPartInRawPartListVM.PartInRawPartColumns.Clear()
Map.refFeatureInPartInRawPartListVM.FeatureInPartInRawPartColumns.Clear()
GetPrivateProfileColumns(S_RAWPARTLIST_SUPERVISOR, Map.refRawPartListVM.RawPartColumns)
GetPrivateProfileColumns(S_PARTINRAWPARTLIST_SUPERVISOR, Map.refPartInRawPartListVM.PartInRawPartColumns)
GetPrivateProfileColumns(S_FEATUREINPARTINRAWPARTLIST_SUPERVISOR, Map.refFeatureInPartInRawPartListVM.FeatureInPartInRawPartColumns)
Return True
End Function
Private Function InitINPUTS() As Boolean
' fermo e riavvio lettura variabili per includere quelle della pagina input
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.STOPREAD_NUMFLEXIUM))
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.READ_NUMFLEXIUM))
Map.refMainWindowVM.NotifyPropertyChanged(NameOf(Map.refMainWindowVM.nSelTabPage))
Return True
End Function
Private Function ExitINPUTS() As Boolean
' fermo e riavvio lettura variabili per includere quelle della pagina input
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.STOPREAD_NUMFLEXIUM))
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.READ_NUMFLEXIUM))
Return True
End Function
Private Function InitOUTPUTS() As Boolean
' fermo e riavvio lettura variabili per includere quelle della pagina input
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.STOPREAD_NUMFLEXIUM))
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.READ_NUMFLEXIUM))
Map.refMainWindowVM.NotifyPropertyChanged(NameOf(Map.refMainWindowVM.nSelTabPage))
Return True
End Function
Private Function ExitOUTPUTS() As Boolean
' fermo e riavvio lettura variabili per includere quelle della pagina input
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.STOPREAD_NUMFLEXIUM))
MachManaging.CommandList.Add(ThreadCommand.CreateCommand(CommandTypes.READ_NUMFLEXIUM))
Return True
End Function
#End Region ' METHODS
End Class