- Gestita apertura diretta del progetto da file senza SplashScreen

- Impostata versione da note programma in SplashScreen
This commit is contained in:
Emmanuele Sassi
2022-10-27 11:14:51 +02:00
parent 799c0530be
commit a1c3a9fb30
5 changed files with 48 additions and 13 deletions
+7 -5
View File
@@ -5,11 +5,13 @@
Protected Overrides Sub OnStartup(e As StartupEventArgs)
MyBase.OnStartup(e)
ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose
' creo finestra SplashScreen
Dim SplashScreen As New SplashScreen
Me.MainWindow = SplashScreen
Me.MainWindow.Show()
Map.SetRefSplashScreen(SplashScreen)
If e.Args.Count = 0 Then
' creo finestra SplashScreen
Dim SplashScreen As New SplashScreen
Me.MainWindow = SplashScreen
Me.MainWindow.Show()
Map.SetRefSplashScreen(SplashScreen)
End If
' Creo la View principale
Me.MainWindow = New MainWindowV
+4 -4
View File
@@ -202,7 +202,7 @@ Public Class ProjManagerVM
OpenProject(Nothing)
End Sub
Friend Sub OpenProject(sFilePath As String)
Friend Function OpenProject(sFilePath As String) As Boolean
If String.IsNullOrEmpty(sFilePath) Then
' Recupero cartella dell'ultimo progetto aperto
Dim sDir As String = Map.refSceneHostVM.MainController.GetCurrFile()
@@ -212,11 +212,11 @@ Public Class ProjManagerVM
If Not String.IsNullOrWhiteSpace(sDir) Then
sDir = Path.GetDirectoryName(sDir)
End If
Map.refSceneHostVM.MainController.OpenProject(sDir)
Return Map.refSceneHostVM.MainController.OpenProject(sDir)
Else
Map.refSceneHostVM.MainController.OpenProject(sFilePath, False)
Return Map.refSceneHostVM.MainController.OpenProject(sFilePath, False)
End If
End Sub
End Function
#End Region ' OpenCommand
+29 -3
View File
@@ -54,7 +54,9 @@ Public Class SecondaryWindowVM
' imposto e avvio contatore SplashScreen
m_SplashScreen_Timer.Interval = New TimeSpan(0, 0, 0, 0, 500)
AddHandler m_SplashScreen_Timer.Tick, AddressOf SplashScreenTimer_Tick
m_SplashScreen_Timer.Start()
If Not IsNothing(Map.refSplashScreen) Then
m_SplashScreen_Timer.Start()
End If
End Sub
#End Region ' CONSTRUCTOR
@@ -67,8 +69,11 @@ Public Class SecondaryWindowVM
Map.refMyStatusBarVM.SetSnapPointType(Map.refSceneHostVM.SnapType)
Map.refMyStatusBarVM.SetMeasureUnit(EgtUiUnitsAreMM)
EgtSetView(VT.ISO_SW, False)
' creo nuovo progetto di partenza
Map.refProjManagerVM.NewProject(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
@@ -86,6 +91,27 @@ Public Class SecondaryWindowVM
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"
+1 -1
View File
@@ -18,7 +18,7 @@
FontFamily="/Resources/Fonts/#Roboto"
FontWeight="Light"
Margin="463,125,0,0"/>
<TextBlock Text="Version 2.4h1"
<TextBlock x:Name="VersionTxBl"
FontSize="14"
FontFamily="/Resources/Fonts/#Roboto"
Margin="500,175,0,0"/>
+7
View File
@@ -1,3 +1,10 @@
Public Class SplashScreen
Private Sub SplashScreen_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
VersionTxBl.Text = "Version " & My.Application.Info.Version.Major.ToString() &
"." & My.Application.Info.Version.Minor.ToString() &
(ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() &
My.Application.Info.Version.Revision.ToString()
End Sub
End Class