902f610703
- alcune correzioni per reset stato visualizzazione solidi di strand - corretto salvataggio stato direzione su curve e griglia attiva.
164 lines
5.3 KiB
VB.net
164 lines
5.3 KiB
VB.net
Imports EgtWPFLib5
|
|
Imports EgtUILib
|
|
Imports System.Windows.Threading
|
|
|
|
Public Class SecondaryWindowVM
|
|
Inherits VMBase
|
|
|
|
Private m_SplashScreen_Timer As New DispatcherTimer
|
|
Private m_WaitAfterRender As Integer = 0
|
|
|
|
' Titolo
|
|
Private m_sTitle As String
|
|
Public Property sTitle As String
|
|
Get
|
|
Return m_sTitle
|
|
End Get
|
|
Set(value As String)
|
|
m_sTitle = value
|
|
NotifyPropertyChanged(NameOf(sTitle))
|
|
End Set
|
|
End Property
|
|
|
|
Private m_Visibility As Boolean
|
|
Public Property Visibility As Visibility
|
|
Get
|
|
Return If(m_Visibility, Visibility.Visible, Visibility.Collapsed)
|
|
End Get
|
|
Set(value As Visibility)
|
|
m_Visibility = (value = Visibility.Visible)
|
|
End Set
|
|
End Property
|
|
|
|
Friend Sub SetVisibility(bValue As Boolean)
|
|
If bValue <> m_Visibility Then
|
|
m_Visibility = bValue
|
|
NotifyPropertyChanged(NameOf(Visibility))
|
|
End If
|
|
End Sub
|
|
|
|
Friend Sub SetTitle(sTitle As String)
|
|
m_sTitle = sTitle
|
|
NotifyPropertyChanged(NameOf(sTitle))
|
|
End Sub
|
|
|
|
' definizione comandi
|
|
Private m_cmdAboutBox As ICommand
|
|
Private m_cmdCloseApplication As ICommand
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New()
|
|
' Creo riferimento a questa classe in Map
|
|
Map.SetRefSecondaryWindowVM(Me)
|
|
' imposto e avvio contatore SplashScreen
|
|
m_SplashScreen_Timer.Interval = New TimeSpan(0, 0, 0, 0, 500)
|
|
AddHandler m_SplashScreen_Timer.Tick, AddressOf SplashScreenTimer_Tick
|
|
If Not IsNothing(Map.refSplashScreen) Then
|
|
m_SplashScreen_Timer.Start()
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' CONSTRUCTOR
|
|
|
|
Friend Sub ContentRendered()
|
|
Map.refTopPanelVM.SelPage = Pages.NULL
|
|
' Seleziono la macchina impostata nel file ini
|
|
Map.refMachinePanelVM.LoadCurrentMachine()
|
|
' imposto SnapPoint
|
|
Map.refMyStatusBarVM.SetSnapPointType(Map.refSceneHostVM.SnapType)
|
|
Map.refMyStatusBarVM.SetMeasureUnit(EgtUiUnitsAreMM)
|
|
EgtSetView(VT.ISO_SW, False)
|
|
' provo a caricare progetto da linea di comando
|
|
If Not ProcessCommandLine() Then
|
|
' altrimenti creo nuovo progetto di partenza
|
|
Map.refProjManagerVM.NewProject(False)
|
|
End If
|
|
' leggo stati visualizzazione layer
|
|
Map.refViewLayerManagerVM.UpdateIsVisibleFromIni()
|
|
' resetto segnalazione modifiche
|
|
EgtResetModified()
|
|
' segno su contatore splashscreen render finito
|
|
m_WaitAfterRender = 1
|
|
End Sub
|
|
|
|
Private Sub SplashScreenTimer_Tick()
|
|
If m_WaitAfterRender > 1 Then
|
|
' chiudo SplashScreen
|
|
Map.refSplashScreen.Close()
|
|
ElseIf m_WaitAfterRender > 0 Then
|
|
m_WaitAfterRender += 1
|
|
End If
|
|
End Sub
|
|
|
|
Friend Function ProcessCommandLine() As Boolean
|
|
' Se non ci sono veri parametri su linea di comando, esco (il primo è sempre il nome del programma)
|
|
If Environment.GetCommandLineArgs.Count() <= 1 Then Return False
|
|
' Recupero il primo vero parametro che dovrebbe essere il nome con estensione di un file
|
|
Dim sFile As String = Environment.GetCommandLineArgs(1)
|
|
Dim sExt As String = IO.Path.GetExtension(sFile).ToLower()
|
|
If String.IsNullOrWhiteSpace(sFile) OrElse String.IsNullOrWhiteSpace(sExt) Then Return False
|
|
Return OpenStdFile(sFile)
|
|
End Function
|
|
|
|
Friend Function OpenStdFile(sFile As String) As Boolean
|
|
Dim nFileType As Integer = EgtGetFileType(sFile)
|
|
Select Case nFileType
|
|
Case FT.NGE
|
|
Return Map.refProjManagerVM.OpenProject(sFile)
|
|
'Case FT.DXF, FT.STL, FT._3MF, FT.OBJ, FT.CNC, FT.CSF, FT.BTL, FT.BTLX, FT.IMG, FT.PNT, FT.IGES, FT.STEP_, FT.ACIS, FT.PARASOLID, FT.JT, FT.VRML, FT.C3D
|
|
' Return m_Controller.ImportProject(sFile, False)
|
|
End Select
|
|
Return False
|
|
End Function
|
|
|
|
#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
|
|
|
|
#Region "CloseApplicationCommand"
|
|
|
|
' Returns a command that manage the MainWindow_Unloaded command
|
|
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
|
|
|
|
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
|
|
Public Sub CloseApplication(ByVal param As Object)
|
|
If Map.refSliceManagerVM.bCalculating Then
|
|
MessageBox.Show("Impossible closing software! Wait end of calculation!", "Error", MessageBoxButton.OK, MessageBoxImage.Error)
|
|
Return
|
|
End If
|
|
Map.refMainWindowVM.CloseApplication()
|
|
End Sub
|
|
|
|
#End Region ' CloseApplicationCommand
|
|
|
|
#End Region ' COMMANDS
|
|
|
|
End Class
|