Avvio programma con Args esterno
This commit is contained in:
+1
-1
@@ -9,7 +9,7 @@ Class Application
|
||||
MyBase.OnStartup(e)
|
||||
ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose
|
||||
' Creo la View principale
|
||||
Me.MainWindow = New MainWindowV
|
||||
Me.MainWindow = New MainWindowV(e.Args)
|
||||
System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop(Me.MainWindow)
|
||||
' Mostro la View principale
|
||||
Me.MainWindow.Show()
|
||||
|
||||
@@ -1058,6 +1058,8 @@ Public Class Assembly
|
||||
If Not File.Exists(sPathDDF) Then
|
||||
Return
|
||||
End If
|
||||
' verifico se il file è un template
|
||||
Dim bIsTemplate As Boolean = (Path.GetExtension(sPathDDF).ToLower = ".ddt")
|
||||
ReadAssembly.FileContent = File.ReadAllLines(sPathDDF)
|
||||
' se il file esiste ma è vuoto
|
||||
If ReadAssembly.FileContent.Count = 0 Then
|
||||
@@ -1080,7 +1082,7 @@ Public Class Assembly
|
||||
Map.refMainWindowVM.SelectedPage = MainWindowVM.ListPageEnum.nNothingSelected
|
||||
Else
|
||||
Map.refSceneManagerVM.EnableRefresh = False
|
||||
If ReadAssembly.GetDDFDoor(IndexLine, sErrorInfo) = -1 Then
|
||||
If ReadAssembly.GetDDFDoor(IndexLine, sErrorInfo, bIsTemplate) = -1 Then
|
||||
' errore nella lettura di un part: blocco tutto
|
||||
ReadAssembly = Nothing
|
||||
Map.refAssemblyManagerVM.CurrProject.SelAssemblyName.IsModified = False
|
||||
@@ -1468,10 +1470,11 @@ Public Class Assembly
|
||||
End Function
|
||||
|
||||
' dopo la lettura delle informazioni dell'assemblato
|
||||
Private Function GetDDFDoor(IndexLine As Integer, ByRef sErrorInfo As String) As Integer
|
||||
Private Function GetDDFDoor(IndexLine As Integer, ByRef sErrorInfo As String, Optional ByVal bIsTemplate As Boolean = False) As Integer
|
||||
Dim Line As Integer = IndexLine
|
||||
While Line < FileContent.Count - 1 AndAlso Not Search3Dots(FileContent(Line))
|
||||
Dim Local_PartDoor As New PartDoor
|
||||
Local_PartDoor.IsTemplate = bIsTemplate
|
||||
Dim Local_Door As New Part(Local_PartDoor)
|
||||
' carcio la liste delle propiretà
|
||||
'CreateNewPropertiesList(Local_Door.PropertiesList, Local_Door.SelectedMaterial)
|
||||
|
||||
@@ -7,6 +7,16 @@ Imports EgtWPFLib5
|
||||
Public Class PartDoor
|
||||
Inherits VMBase
|
||||
|
||||
Private m_IsTemplate As Boolean = False
|
||||
Public Property IsTemplate As Boolean
|
||||
Get
|
||||
Return m_IsTemplate
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
m_IsTemplate = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private m_Door As Part
|
||||
Public Property Door As Part
|
||||
Get
|
||||
|
||||
@@ -981,6 +981,10 @@ Public Class AssemblyManagerVM
|
||||
OpenedAssName.IsModified = Part.FirstReadingEdge
|
||||
If OptionModule.m_ConfigurationSoftware = ConfigType.Door Then
|
||||
DdfFile.WriteDDFPart(OpenedAssName.SelAssembly.ListPartDoor(0).Door, sTempFile, True, False)
|
||||
If OptionModule.AdjustDDT Then
|
||||
DdfFile.WriteDDFPart(OpenedAssName.SelAssembly.ListPartDoor(0).Door, OptionModule.SaveFileNameFromArgs, True, False)
|
||||
End
|
||||
End If
|
||||
' aggiorno elenco quotature
|
||||
Map.refDimensioningPanelVM.LoadHardwareDimList()
|
||||
ExecDoors(Map.refSceneManagerVM.ProjectScene, sTempFile, False)
|
||||
|
||||
@@ -2034,6 +2034,9 @@ Public Class Part
|
||||
If Index > FileContent.Count() - 1 Then Return -1
|
||||
Dim sLine As String = RemoveComment(FileContent(Index))
|
||||
Dim Width As String = GetValueWithKey(sLine, K_WIDTH)
|
||||
If m_refPartDoor.IsTemplate And OptionModule.AdjustDDT Then
|
||||
Width = OptionModule.m_Width
|
||||
End If
|
||||
If String.IsNullOrWhiteSpace(Width) Then
|
||||
If Not SearchKey(sLine, K_WIDTH) Then Return -1
|
||||
' altrimenti
|
||||
@@ -2051,6 +2054,9 @@ Public Class Part
|
||||
If Index > FileContent.Count() - 1 Then Return -1
|
||||
sLine = RemoveComment(FileContent(Index))
|
||||
Dim Height As String = GetValueWithKey(sLine, K_HEIGHT)
|
||||
If m_refPartDoor.IsTemplate And OptionModule.AdjustDDT Then
|
||||
Height = OptionModule.m_Height
|
||||
End If
|
||||
If String.IsNullOrWhiteSpace(Height) Then
|
||||
If Not SearchKey(sLine, K_HEIGHT) Then Return -1
|
||||
' altrimenti
|
||||
@@ -2068,6 +2074,9 @@ Public Class Part
|
||||
If Index > FileContent.Count() - 1 Then Return -1
|
||||
sLine = RemoveComment(FileContent(Index))
|
||||
Dim Thickness As String = GetValueWithKey(sLine, K_THICKNESS)
|
||||
If m_refPartDoor.IsTemplate And OptionModule.AdjustDDT Then
|
||||
Height = OptionModule.m_Thickness
|
||||
End If
|
||||
If String.IsNullOrWhiteSpace(Thickness) Then
|
||||
If Not SearchKey(sLine, K_THICKNESS) Then Return -1
|
||||
' altrimenti
|
||||
|
||||
@@ -2,8 +2,21 @@
|
||||
|
||||
Class MainWindowV
|
||||
|
||||
Private m_args() As String = Nothing
|
||||
|
||||
#Region "EVENTS"
|
||||
|
||||
Public Sub New(args As String())
|
||||
|
||||
' La chiamata è richiesta dalla finestra di progettazione.
|
||||
InitializeComponent()
|
||||
If args.Length > 0 Then
|
||||
m_args = args
|
||||
End If
|
||||
' Aggiungere le eventuali istruzioni di inizializzazione dopo la chiamata a InitializeComponent().
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub MainWindowV_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
' Carico e imposto posizione finestra
|
||||
WinPosFromIniToWindow(S_GENERAL, K_WINPLACE, Me)
|
||||
@@ -12,6 +25,28 @@ Class MainWindowV
|
||||
Private Sub MainWindowV_ContentRendered(sender As Object, e As EventArgs) Handles Me.ContentRendered
|
||||
' se è assente la chiave di protezione non mostro la finestra Launcher
|
||||
If Map.refSceneManagerVM.bProtectKey Then
|
||||
If Not IsNothing(m_args) Then
|
||||
' leggo gli argomenti
|
||||
Dim Items() As String = m_args(0).Split(";"c)
|
||||
If Items.Length = 5 Then
|
||||
' Avvio progetto - LauncherOpt.Open_last_project (1)
|
||||
OptionModule.m_bLauncherOpenOnce = True
|
||||
' Indico il percorso del file
|
||||
OptionModule.FileNameFromArgs = Items(0)
|
||||
' Assegno i valore Width, Height, Thickness
|
||||
OptionModule.m_Width = Items(1)
|
||||
OptionModule.m_Height = Items(2)
|
||||
OptionModule.m_Thickness = Items(3)
|
||||
' Indico il percoso di salvataggio file DDF
|
||||
OptionModule.SaveFileNameFromArgs = Items(4)
|
||||
' abilito lettura dati
|
||||
OptionModule.AdjustDDT = True
|
||||
Else
|
||||
' blocco lettura dati
|
||||
OptionModule.AdjustDDT = False
|
||||
End If
|
||||
|
||||
End If
|
||||
Map.refMainWindowVM.SetLauncher()
|
||||
Map.refMainWindowVM.ShowErrorCompoLoad()
|
||||
End If
|
||||
|
||||
@@ -366,6 +366,10 @@ Public Class MainWindowVM
|
||||
Case LauncherOpt.Open_last_project
|
||||
' se definito ultimo progetto, lo apro
|
||||
If GetMainPrivateProfileString(S_LAUNCHERWINDOW, K_LASTPROJECT, "", m_sLastProject) > 0 Then
|
||||
' se caricato il nome in avvio del programma allora sovrascrivo
|
||||
If OptionModule.AdjustDDT Then
|
||||
m_sLastProject = OptionModule.FileNameFromArgs
|
||||
End If
|
||||
Map.refProjectManagerVM.OpenLastProject()
|
||||
End If
|
||||
Case Else
|
||||
|
||||
@@ -72,5 +72,5 @@ Imports System.Windows
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.6.9.1")>
|
||||
<Assembly: AssemblyFileVersion("2.6.9.1")>
|
||||
<Assembly: AssemblyVersion("2.6.10.1")>
|
||||
<Assembly: AssemblyFileVersion("2.6.10.1")>
|
||||
|
||||
@@ -7,6 +7,11 @@ Friend Module OptionModule
|
||||
' flag per modalità di visualizzazione file (solo lettura)
|
||||
Friend ReadOnlyDDF As Boolean = False
|
||||
|
||||
' flag per forzare l'aggiornamento delle dimensioni anta dei file DDT
|
||||
Friend AdjustDDT As Boolean = False
|
||||
Friend FileNameFromArgs As String = String.Empty
|
||||
Friend SaveFileNameFromArgs As String = String.Empty
|
||||
|
||||
' Parametri che contengono lista delle lingue disponibili e lingua selezionata
|
||||
Friend m_LanguageList As New ObservableCollection(Of Language)
|
||||
Friend m_SelectedLanguage As Language
|
||||
|
||||
Reference in New Issue
Block a user