Imports EgtWPFLib5
Imports System.Windows.Input
Imports EgtUILib

Public Class OnlyProdToolDbWindowV

   Private WithEvents m_ToolDbWindowVM As ToolDbWindowVM

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

   Private Sub ToolsDbView_Closed(bDialogResult As Boolean) Handles m_ToolDbWindowVM.m_CloseWindow
      ' Imposto contesto generale
      EgtSetCurrentContext(ToolDbWindowVM.ProjectSceneContext)
      ' Cancello contesto di visualizzazione utensile
      EgtDeleteContext(ToolDbWindowVM.ToolDbSceneContext)
      Me.Close()
   End Sub

   Private Sub ToolsDbView_Closing(sender As Object, e As System.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
