EgtCAM5 :

- Migliorie varie.
This commit is contained in:
Emmanuele Sassi
2016-07-09 19:17:02 +00:00
parent a10b8d2ec6
commit 4db56e7e09
25 changed files with 510 additions and 44 deletions
@@ -3,6 +3,10 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="200">
<StackPanel Background="DarkGray">
<UniformGrid Rows="1">
<RadioButton Style="{StaticResource DrawOptionPanel_ToggleButton}" Content="DRAW" Height="30" IsChecked="{Binding DrawIsChecked}"/>
<RadioButton Style="{StaticResource DrawOptionPanel_ToggleButton}" Content="MACHINING" Height="30" IsChecked="{Binding WorkIsChecked}"/>
</UniformGrid>
<!--ContentPresenter that contains the ManageLayerExpander-->
<ContentPresenter Content="{Binding ManageLayerExpander}"/>
<!--ContentPresenter that contains the InfoExpander-->
@@ -1,17 +1,70 @@
Namespace EgtCAM5
Imports EgtUILib
Namespace EgtCAM5
Public Class DrawOptionPanelViewModel
Inherits ViewModelBase
' GRAPHICAL ELEMENTS
Private m_ManageLayerExpander As ManageLayerExpanderView
Public ReadOnly Property ManageLayerExpander As ManageLayerExpanderView
Private m_DrawIsChecked As Boolean
Public Property DrawIsChecked As Boolean
Get
If IsNothing(m_ManageLayerExpander) Then
m_ManageLayerExpander = New ManageLayerExpanderView
m_ManageLayerExpander.DataContext = New ManageLayerExpanderViewModel
Return m_DrawIsChecked
End Get
Set(value As Boolean)
If value <> m_DrawIsChecked Then
m_DrawIsChecked = value
If value Then
Application.Msn.NotifyColleagues(Application.PROJECTPAGE_DRAWMODE)
EgtResetCurrMachGroup()
EgtZoom(ZM.ALL)
End If
OnPropertyChanged("ManageLayerExpander")
End If
End Set
End Property
Private m_WorkIsChecked As Boolean
Public Property WorkIsChecked As Boolean
Get
Return m_WorkIsChecked
End Get
Set(value As Boolean)
If value <> m_WorkIsChecked Then
m_WorkIsChecked = value
If value Then
Application.Msn.NotifyColleagues(Application.PROJECTPAGE_MACHININGMODE)
Dim nId = EgtGetFirstMachGroup()
If nId <> GDB_ID.NULL Then
EgtSetCurrMachGroup(nId)
Else
EgtAddMachGroup("Mach01", "CMS-PF122R8RR")
End If
EgtZoom(ZM.ALL)
Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST)
End If
OnPropertyChanged("ManageLayerExpander")
End If
End Set
End Property
' GRAPHICAL ELEMENTS
Private m_OperationExpander As OperationExpanderView
Private m_ManageLayerExpander As ManageLayerExpanderView
Public ReadOnly Property ManageLayerExpander As ContentControl
Get
If m_DrawIsChecked Then
If IsNothing(m_ManageLayerExpander) Then
m_ManageLayerExpander = New ManageLayerExpanderView
m_ManageLayerExpander.DataContext = New ManageLayerExpanderViewModel
End If
Return m_ManageLayerExpander
Else
If IsNothing(m_OperationExpander) Then
m_OperationExpander = New OperationExpanderView
m_OperationExpander.DataContext = New OperationExpanderViewModel
End If
Return m_OperationExpander
End If
Return m_ManageLayerExpander
End Get
End Property
@@ -37,6 +90,11 @@
End Get
End Property
Sub New()
' Inizializzo la selezione della modilità Draw all'apertura del programma
DrawIsChecked = True
End Sub
End Class
End Namespace
@@ -11,6 +11,24 @@ Public Class LayerTreeViewItem
End Get
End Property
''' <summary>
''' Property that determines if the Tool is selected or not
''' </summary>
Public Overrides Property IsSelected As Boolean
Get
Return m_isSelected
End Get
Set(value As Boolean)
If (value <> m_isSelected) Then
m_isSelected = value
If value Then
' recupero l'Id del nuovo oggetto selezionato
Application.Msn.NotifyColleagues(Application.UPDATEOBJINOBJTREE, Me.Id)
End If
End If
End Set
End Property
Private m_Items As New ObservableCollection(Of LayerTreeViewItem)
Public Property Items As ObservableCollection(Of LayerTreeViewItem)
Get
@@ -10,9 +10,8 @@
<Ellipse Height="10" Width="10" Fill="{Binding HeaderColor}" />
</StackPanel>
</Expander.Header>
<StackPanel>
<TextBox/>
<StackPanel>
<UniformGrid Rows="1">
<Button Content="New Part" Command="{Binding NewPartCommand}" Height="40"/>
@@ -378,19 +378,6 @@ Namespace EgtCAM5
End If
End Sub
'Private Sub ObjTree_AfterSelect(ByVal sender As Object, ByVal e As TreeViewEventArgs) Handles TreeView1.AfterSelect
' ' verifico che il select derivi da azione utente
' If e.Action = TreeViewAction.Unknown Then
' Return
' End If
' ' recupero l'Id del nuovo oggetto selezionato
' Dim nId As Integer
' If Not Int32.TryParse(e.Node.Name, nId) Then
' Return
' End If
' UpdateObjInObjTree(nId)
'End Sub
'Private Sub ObjTree_MouseUp(ByVal sender As Object, e As MouseEventArgs) Handles TreeView1.MouseUp
' ' determino Id di eventuale item sotto il mouse
' Dim nId As Integer = GDB_ID.NULL
@@ -0,0 +1,33 @@
<UserControl x:Class="OperationExpanderView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Expander Header="Operations List" IsExpanded="{Binding IsExpanded}">
<StackPanel>
<UniformGrid Rows="1">
<Button Content="New Machining" Command="{Binding NewMachiningCommand}" Height="40"/>
<Button Content="New Positioning" Command="{Binding NewPositioningCommand}" Height="40"/>
<Button Content="Cancel Operation" Command="{Binding CancelOperationCommand}" Height="40"/>
</UniformGrid>
<ListBox ItemsSource="{Binding OperationList}" SelectedItem="{Binding SelectedOperation}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Image Source="{Binding Image}" Height="15" Margin="0,0,5,0"/>
<TextBlock Grid.Column="1" Text="{Binding Name}" Margin="0,0,5,0"/>
<TextBlock Grid.Column="2" Text="{Binding Tool}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</Expander>
</UserControl>
@@ -0,0 +1,3 @@
Public Class OperationExpanderView
End Class
@@ -0,0 +1,167 @@
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()
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
@@ -0,0 +1,75 @@
Imports EgtUILib
Public Class OperationListBoxItem
Private m_Id As Integer
Public Property Id As Integer
Get
Return m_Id
End Get
Set(value As Integer)
m_Id = value
End Set
End Property
Private m_Name As String
Public Property Name As String
Get
Return m_Name
End Get
Set(value As String)
m_Name = value
End Set
End Property
Private m_Image As String
Public Property Image As String
Get
Return m_Image
End Get
Set(value As String)
m_Image = value
End Set
End Property
Private m_Tool As String
Public Property Tool As String
Get
Return m_Tool
End Get
Set(value As String)
m_Tool = value
End Set
End Property
Sub New(Id As Integer, Name As String, Type As Integer, Tool As String)
Me.Id = Id
Me.Name = Name
Me.Image = ConvertTypeToImage(Type)
Me.Tool = Tool
End Sub
Private Function ConvertTypeToImage(Type As Integer) As String
Select Type
Case MCH_OY.DISP
Return ""
Case MCH_OY.DRILLING
Return ""
Case MCH_OY.SAWING
Return ""
Case MCH_OY.MILLING
Return ""
Case MCH_OY.POCKETING
Return ""
Case MCH_OY.MORTISING
Return ""
Case MCH_OY.SAWROUGHING
Return ""
Case MCH_OY.SAWFINISHING
Return ""
Case Else
Return String.Empty
End Select
End Function
End Class