f8b17066de
- Migliorie varie.
168 lines
5.2 KiB
VB.net
168 lines
5.2 KiB
VB.net
Imports System.Collections.ObjectModel
|
|
Imports EgtUILib
|
|
|
|
Namespace EgtCAM5
|
|
|
|
Public Class OperationExpanderViewModel
|
|
Inherits ViewModelBase
|
|
|
|
Private m_IsExpanded As Boolean
|
|
Public Property IsExpanded As Boolean
|
|
Get
|
|
Return m_IsExpanded
|
|
End Get
|
|
Set(value As Boolean)
|
|
If value <> m_IsExpanded Then
|
|
m_IsExpanded = value
|
|
OnPropertyChanged("IsExpanded")
|
|
End If
|
|
End Set
|
|
End Property
|
|
Private m_OperationList As New ObservableCollection(Of OperationListBoxItem)
|
|
Public Property OperationList As ObservableCollection(Of OperationListBoxItem)
|
|
Get
|
|
Return m_OperationList
|
|
End Get
|
|
Set(value As ObservableCollection(Of OperationListBoxItem))
|
|
m_OperationList = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_SelectedOperation As OperationListBoxItem
|
|
Public Property SelectedOperation As OperationListBoxItem
|
|
Get
|
|
Return m_SelectedOperation
|
|
End Get
|
|
Set(value As OperationListBoxItem)
|
|
m_SelectedOperation = value
|
|
End Set
|
|
End Property
|
|
|
|
' Definizione comandi
|
|
Private m_cmdNewMachining As ICommand
|
|
Private m_cmdNewPositioning As ICommand
|
|
Private m_cmdCancelOperation As ICommand
|
|
|
|
Sub New()
|
|
Application.Msn.Register(Application.LOADOPERATIONLIST, Sub()
|
|
LoadOperationList()
|
|
End Sub)
|
|
End Sub
|
|
#Region "COMMANDS"
|
|
|
|
#Region "NewMachiningCommand"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Point.
|
|
''' </summary>
|
|
Public ReadOnly Property NewMachiningCommand As ICommand
|
|
Get
|
|
If m_cmdNewMachining Is Nothing Then
|
|
m_cmdNewMachining = New RelayCommand(AddressOf NewMachining, AddressOf CanNewMachining)
|
|
End If
|
|
Return m_cmdNewMachining
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the Point. This method is invoked by the PointCommand.
|
|
''' </summary>
|
|
Public Sub NewMachining(ByVal param As Object)
|
|
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Returns always true.
|
|
''' </summary>
|
|
Private Function CanNewMachining(ByVal param As Object) As Boolean
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' NewMachiningCommand
|
|
|
|
#Region "NewPositioningCommand"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Point.
|
|
''' </summary>
|
|
Public ReadOnly Property NewPositioningCommand As ICommand
|
|
Get
|
|
If m_cmdNewPositioning Is Nothing Then
|
|
m_cmdNewPositioning = New RelayCommand(AddressOf NewPositioning, AddressOf CanNewPositioning)
|
|
End If
|
|
Return m_cmdNewPositioning
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the Point. This method is invoked by the PointCommand.
|
|
''' </summary>
|
|
Public Sub NewPositioning(ByVal param As Object)
|
|
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Returns always true.
|
|
''' </summary>
|
|
Private Function CanNewPositioning(ByVal param As Object) As Boolean
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' NewPositioningCommand
|
|
|
|
#Region "CancelOperationCommand"
|
|
|
|
''' <summary>
|
|
''' Returns a command that do Point.
|
|
''' </summary>
|
|
Public ReadOnly Property CancelOperationCommand As ICommand
|
|
Get
|
|
If m_cmdCancelOperation Is Nothing Then
|
|
m_cmdCancelOperation = New RelayCommand(AddressOf CancelOperation, AddressOf CanCancelOperation)
|
|
End If
|
|
Return m_cmdCancelOperation
|
|
End Get
|
|
End Property
|
|
|
|
''' <summary>
|
|
''' Execute the Point. This method is invoked by the PointCommand.
|
|
''' </summary>
|
|
Public Sub CancelOperation(ByVal param As Object)
|
|
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' Returns always true.
|
|
''' </summary>
|
|
Private Function CanCancelOperation(ByVal param As Object) As Boolean
|
|
Return True
|
|
End Function
|
|
|
|
#End Region ' CancelOperationCommand
|
|
|
|
#End Region ' Commands
|
|
|
|
Private Sub LoadOperationList()
|
|
OperationList.Clear()
|
|
Dim Id As Integer
|
|
Dim OpName As String = String.Empty
|
|
Dim OpType As Integer = 0
|
|
Dim OpTool As String = String.Empty
|
|
Id = EgtGetFirstOperation()
|
|
While Id <> GDB_ID.NULL
|
|
EgtGetOperationName(Id, OpName)
|
|
OpType = EgtGetOperationType(Id)
|
|
Select Case OpType
|
|
Case MCH_OY.DRILLING, MCH_OY.SAWING, MCH_OY.MILLING, MCH_OY.POCKETING, MCH_OY.MORTISING, MCH_OY.SAWROUGHING, MCH_OY.SAWFINISHING
|
|
EgtSetCurrMachining(Id)
|
|
EgtGetMachiningParam(MCH_MP.TOOL, OpTool)
|
|
Case MCH_OY.DISP
|
|
OpTool = String.Empty
|
|
End Select
|
|
OperationList.Add(New OperationListBoxItem(Id, OpName, OpType, OpTool))
|
|
Id = EgtGetNextOperation(Id)
|
|
End While
|
|
End Sub
|
|
End Class
|
|
|
|
End Namespace |