Imports EgtWPFLib5
Imports System.Windows.Forms
Imports System.Windows.Input

Public Class OnlyProdEgtManageFileDialogV

#Region "FIELDS & PROPERTIES"

   Private WithEvents m_EgtManageFileDialogVM As EgtManageFileDialogVM

   Private Shadows DialogResult As DialogResult

   ''' <summary>
   ''' Stringa che specifica il titolo da mostrare
   ''' </summary>
   Public Overloads Property Title As String
      Get
         Return m_EgtManageFileDialogVM.sTitle
      End Get
      Set(value As String)
         m_EgtManageFileDialogVM.sTitle = value
      End Set
   End Property

   Public Property Filter As String
      Get
         Return m_EgtManageFileDialogVM.sFilter
      End Get
      Set(value As String)
         m_EgtManageFileDialogVM.sFilter = value
      End Set
   End Property

   Public Property InitialDirectory As String
      Get
         Return m_EgtManageFileDialogVM.sInitialDirectory
      End Get
      Set(value As String)
         m_EgtManageFileDialogVM.sInitialDirectory = value
      End Set
   End Property

   Public Property SafeFileName As String
      Get
         Return m_EgtManageFileDialogVM.sSaveFileName
      End Get
      Set(value As String)
         m_EgtManageFileDialogVM.sSaveFileName = value
      End Set
   End Property

   Public Property FileName As String
      Get
         Return m_EgtManageFileDialogVM.sFileName
      End Get
      Set(value As String)
         m_EgtManageFileDialogVM.sFileName = value
      End Set
   End Property

   Public Property FilterIndex As Integer
      Get
         Return m_EgtManageFileDialogVM.nFilterIndex
      End Get
      Set(value As Integer)
         m_EgtManageFileDialogVM.nFilterIndex = value
      End Set
   End Property

   Public Property Mode As Integer
      Get
         Return m_EgtManageFileDialogVM.nMode
      End Get
      Set(value As Integer)
         m_EgtManageFileDialogVM.nMode = value
      End Set
   End Property

   Public Property CheckFileExists As Boolean
      Get
         Return m_EgtManageFileDialogVM.bCheckFileExists
      End Get
      Set(value As Boolean)
         m_EgtManageFileDialogVM.bCheckFileExists = value
      End Set
   End Property

   Public Property ValidateNames As Boolean
      Get
         Return m_EgtManageFileDialogVM.bValidateNames
      End Get
      Set(value As Boolean)
         m_EgtManageFileDialogVM.bValidateNames = value
      End Set
   End Property

   Public Property OverwritePrompt As Boolean
      Get
         Return m_EgtManageFileDialogVM.bOverwritePrompt
      End Get
      Set(value As Boolean)
         m_EgtManageFileDialogVM.bOverwritePrompt = value
      End Set
   End Property

#End Region    ' FIELDS & PROPERTIES

#Region "CONTRUCTORS"

   Sub New(Owner As System.Windows.Window, EgtManageFileDialogVM As EgtManageFileDialogVM)
      MyBase.New(Owner)
      InitializeComponent()
      Me.DataContext = EgtManageFileDialogVM
      ' Assegno al riferimento locale al VM il VM preso dal DataContext
      m_EgtManageFileDialogVM = EgtManageFileDialogVM
   End Sub

#End Region

#Region "EVENTS"

   Private Sub CloseWindow(DialogResult As DialogResult) Handles m_EgtManageFileDialogVM.m_CloseWindow
      Me.DialogResult = DialogResult
      Me.Close()
   End Sub

#End Region

#Region "METHODS"

   Public Overloads Function ShowDialog() As DialogResult
      MyBase.ShowDialog()
      Return Me.DialogResult
   End Function

   Private Sub ListBoxItem_MouseDoubleClick(sender As Object, e As MouseButtonEventArgs)
      m_EgtManageFileDialogVM.MouseDoubleClick()
   End Sub

#End Region    '  METHODS

End Class
