Files
egtbeamwall/EgtBEAMWALL.Optimizer/MainWindow/MainWindowV.xaml.vb
Demetrio Cassarino f903f80433 EgtBEAMWALL 3.1.2.3:
-cambio versione
-introdotto finestre EgtMessageBox e EgtManageDialog al posto di quello di Windows
-spostato immagni in dizionario
-aggiunto messaggi
2026-02-18 12:30:30 +01:00

87 lines
3.0 KiB
VB.net

Imports EgtWPFLib5
Imports EgtUILib
Imports EgtBEAMWALL.Core
Public Class MainWindowV
Private m_MainWindowVM As MainWindowVM
#Region "CONSTRUCTOR"
Sub New()
m_MainWindowVM = New MainWindowVM
' Funzione che interpreta l'xaml
InitializeComponent()
' Assegno al riferimento locale al VM il VM preso dal DataContext
Me.DataContext = m_MainWindowVM
'm_MainWindowVM = DirectCast(Me.DataContext, MainWindowVM)
'AddHandler Me.Loaded, AddressOf MainWindowV_Loaded
AddHandler Me.ContentRendered, AddressOf MainWindowV_ContentRendered
AddHandler Me.Closing, AddressOf MainWindowV_Closing
AddHandler Me.KeyDown, AddressOf MainWindowV_KeyDown
Me.SetPlacementAppName(S_GENERAL)
Me.SetPlacementKeyName(K_WINPLACE)
Me.SetPlacementFileName(IniFile.m_sIniFile)
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_VIEWOPTIMWINPLACE, 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 Map.refCALCPanelVM.bCalculating Then
EgtBEAMWALL.Core.EgtMessageBoxV.Show(Application.Current.MainWindow, EgtMsg(63041), EgtMsg(15001), MessageBoxButton.OK, MessageBoxImage.Error)
e.Cancel = True
Return
End If
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_VIEWOPTIMWINPLACE)
End If
m_MainWindowVM.CloseApplication(e)
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())
' Se BTL importo il file
If EgtGetFileType(sFiles(0)) = FT.BTL Then
'Map.refProjManagerVM.ImportBTL(sFiles(0), False)
Map.refProdManagerVM.ImportBTL(sFiles(0), False)
End If
End If
End Sub
Private Sub MainWindowV_Activated(sender As Object, e As EventArgs) Handles Me.Activated
LoadingWndHelper.SetMainWindowIsActive(True)
End Sub
Private Sub MainWindowV_Deactivated(sender As Object, e As EventArgs) Handles Me.Deactivated
LoadingWndHelper.SetMainWindowIsActive(False)
End Sub
#End Region ' EVENTS
End Class