123 lines
4.5 KiB
VB.net
123 lines
4.5 KiB
VB.net
Imports System.Windows.Interop
|
|
Imports EgtUILib
|
|
Imports EgtWPFLib5
|
|
Imports System.IO
|
|
|
|
Class MainWindowV
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Private m_MainWindowVM As MainWindowVM
|
|
|
|
#End Region ' Fields & Properties
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New()
|
|
m_MainWindowVM = New MainWindowVM
|
|
' La chiamata è richiesta dalla finestra di progettazione.
|
|
InitializeComponent()
|
|
' Aggiungere le eventuali istruzioni di inizializzazione dopo la chiamata a InitializeComponent().
|
|
Me.DataContext = m_MainWindowVM
|
|
' creo finestra della scena
|
|
AddHandler Me.ContentRendered, AddressOf MainWindowV_ContentRendered
|
|
AddHandler Me.Loaded, AddressOf MainWindowV_Loaded
|
|
AddHandler Me.Closing, AddressOf MainWindowV_Closing
|
|
AddHandler Me.StateChanged, AddressOf MainWindowV_StateChanged
|
|
Map.SetRefMainWindowV(Me)
|
|
|
|
Dim Dir_Vein3D As String = String.Empty
|
|
Dim Path_CreateSolid As String = CREATESOLID_FILENAME
|
|
Dim Path_OperationSolid As String = OPERATIONSOLID_FILENAME
|
|
|
|
' carico il file LUA con tutte le funzioni di accoppiamento
|
|
GetMainPrivateProfileString(K_VEIND3D, VEIND3D_DIR, "", Dir_Vein3D)
|
|
' Path del lua da utilizzare
|
|
GetMainPrivateProfileString(K_VEIND3D, CREATESOLID_DIR, "", Path_CreateSolid)
|
|
' Path del lua da utilizzare
|
|
GetMainPrivateProfileString(K_VEIND3D, OPERATIONSOLID_DIR, "", Path_OperationSolid)
|
|
|
|
' avvio il file OperationOnSolid.lua
|
|
Dim sLuaPath As String = Dir_Vein3D & Path_OperationSolid
|
|
' Verifico esistenza file Matching nel direttorio passato
|
|
If Not File.Exists(sLuaPath) Then
|
|
EgtOutLog("Matching error: missing file (" & sLuaPath & ")")
|
|
Return
|
|
End If
|
|
' Parsing
|
|
EgtLuaExecFile(sLuaPath)
|
|
AssLog(Date.Now.ToString & " Avvio Assembler")
|
|
EgtLuaSetGlobBoolVar("ASS.bActiveHist", True) ' attivo il salvataggio della storia
|
|
If EgtLuaSetGlobBoolVar("ASS.bSaveHist", True) Then AssLog("ASS.bSaveHist = True")
|
|
If EgtLuaSetGlobBoolVar("ASS.bSaveTemp", False) Then AssLog("ASS.bSaveTemp = False")
|
|
|
|
' avvio il file CreateSOLID_FromPartsInPark.lua
|
|
sLuaPath = Dir_Vein3D & Path_CreateSolid
|
|
' Verifico esistenza file Matching nel direttorio passato
|
|
If Not File.Exists(sLuaPath) Then
|
|
EgtOutLog("Matching error: missing file (" & sLuaPath & ")")
|
|
Return
|
|
End If
|
|
' Parsing
|
|
EgtLuaExecFile(sLuaPath)
|
|
|
|
' avvio il file TemplateTool.lua
|
|
sLuaPath = Dir_Vein3D & "TemplateTool.lua"
|
|
' Verifico esistenza file Matching nel direttorio passato
|
|
If Not File.Exists(sLuaPath) Then
|
|
EgtOutLog("Matching error: missing file (" & sLuaPath & ")")
|
|
Return
|
|
End If
|
|
' Parsing
|
|
EgtLuaExecFile(sLuaPath)
|
|
End Sub
|
|
|
|
#End Region ' Constructor
|
|
|
|
#Region "EVENTS"
|
|
|
|
Private Sub MainWindowV_Loaded(sender As Object, e As RoutedEventArgs)
|
|
' Carico e imposto posizione finestra
|
|
WinPosFromIniToWindow(S_GENERAL, K_WINPLACE, Me)
|
|
' Recupero e imposto handle finestra principale
|
|
Dim hMainWnd As IntPtr = New WindowInteropHelper(Application.Current.MainWindow).Handle
|
|
EgtSetMainWindowHandle(hMainWnd)
|
|
End Sub
|
|
|
|
Private Sub MainWindowV_ContentRendered(sender As Object, e As EventArgs)
|
|
m_MainWindowVM.ContentRendered()
|
|
End Sub
|
|
|
|
Private Sub MainWindowV_Closing(sender As Object, e As System.ComponentModel.CancelEventArgs)
|
|
If (Keyboard.Modifiers And ModifierKeys.Alt) = ModifierKeys.Alt OrElse Keyboard.IsKeyDown(Key.F4) Then
|
|
e.Cancel = True
|
|
Return
|
|
End If
|
|
' Salvo posizione finestra (se non minimizzata)
|
|
If WindowState <> WindowState.Minimized Then
|
|
WinPosFromWindowToIni(Me, S_GENERAL, K_WINPLACE)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub MainWindowV_StateChanged(sender As Object, e As EventArgs)
|
|
If Not IsNothing(Map.refSecondaryWindowV) AndAlso Not Map.refSecondaryWindowV.WindowChangingState Then
|
|
Map.refSecondaryWindowV.WindowState = Me.WindowState
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub MainWindowV_Drop(sender As Object, e As DragEventArgs)
|
|
' Se drag di file
|
|
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
|
|
' Attivo il programma
|
|
Me.Activate()
|
|
' Recupero l'array di stringhe con i nomi del file
|
|
Dim sFiles() As String = DirectCast(e.Data.GetData(DataFormats.FileDrop), String())
|
|
' Apro il primo come file standard
|
|
If Map.refSecondaryWindowVM.OpenStdFile(sFiles(0)) Then Return
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' Events
|
|
|
|
End Class
|