Files
effector.main/Supervisor/MainWindow/MainWindowV.xaml.vb
T
Emmanuele Sassi f23608580f - corretto indice di creazione macchine per comunicazione
- gestito posizionamento e dimensione finestra
- aggiunta funzione SplitStrign per lua
- aggiunta barra sopra in MainWindow
- gestita finestra con riposizionamento, dimensioni, ecc
- gestita esecuzione asincrona
- aggiunta verifica esecuzione macchina stati
2024-09-03 11:27:59 +02:00

80 lines
2.6 KiB
VB.net

Imports System.Windows.Interop
Class MainWindowV
Private m_MainWindowVM As MainWindowVM
#Region "CONSTRUCTOR"
Sub New()
' Funzione che interpreta l'xaml
InitializeComponent()
' Assegno al riferimento locale al VM il VM preso dal DataContext
m_MainWindowVM = DirectCast(Me.DataContext, MainWindowVM)
AddHandler Me.Loaded, AddressOf MainWindowV_Loaded
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_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