Public Class MultipleCopyWndVM
   Inherits VMBase

   Friend Event m_CloseWindow(bDialogResult As Boolean)

   Private m_nCopyNumber As Integer
   Public ReadOnly Property nCopyNumber As Integer
      Get
         Return m_nCopyNumber
      End Get
   End Property
   Public Property sCopyNumber As String
      Get
         Return m_nCopyNumber.ToString()
      End Get
      Set(value As String)
         If Not Integer.TryParse(value, m_nCopyNumber) Then
            MessageBox.Show("Valore non impostabile come quantita' di porte!", "Errore!", MessageBoxButton.OK, MessageBoxImage.Error)
            NotifyPropertyChanged(sCopyNumber)
         End If
      End Set
   End Property

   ' Definizione comandi
   Private m_cmdOk As ICommand
   Private m_cmdCancel As ICommand

#Region "COMMANDS"

#Region "Ok"

   Public ReadOnly Property Ok_Command As ICommand
      Get
         If m_cmdOk Is Nothing Then
            m_cmdOk = New Command(AddressOf Ok)
         End If
         Return m_cmdOk
      End Get
   End Property

   Public Sub Ok()
      If m_nCopyNumber > 0 Then RaiseEvent m_CloseWindow(True)
   End Sub

#End Region ' Ok

#Region "Cancel"

   Public ReadOnly Property Cancel_Command As ICommand
      Get
         If m_cmdCancel Is Nothing Then
            m_cmdCancel = New Command(AddressOf Cancel)
         End If
         Return m_cmdCancel
      End Get
   End Property

   Public Sub Cancel()
      RaiseEvent m_CloseWindow(False)
   End Sub

#End Region ' Cancel

#End Region    ' COMMANDS

End Class
