Files
egtstone3d/MainWindow/MainWindowV.xaml.vb
T
Demetrio Cassarino a35e9bc62a -aggiunto seconda scena
2024-12-20 17:31:10 +01:00

56 lines
1.6 KiB
VB.net

Imports System.Windows.Interop
Imports EgtUILib
Imports EgtWPFLib5
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)
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