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.Loaded, AddressOf MainWindowV_Loaded Map.SetRefMainWindowV(Me) Dim Dir_Vein3D As String = String.Empty Dim Path_CreateSolid As String = "CreateSOLID_FromPartsInPark.lua" Dim Path_OperationSolid As String = "OperationOnSolid.lua" ' carico il file LUA con tutte le funzioni di accoppiamento GetMainPrivateProfileString("Vein3D", "Vein3D_Dir", "", Dir_Vein3D) ' Path del lua da utilizzare GetMainPrivateProfileString("Vein3D", "CreateSolid", "", Path_CreateSolid) ' Path del lua da utilizzare GetMainPrivateProfileString("Vein3D", "OperationSolid", "", Path_OperationSolid) 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) 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 #End Region ' Events End Class