Namespace EgtCAM5 Public Class TopCommandBarViewModel #Region "FIELDS & PROPERTIES" ' Definizione comandi Private m_cmdNew As ICommand Private m_cmdOpen As ICommand Private m_cmdSave As ICommand Private m_cmdSaveAs As ICommand Private m_cmdInsert As ICommand Private m_cmdImport As ICommand Private m_cmdExport As ICommand Private m_cmdExec As ICommand #End Region ' Fields & Properties #Region "COMMANDS" #Region "NewCommand" ''' ''' Returns a command that do New. ''' Public ReadOnly Property NewCommand As ICommand Get If m_cmdNew Is Nothing Then m_cmdNew = New RelayCommand(AddressOf NewCmd, AddressOf CanNew) End If Return m_cmdNew End Get End Property ''' ''' Execute the New. This method is invoked by the NewCommand. ''' Public Sub NewCmd(ByVal param As Object) Application.Msn.NotifyColleagues(Application.NEWPROJECT) End Sub ''' ''' Returns always true. ''' Private Function CanNew(ByVal param As Object) As Boolean Return True End Function #End Region ' NewCommand #Region "OpenCommand" ''' ''' Returns a command that do Open. ''' Public ReadOnly Property OpenCommand As ICommand Get If m_cmdOpen Is Nothing Then m_cmdOpen = New RelayCommand(AddressOf Open, AddressOf CanOpen) End If Return m_cmdOpen End Get End Property ''' ''' Execute the Open. This method is invoked by the OpenCommand. ''' Public Sub Open(ByVal param As Object) Application.Msn.NotifyColleagues(Application.OPENPROJECT) End Sub ''' ''' Returns always true. ''' Private Function CanOpen(ByVal param As Object) As Boolean Return True End Function #End Region ' OpenCommand #Region "SaveCommand" ''' ''' Returns a command that do Save. ''' Public ReadOnly Property SaveCommand As ICommand Get If m_cmdSave Is Nothing Then m_cmdSave = New RelayCommand(AddressOf Save, AddressOf CanSave) End If Return m_cmdSave End Get End Property ''' ''' Execute the Save. This method is invoked by the SaveCommand. ''' Public Sub Save(ByVal param As Object) Application.Msn.NotifyColleagues(Application.SAVEPROJECT) End Sub ''' ''' Returns always true. ''' Private Function CanSave(ByVal param As Object) As Boolean Return True End Function #End Region ' SaveCommand #Region "SaveAsCommand" ''' ''' Returns a command that do SaveAs. ''' Public ReadOnly Property SaveAsCommand As ICommand Get If m_cmdSaveAs Is Nothing Then m_cmdSaveAs = New RelayCommand(AddressOf SaveAs, AddressOf CanSaveAs) End If Return m_cmdSaveAs End Get End Property ''' ''' Execute the SaveAs. This method is invoked by the SaveAsCommand. ''' Public Sub SaveAs(ByVal param As Object) Application.Msn.NotifyColleagues(Application.SAVEASPROJECT) End Sub ''' ''' Returns always true. ''' Private Function CanSaveAs(ByVal param As Object) As Boolean Return True End Function #End Region ' SaveAsCommand #Region "InsertCommand" ''' ''' Returns a command that do Insert. ''' Public ReadOnly Property InsertCommand As ICommand Get If m_cmdInsert Is Nothing Then m_cmdInsert = New RelayCommand(AddressOf Insert, AddressOf CanInsert) End If Return m_cmdInsert End Get End Property ''' ''' Execute the Insert. This method is invoked by the InsertCommand. ''' Public Sub Insert(ByVal param As Object) Application.Msn.NotifyColleagues(Application.INSERTPROJECT) End Sub ''' ''' Returns always true. ''' Private Function CanInsert(ByVal param As Object) As Boolean Return True End Function #End Region ' InsertCommand #Region "ImportCommand" ''' ''' Returns a command that do Import. ''' Public ReadOnly Property ImportCommand As ICommand Get If m_cmdImport Is Nothing Then m_cmdImport = New RelayCommand(AddressOf Import, AddressOf CanImport) End If Return m_cmdImport End Get End Property ''' ''' Execute the Import. This method is invoked by the ImportCommand. ''' Public Sub Import(ByVal param As Object) Application.Msn.NotifyColleagues(Application.IMPORTPROJECT) End Sub ''' ''' Returns always true. ''' Private Function CanImport(ByVal param As Object) As Boolean Return True End Function #End Region ' ImportCommand #Region "ExportCommand" ''' ''' Returns a command that do Export. ''' Public ReadOnly Property ExportCommand As ICommand Get If m_cmdExport Is Nothing Then m_cmdExport = New RelayCommand(AddressOf Export, AddressOf CanExport) End If Return m_cmdExport End Get End Property ''' ''' Execute the Export. This method is invoked by the ExportCommand. ''' Public Sub Export(ByVal param As Object) Application.Msn.NotifyColleagues(Application.EXPORTPROJECT) End Sub ''' ''' Returns always true. ''' Private Function CanExport(ByVal param As Object) As Boolean Return True End Function #End Region ' ExportCommand #Region "ExecCommand" ''' ''' Returns a command that do Exec. ''' Public ReadOnly Property ExecCommand As ICommand Get If m_cmdExec Is Nothing Then m_cmdExec = New RelayCommand(AddressOf Exec, AddressOf CanExec) End If Return m_cmdExec End Get End Property ''' ''' Execute the Exec. This method is invoked by the ExecCommand. ''' Public Sub Exec(ByVal param As Object) Application.Msn.NotifyColleagues(Application.EXECPROJECT) End Sub ''' ''' Returns always true. ''' Private Function CanExec(ByVal param As Object) As Boolean Return True End Function #End Region ' ExecCommand #End Region ' Commands End Class End Namespace