100 lines
3.7 KiB
VB.net
100 lines
3.7 KiB
VB.net
Imports EgtWPFLib5
|
|
|
|
Public Class SecondaryWindowV
|
|
|
|
#Region "FIELDS & PROPERTIES"
|
|
|
|
Private m_SecondaryWindowVM As SecondaryWindowVM
|
|
|
|
Private m_WindowChangingState As Boolean = False
|
|
Public ReadOnly Property WindowChangingState As Boolean
|
|
Get
|
|
Return m_WindowChangingState
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' Fields & Properties
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New(Owner As Window)
|
|
|
|
' La chiamata è richiesta dalla finestra di progettazione.
|
|
InitializeComponent()
|
|
' Aggiungere le eventuali istruzioni di inizializzazione dopo la chiamata a InitializeComponent().
|
|
m_SecondaryWindowVM = New SecondaryWindowVM
|
|
Me.DataContext = m_SecondaryWindowVM
|
|
Map.SetRefSecondaryWindowV(Me)
|
|
AddHandler Me.ContentRendered, AddressOf SecondaryWindowV_ContentRendered
|
|
AddHandler Me.Loaded, AddressOf SecondaryWindowV_Loaded
|
|
AddHandler Me.Closing, AddressOf SecondaryWindowV_Closing
|
|
AddHandler Me.LocationChanged, AddressOf SecondaryWindowV_LocationChanged
|
|
AddHandler Me.SizeChanged, AddressOf SecondaryWindowV_SizeChanged
|
|
AddHandler Me.StateChanged, AddressOf SecondaryWindowV_StateChanged
|
|
AddHandler Me.LocationChanged, AddressOf Window_Drag
|
|
AddHandler Me.SizeChanged, AddressOf Window_Drag
|
|
End Sub
|
|
|
|
#End Region ' Constructor
|
|
|
|
#Region "EVENTS"
|
|
|
|
Private Sub SecondaryWindowV_Loaded(sender As Object, e As RoutedEventArgs)
|
|
' Carico e imposto posizione finestra
|
|
WinPosFromIniToWindow(S_GENERAL, K_WINPLACE, Me)
|
|
End Sub
|
|
|
|
Private Sub SecondaryWindowV_ContentRendered(sender As Object, e As EventArgs)
|
|
m_SecondaryWindowVM.ContentRendered()
|
|
End Sub
|
|
|
|
Private Sub SecondaryWindowV_LocationChanged(sender As Object, e As EventArgs)
|
|
Application.Current.MainWindow.Top = Me.Top
|
|
Application.Current.MainWindow.Left = Me.Left
|
|
End Sub
|
|
|
|
Private Sub SecondaryWindowV_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 SecondaryWindowV_SizeChanged(sender As Object, e As SizeChangedEventArgs)
|
|
If Not IsNothing(Application.Current.MainWindow) Then
|
|
If e.WidthChanged Then Application.Current.MainWindow.Width = e.NewSize.Width
|
|
If e.HeightChanged Then Application.Current.MainWindow.Height = e.NewSize.Height
|
|
Application.Current.MainWindow.InvalidateVisual()
|
|
End If
|
|
If Not IsNothing(Map.refSceneButtonV) Then
|
|
Map.refSceneButtonV.SceneButtonV_Sizing()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub SecondaryWindowV_StateChanged(sender As Object, e As EventArgs)
|
|
m_WindowChangingState = True
|
|
Application.Current.MainWindow.WindowState = Me.WindowState
|
|
Application.Current.MainWindow.Topmost = True
|
|
Application.Current.MainWindow.Topmost = False
|
|
m_WindowChangingState = False
|
|
End Sub
|
|
|
|
Private Sub Window_Drag()
|
|
' spostando l'offset e rimettendolo al valore originale il pop up viene riposizionato correttamente rispetto relativamente
|
|
' alla finestra che l'ha creato
|
|
If Map.refSceneButtonV.MenuSelType.IsOpen Then
|
|
'Dim offset As Windows.Point = Map.refSceneButtonV.MenuSelType.off
|
|
'Map.refSceneButtonV.MenuSelType.HorizontalOffset = offset + 1
|
|
'Map.refSceneButtonV.MenuSelType.HorizontalOffset = offset
|
|
Map.refSceneButtonV.MenuSelType.IsOpen = False
|
|
End If
|
|
End Sub
|
|
|
|
#End Region ' Events
|
|
|
|
End Class
|