256ff11cf4
- Eliminato TabControl. - Create e gestite finestre con i Db. - Spostati bottoni modalità (Draw e Machining) nella barra superiore. - Miglioramenti vari.
334 lines
9.7 KiB
VB.net
334 lines
9.7 KiB
VB.net
Imports EgtUILib
|
|
|
|
Namespace EgtCAM5
|
|
|
|
Public Class TopCommandBarViewModel
|
|
Inherits ViewModelBase
|
|
|
|
#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
|
|
|
|
#Region "ToolTip"
|
|
|
|
'Proprietà ToolTip
|
|
Public ReadOnly Property NewToolTip As String
|
|
Get
|
|
Return EgtMsg(MSG_TOPCOMMANDBAR + 1)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property OpenToolTip As String
|
|
Get
|
|
Return EgtMsg(MSG_TOPCOMMANDBAR + 2)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property SaveToolTip As String
|
|
Get
|
|
Return EgtMsg(MSG_TOPCOMMANDBAR + 3)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property SaveAsToolTip As String
|
|
Get
|
|
Return EgtMsg(MSG_TOPCOMMANDBAR + 4)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property InsertToolTip As String
|
|
Get
|
|
Return EgtMsg(MSG_TOPCOMMANDBAR + 5)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property ImportToolTip As String
|
|
Get
|
|
Return EgtMsg(MSG_TOPCOMMANDBAR + 6)
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property ExportToolTip As String
|
|
Get
|
|
Return EgtMsg(MSG_TOPCOMMANDBAR + 7)
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' ToolTip
|
|
|
|
Private m_DrawIsChecked As Boolean
|
|
Public Property DrawIsChecked As Boolean
|
|
Get
|
|
Return m_DrawIsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
If value <> m_DrawIsChecked Then
|
|
m_DrawIsChecked = value
|
|
If value Then
|
|
Application.Msn.NotifyColleagues(Application.DRAWMODE_ISCHECKED)
|
|
EgtResetCurrMachGroup()
|
|
EgtZoom(ZM.ALL)
|
|
Application.Msn.NotifyColleagues(Application.LOADOBJTREE)
|
|
End If
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Private m_MachiningIsChecked As Boolean
|
|
Public Property MachiningIsChecked As Boolean
|
|
Get
|
|
Return m_MachiningIsChecked
|
|
End Get
|
|
Set(value As Boolean)
|
|
If value <> m_MachiningIsChecked Then
|
|
m_MachiningIsChecked = value
|
|
If value Then
|
|
Dim nId = EgtGetFirstMachGroup()
|
|
If nId <> GDB_ID.NULL Then
|
|
EgtSetCurrMachGroup(nId)
|
|
Else
|
|
EgtAddMachGroup("Mach01", "CMS-PF122R8RR")
|
|
End If
|
|
Application.Msn.NotifyColleagues(Application.MACHININGMODE_ISCHECKED)
|
|
EgtZoom(ZM.ALL)
|
|
Else
|
|
' Deevidenzio l'ultima operazione evidenziata
|
|
Application.Msn.NotifyColleagues(Application.REMOVEMARKFROMLASTOPERATION)
|
|
End If
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
#End Region ' Fields & Properties
|
|
|
|
#Region "CONSTRUCTOR"
|
|
|
|
Sub New()
|
|
' Inizializzo la selezione della modilità Draw all'apertura del programma
|
|
DrawIsChecked = True
|
|
Application.Msn.Register(Application.SETMACHININGMODE, Sub()
|
|
MachiningIsChecked = True
|
|
OnPropertyChanged("MachiningIsChecked")
|
|
End Sub)
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
#Region "COMMANDS"
|
|
|
|
#Region "NewCommand"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do New.
|
|
''' </summary>
|
|
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
|
|
|
|
''' <summary>
|
|
''' Execute the New. This method is invoked by the NewCommand.
|
|
''' </summary>
|
|
Public Sub NewCmd(ByVal param As Object)
|
|
Application.Msn.NotifyColleagues(Application.NEWPROJECT)
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Returns always true.
|
|
''' </summary>
|
|
Private Function CanNew(ByVal param As Object) As Boolean
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' NewCommand
|
|
|
|
#Region "OpenCommand"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Open.
|
|
''' </summary>
|
|
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
|
|
|
|
''' <summary>
|
|
''' Execute the Open. This method is invoked by the OpenCommand.
|
|
''' </summary>
|
|
Public Sub Open(ByVal param As Object)
|
|
Application.Msn.NotifyColleagues(Application.OPENPROJECT)
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Returns always true.
|
|
''' </summary>
|
|
Private Function CanOpen(ByVal param As Object) As Boolean
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' OpenCommand
|
|
|
|
#Region "SaveCommand"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Save.
|
|
''' </summary>
|
|
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
|
|
|
|
''' <summary>
|
|
''' Execute the Save. This method is invoked by the SaveCommand.
|
|
''' </summary>
|
|
Public Sub Save(ByVal param As Object)
|
|
Application.Msn.NotifyColleagues(Application.SAVEPROJECT)
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Returns always true.
|
|
''' </summary>
|
|
Private Function CanSave(ByVal param As Object) As Boolean
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' SaveCommand
|
|
|
|
#Region "SaveAsCommand"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do SaveAs.
|
|
''' </summary>
|
|
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
|
|
|
|
''' <summary>
|
|
''' Execute the SaveAs. This method is invoked by the SaveAsCommand.
|
|
''' </summary>
|
|
Public Sub SaveAs(ByVal param As Object)
|
|
Application.Msn.NotifyColleagues(Application.SAVEASPROJECT)
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Returns always true.
|
|
''' </summary>
|
|
Private Function CanSaveAs(ByVal param As Object) As Boolean
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' SaveAsCommand
|
|
|
|
#Region "InsertCommand"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Insert.
|
|
''' </summary>
|
|
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
|
|
|
|
''' <summary>
|
|
''' Execute the Insert. This method is invoked by the InsertCommand.
|
|
''' </summary>
|
|
Public Sub Insert(ByVal param As Object)
|
|
Application.Msn.NotifyColleagues(Application.INSERTPROJECT)
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Returns always true.
|
|
''' </summary>
|
|
Private Function CanInsert(ByVal param As Object) As Boolean
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' InsertCommand
|
|
|
|
#Region "ImportCommand"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Import.
|
|
''' </summary>
|
|
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
|
|
|
|
''' <summary>
|
|
''' Execute the Import. This method is invoked by the ImportCommand.
|
|
''' </summary>
|
|
Public Sub Import(ByVal param As Object)
|
|
Application.Msn.NotifyColleagues(Application.IMPORTPROJECT)
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Returns always true.
|
|
''' </summary>
|
|
Private Function CanImport(ByVal param As Object) As Boolean
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' ImportCommand
|
|
|
|
#Region "ExportCommand"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Export.
|
|
''' </summary>
|
|
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
|
|
|
|
''' <summary>
|
|
''' Execute the Export. This method is invoked by the ExportCommand.
|
|
''' </summary>
|
|
Public Sub Export(ByVal param As Object)
|
|
Application.Msn.NotifyColleagues(Application.EXPORTPROJECT)
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Returns always true.
|
|
''' </summary>
|
|
Private Function CanExport(ByVal param As Object) As Boolean
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' ExportCommand
|
|
|
|
#End Region ' Commands
|
|
|
|
End Class
|
|
|
|
End Namespace |