d5188fcd96
- aggiornata simulazione come EgtCAM5.
93 lines
3.3 KiB
VB.net
93 lines
3.3 KiB
VB.net
Imports EgtWPFLib5
|
|
Imports EgtUILib
|
|
Imports System.Windows.Interop
|
|
|
|
Class MainWindowV
|
|
|
|
Private m_MainWindowVM As MainWindowVM
|
|
|
|
#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
|
|
'AddHandler Me.LocationChanged, AddressOf MainWindowV_LocationChanged
|
|
'AddHandler Me.SizeChanged, AddressOf MainWindowV_SizeChanged
|
|
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 AndAlso 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())
|
|
' Apro il primo
|
|
Map.refSecondaryWindowVM.OpenStdFile(sFiles(0))
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub MainWindowV_LocationChanged(sender As Object, e As EventArgs)
|
|
If Not IsNothing(Map.refSecondaryWindowV) Then
|
|
Map.refSecondaryWindowV.Top = Me.Top
|
|
Map.refSecondaryWindowV.Left = Me.Left
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub MainWindowV_SizeChanged(sender As Object, e As SizeChangedEventArgs)
|
|
If Not IsNothing(Map.refSecondaryWindowV) Then
|
|
If e.WidthChanged Then Map.refSecondaryWindowV.Width = e.NewSize.Width
|
|
If e.HeightChanged Then Map.refSecondaryWindowV.Height = e.NewSize.Height
|
|
Map.refSecondaryWindowV.InvalidateVisual()
|
|
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
|
|
|
|
#End Region ' EVENTS
|
|
|
|
End Class
|