Imports System.Windows
Imports System.Windows.Input

Public Class LoadingWndV

   Private WithEvents m_LoadingWndVM As LoadingWndVM

   Sub New(Owner As Window, LoadingWndVM As LoadingWndVM)
      MyBase.New(Owner)
      ' This call is required by the designer.
      InitializeComponent()
      Me.DataContext = LoadingWndVM
      ' Assegno al riferimento locale al VM il VM preso dal DataContext
      m_LoadingWndVM = LoadingWndVM
   End Sub

   Private Sub CloseWindow(bDialogResult As Boolean) Handles m_LoadingWndVM.m_CloseWindow
      Me.Close()
   End Sub

   Private Sub ActivateWindow() Handles m_LoadingWndVM.m_ActivateWindow
      Me.Activate()
   End Sub

   Private Sub Me_ContentRendered() Handles Me.ContentRendered
      m_LoadingWndVM.StartFunction()
   End Sub

   Private Sub ToolsDbView_Closing(sender As Object, e As ComponentModel.CancelEventArgs) Handles Me.Closing
      If (Keyboard.Modifiers And ModifierKeys.Alt) = ModifierKeys.Alt OrElse Keyboard.IsKeyDown(Key.F4) Then
         e.Cancel = True
         Return
      End If
   End Sub

End Class
