303 lines
9.7 KiB
VB.net
303 lines
9.7 KiB
VB.net
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_Inputs_Visibility As Visibility
|
|
Public ReadOnly Property Inputs_Visibility As Visibility
|
|
Get
|
|
Return m_Inputs_Visibility
|
|
End Get
|
|
End Property
|
|
|
|
Private m_Outputs_Visibility As Visibility
|
|
Public ReadOnly Property Outputs_Visibility As Visibility
|
|
Get
|
|
Return m_Outputs_Visibility
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Optimizer_Visibility As Visibility
|
|
Get
|
|
Return Visibility.Visible
|
|
End Get
|
|
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
|
|
InitSUPERVISOR()
|
|
Case Pages.CONFIG
|
|
InitCONFIG()
|
|
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 Optimizer_Msg As String
|
|
Get
|
|
Return EgtMsg(61896)
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Supervisor_Msg As String
|
|
Get
|
|
Return EgtMsg(62500)
|
|
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
|
|
|
|
' Definizione comandi
|
|
Private m_cmdOptimizer As ICommand
|
|
|
|
#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 SetInputOutputVisibility()
|
|
If CurrentMachine.NCType = NCTypes.TPA Then
|
|
m_Inputs_Visibility = Visibility.Collapsed
|
|
m_Outputs_Visibility = Visibility.Collapsed
|
|
End If
|
|
End Sub
|
|
|
|
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
|
|
' aggiorno la visibilità delle colonne
|
|
For Each col In Map.refFeatureInPartInRawPartListVM.FeatureInPartInRawPartColumns
|
|
col.IsVisible = If(col.IsVisible, Visibility.Visible, Visibility.Collapsed)
|
|
Next
|
|
Map.refMainWindowVM.NotifyPropertyChanged(NameOf(Map.refMainWindowVM.nSelTabPage))
|
|
Return True
|
|
End Function
|
|
|
|
Private Function ExitSUPERVISOR(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)
|
|
Return True
|
|
End Function
|
|
|
|
|
|
Private Function InitCONFIG() As Boolean
|
|
Map.refMainWindowVM.NotifyPropertyChanged(NameOf(Map.refMainWindowVM.nSelTabPage))
|
|
Return True
|
|
End Function
|
|
|
|
Private Function ExitCONFIG() As Boolean
|
|
Map.refConfigurationPageVM.VerifyConfigPageModification()
|
|
Return True
|
|
End Function
|
|
|
|
Private Function InitINPUTS() As Boolean
|
|
' fermo e riavvio lettura variabili per includere quelle della pagina input
|
|
MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.STOPREAD_NUMFLEXIUM))
|
|
MachManaging.AddToCommandList(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.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.STOPREAD_NUMFLEXIUM))
|
|
MachManaging.AddToCommandList(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.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.STOPREAD_NUMFLEXIUM))
|
|
MachManaging.AddToCommandList(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.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.STOPREAD_NUMFLEXIUM))
|
|
MachManaging.AddToCommandList(ThreadCommand.CreateCommand(CommandTypes.READ_NUMFLEXIUM))
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' METHODS
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "Optimizer"
|
|
|
|
Public ReadOnly Property Optimizer_Command As ICommand
|
|
Get
|
|
If m_cmdOptimizer Is Nothing Then
|
|
m_cmdOptimizer = New Command(AddressOf Optimizer)
|
|
End If
|
|
Return m_cmdOptimizer
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub Optimizer()
|
|
Dim sOptimizerName As String = "Aedifica.OptimizerR32"
|
|
' recupero processo del supervisore
|
|
Dim localProc As Process() = Process.GetProcessesByName(sOptimizerName)
|
|
If localProc.Length > 0 Then
|
|
For Each p As Process In localProc
|
|
' porto in primo piano il ViewerOptimizer
|
|
BringWindowToFront(p.MainWindowHandle)
|
|
DbControllers.m_StatusMapController.UpdateAction(DbControllers.m_SupervisorId, Map.refSupervisorManagerVM.CurrProd.nProdId, -Pages.OPTIMIZERPAGE, StatusMapItemType.Comm, StatusMapOpType.OpenPageInViewOptimRequest, "")
|
|
Exit For
|
|
Next
|
|
Else
|
|
Dim sViewerOptimizerPath As String = Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory) & "\" & sOptimizerName & ".exe"
|
|
Try
|
|
Process.Start(sViewerOptimizerPath, "2 " & Pages.OPTIMIZERPAGE)
|
|
Catch ex As Exception
|
|
EgtOutLog("Error: impossible starting optimizer from path " & sViewerOptimizerPath)
|
|
End Try
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' Optimizer
|
|
|
|
#End Region ' COMMANDS
|
|
|
|
End Class |