Imports EgtWPFLib5
Imports System.Windows.Controls
Imports System.Windows.Input

Public Class OnlyProdSetUpWindowV

   Private WithEvents m_SetUpWindowVM As SetUpWindowVM

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

   Private Sub Tool_DoubleClick(sender As Object, e As MouseButtonEventArgs)
      Dim TreeViewItem As TreeViewItem = DirectCast(sender, TreeViewItem)
      If TypeOf TreeViewItem.DataContext Is ToolItem Then
         Dim SelTool As ToolItem = DirectCast(TreeViewItem.DataContext, ToolItem)
         m_SetUpWindowVM.ToolDoubleClick(SelTool)
         e.Handled = True
      End If
   End Sub

   Private Sub CloseWindow(bDialogResult As Boolean) Handles m_SetUpWindowVM.m_CloseWindow
      Me.DialogResult = bDialogResult
   End Sub

End Class
