Files
icarus/Icarus/MainWindow/MainWindowV.xaml.vb
Emmanuele Sassi 9783731396 - Salvata estensione file di importazione
- Modifica nome Part ed Entity in ManagePartPanel
- gestisce spostamenti entity da menu tasto destro
- correzioni e migliorie
2022-11-10 20:53:56 +01:00

78 lines
2.6 KiB
VB.net

Imports EgtWPFLib5
Imports EgtUILib
Imports System.Windows.Interop
Class MainWindowV
Private m_MainWindowVM As MainWindowVM
Private m_SceneHostWnd As SecondaryWindowV
#Region "CONSTRUCTOR"
Sub New()
m_MainWindowVM = New MainWindowVM
' Funzione che interpreta l'xaml
InitializeComponent()
Me.DataContext = m_MainWindowVM
' creo finestra della scena
AddHandler Me.Loaded, AddressOf MainWindowV_Loaded
AddHandler Me.ContentRendered, AddressOf MainWindowV_ContentRendered
AddHandler Me.Closing, AddressOf MainWindowV_Closing
AddHandler Me.KeyDown, AddressOf MainWindowV_KeyDown
AddHandler Me.StateChanged, AddressOf MainWindowV_StateChanged
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_KeyDown(sender As Object, e As KeyEventArgs)
m_MainWindowVM.KeyDown(e.Key)
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())
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
'Application.Current.MainWindow.Topmost = True
'Application.Current.MainWindow.Topmost = False
End If
End Sub
#End Region ' EVENTS
End Class