Files
effector.main/Effector.Main/MainWindow/MainWindowV.xaml.vb
T
Emmanuele Sassi 71a280e41d - aggiunto splashscreen
- aggiunta gestione chiave di protezione con limite macchine utilizzabili
- impostata cartella dati da programma per script lua
2024-11-08 13:14:07 +01:00

86 lines
2.8 KiB
VB.net

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()
' Assegno al DataContext il VM appena creato
Me.DataContext = m_MainWindowVM
AddHandler Me.Loaded, AddressOf MainWindowV_Loaded
AddHandler Me.ContentRendered, AddressOf MainWindowV_ContentRendered
AddHandler Me.StateChanged, AddressOf Window_StateChanged
AddHandler Me.Closing, AddressOf MainWindowV_Closing
AddHandler Me.Closed, AddressOf MainWindowV_Closed
Me.RefreshMaximizeRestoreButton()
End Sub
#End Region ' CONSTRUCTOR
Private Sub RefreshMaximizeRestoreButton()
If Me.WindowState = WindowState.Maximized Then
Me.maximizeButton.Visibility = Visibility.Collapsed
Me.restoreButton.Visibility = Visibility.Visible
Else
Me.maximizeButton.Visibility = Visibility.Visible
Me.restoreButton.Visibility = Visibility.Collapsed
End If
End Sub
#Region "EVENTS"
Private Sub OnMinimizeButtonClick(ByVal sender As Object, ByVal e As RoutedEventArgs)
Me.WindowState = WindowState.Minimized
End Sub
Private Sub OnMaximizeRestoreButtonClick(ByVal sender As Object, ByVal e As RoutedEventArgs)
If Me.WindowState = WindowState.Maximized Then
Me.WindowState = WindowState.Normal
Else
Me.WindowState = WindowState.Maximized
End If
End Sub
Private Sub Window_StateChanged(ByVal sender As Object, ByVal e As EventArgs)
Me.RefreshMaximizeRestoreButton()
End Sub
Private Sub OnCloseButtonClick(ByVal sender As Object, ByVal e As RoutedEventArgs)
Me.Close()
End Sub
Private Sub MainWindowV_Loaded(sender As Object, e As RoutedEventArgs)
' Carico e imposto posizione finestra
WinPosFromIniToWindow(S_GENERAL, K_WINPLACE, Me)
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_Closed(sender As Object, e As EventArgs)
If Not IsNothing(m_MainWindowVM) AndAlso Not IsNothing(m_MainWindowVM.FiniteStateMachineManager) Then m_MainWindowVM.FiniteStateMachineManager.ResetFiniteStateMachineTimer()
LuaManager.Close()
EgtOutLog("Exit")
End Sub
#End Region ' EVENTS
End Class