EgtCAM5 :

- Altri nomi modificati.
- Eliminato namespace.
This commit is contained in:
Emmanuele Sassi
2018-04-11 10:43:14 +00:00
parent a4b5cd4834
commit 6dd2abf95d
83 changed files with 14302 additions and 14501 deletions
-1
View File
@@ -1,5 +1,4 @@
Imports EgtWPFLib5
Imports EgtCAM5.EgtCAM5
Imports EgtUILib
Class Application
-19
View File
@@ -1,19 +0,0 @@
<EgtWpfLib5:EgtPanelWindow x:Class="BaseWindowView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtWpfLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
Title="BaseWindowView"
SizeToContent="WidthAndHeight"
TitleBarOrientation="{Binding TitleBarOrientation}">
<!--<interactivity:Interaction.Triggers>
<interactivity:EventTrigger EventName="Closing">
<interactivity:InvokeCommandAction Command="{Binding cmdMainWindow_Closing}"/>
</interactivity:EventTrigger>
</interactivity:Interaction.Triggers>-->
<!--ContentPresenter that contains the actual View-->
<ContentPresenter Content="{Binding}"/>
</EgtWpfLib5:EgtPanelWindow>
-26
View File
@@ -1,26 +0,0 @@
Imports EgtWPFLib5
Public Class BaseWindowView
Inherits EgtPanelWindow
Sub New()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
' Set this as owned by MainWindow, when this one is rendered
Application.Msn.Register(Application.MAINWINDOW_CONTENTRENDERED, Sub()
Me.Owner = Application.Current.MainWindow
Me.Focus()
End Sub)
Application.Msn.Register(Application.MAINWINDOW_ACTIVATED, Sub()
'Me.Topmost = True
End Sub)
Application.Msn.Register(Application.MAINWINDOW_DEACTIVATED, Sub()
'Me.Topmost = False
End Sub)
End Sub
End Class
+15 -19
View File
@@ -1,21 +1,17 @@
Namespace EgtCAM5
Public Class TabViewModel
Inherits ViewModelBase
Public Class TabViewModel
Inherits ViewModelBase
Friend m_sTabName As String
Public Overridable Property sTabName As String
Get
Return m_sTabName
End Get
Set(value As String)
If value <> m_sTabName Then
m_sTabName = value
OnPropertyChanged("sTabName")
End If
End Set
End Property
Friend m_sTabName As String
Public Overridable Property sTabName As String
Get
Return m_sTabName
End Get
Set(value As String)
If value <> m_sTabName Then
m_sTabName = value
OnPropertyChanged("sTabName")
End If
End Set
End Property
End Class
End Namespace
End Class
+65 -69
View File
@@ -1,97 +1,93 @@
Imports System.ComponentModel
Namespace EgtCAM5
Public Class ViewModelBase
Implements INotifyPropertyChanged
Public Class ViewModelBase
Implements INotifyPropertyChanged
#Region "Constructor"
Protected Sub New()
End Sub
Protected Sub New()
End Sub
#End Region ' Constructor
#Region "DisplayName"
''' <summary>
''' Returns the user-friendly name of this object.
''' Child classes can set this property to a new value,
''' or override it to determine the value on-demand.
''' </summary>
Private m_sDisplayName As String
Public Overridable Property sDisplayName() As String
Get
Return m_sDisplayName
End Get
Protected Set(ByVal value As String)
m_sDisplayName = value
End Set
End Property
''' <summary>
''' Returns the user-friendly name of this object.
''' Child classes can set this property to a new value,
''' or override it to determine the value on-demand.
''' </summary>
Private m_sDisplayName As String
Public Overridable Property sDisplayName() As String
Get
Return m_sDisplayName
End Get
Protected Set(ByVal value As String)
m_sDisplayName = value
End Set
End Property
#End Region ' DisplayName
#Region "Debugging Aides"
''' <summary>
''' Warns the developer if this object does not have
''' a public property with the specified name. This
''' method does not exist in a Release build.
''' </summary>
<Conditional("DEBUG"), DebuggerStepThrough()> _
Public Sub VerifyPropertyName(ByVal sPropertyName As String)
' Verify that the property name matches a real,
' public, instance property on this object.
If TypeDescriptor.GetProperties(Me)(sPropertyName) Is Nothing Then
Dim msg As String = "Invalid property name: " & sPropertyName
''' <summary>
''' Warns the developer if this object does not have
''' a public property with the specified name. This
''' method does not exist in a Release build.
''' </summary>
<Conditional("DEBUG"), DebuggerStepThrough()> _
Public Sub VerifyPropertyName(ByVal sPropertyName As String)
' Verify that the property name matches a real,
' public, instance property on this object.
If TypeDescriptor.GetProperties(Me)(sPropertyName) Is Nothing Then
Dim msg As String = "Invalid property name: " & sPropertyName
If Me.ThrowOnInvalidPropertyName Then
Throw New Exception(msg)
Else
Debug.Fail(msg)
End If
If Me.ThrowOnInvalidPropertyName Then
Throw New Exception(msg)
Else
Debug.Fail(msg)
End If
End Sub
End If
End Sub
''' <summary>
''' Returns whether an exception is thrown, or if a Debug.Fail() is used
''' when an invalid property name is passed to the VerifyPropertyName method.
''' The default value is false, but subclasses used by unit tests might
''' override this property's getter to return true.
''' </summary>
Private privateThrowOnInvalidPropertyName As Boolean
Protected Overridable Property ThrowOnInvalidPropertyName() As Boolean
Get
Return privateThrowOnInvalidPropertyName
End Get
Set(ByVal value As Boolean)
privateThrowOnInvalidPropertyName = value
End Set
End Property
''' <summary>
''' Returns whether an exception is thrown, or if a Debug.Fail() is used
''' when an invalid property name is passed to the VerifyPropertyName method.
''' The default value is false, but subclasses used by unit tests might
''' override this property's getter to return true.
''' </summary>
Private privateThrowOnInvalidPropertyName As Boolean
Protected Overridable Property ThrowOnInvalidPropertyName() As Boolean
Get
Return privateThrowOnInvalidPropertyName
End Get
Set(ByVal value As Boolean)
privateThrowOnInvalidPropertyName = value
End Set
End Property
#End Region ' Debugging Aides
#Region "INotifyPropertyChanged Members"
''' <summary>
''' Raised when a property on this object has a new value.
''' </summary>
Public Event PropertyChanged(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs) Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged
''' <summary>
''' Raised when a property on this object has a new value.
''' </summary>
Public Event PropertyChanged(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs) Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged
''' <summary>
''' Raises this object's PropertyChanged event.
''' </summary>
''' <param name="spropertyName">The property that has a new value.</param>
Protected Overridable Sub OnPropertyChanged(ByVal sPropertyName As String)
Me.VerifyPropertyName(sPropertyName)
If Me.PropertyChangedEvent IsNot Nothing Then
RaiseEvent PropertyChanged(Me, New System.ComponentModel.PropertyChangedEventArgs(sPropertyName))
End If
''' <summary>
''' Raises this object's PropertyChanged event.
''' </summary>
''' <param name="spropertyName">The property that has a new value.</param>
Protected Overridable Sub OnPropertyChanged(ByVal sPropertyName As String)
Me.VerifyPropertyName(sPropertyName)
If Me.PropertyChangedEvent IsNot Nothing Then
RaiseEvent PropertyChanged(Me, New System.ComponentModel.PropertyChangedEventArgs(sPropertyName))
End If
End Sub
End Sub
#End Region ' INotifyPropertyChanged Members
End Class
End Namespace
End Class
+1
View File
@@ -65,4 +65,5 @@ Public Class Command
End Sub
#End Region ' ICommand Members
End Class
+48 -51
View File
@@ -1,71 +1,68 @@
Namespace EgtCAM5
''' <summary>
''' A command whose sole purpose is to
''' relay its functionality to other
''' objects by invoking delegates. The
''' default return value for the CanExecute
''' method is 'true'.
''' </summary>
Public Class RelayCommand
Implements ICommand
''' <summary>
''' A command whose sole purpose is to
''' relay its functionality to other
''' objects by invoking delegates. The
''' default return value for the CanExecute
''' method is 'true'.
''' </summary>
Public Class RelayCommand
Implements ICommand
#Region "Fields"
Private ReadOnly _execute As Action(Of Object)
Private ReadOnly _canExecute As Predicate(Of Object)
Private ReadOnly _execute As Action(Of Object)
Private ReadOnly _canExecute As Predicate(Of Object)
#End Region ' Fields
#Region "Constructors"
''' <summary>
''' Creates a new command that can always execute.
''' </summary>
''' <param name="execute">The execution logic.</param>
Public Sub New(ByVal execute As Action(Of Object))
Me.New(execute, Nothing)
End Sub
''' <summary>
''' Creates a new command that can always execute.
''' </summary>
''' <param name="execute">The execution logic.</param>
Public Sub New(ByVal execute As Action(Of Object))
Me.New(execute, Nothing)
End Sub
''' <summary>
''' Creates a new command.
''' </summary>
''' <param name="execute">The execution logic.</param>
''' <param name="canExecute">The execution status logic.</param>
Public Sub New(ByVal execute As Action(Of Object), ByVal canExecute As Predicate(Of Object))
If execute Is Nothing Then
Throw New ArgumentNullException("execute")
End If
''' <summary>
''' Creates a new command.
''' </summary>
''' <param name="execute">The execution logic.</param>
''' <param name="canExecute">The execution status logic.</param>
Public Sub New(ByVal execute As Action(Of Object), ByVal canExecute As Predicate(Of Object))
If execute Is Nothing Then
Throw New ArgumentNullException("execute")
End If
_execute = execute
_canExecute = canExecute
End Sub
_execute = execute
_canExecute = canExecute
End Sub
#End Region ' Constructors
#Region "ICommand Members"
<DebuggerStepThrough> _
Public Function CanExecute(ByVal parameter As Object) As Boolean Implements ICommand.CanExecute
Return If(_canExecute Is Nothing, True, _canExecute(parameter))
End Function
<DebuggerStepThrough> _
Public Function CanExecute(ByVal parameter As Object) As Boolean Implements ICommand.CanExecute
Return If(_canExecute Is Nothing, True, _canExecute(parameter))
End Function
Public Custom Event CanExecuteChanged As EventHandler Implements ICommand.CanExecuteChanged
AddHandler(ByVal value As EventHandler)
AddHandler CommandManager.RequerySuggested, value
End AddHandler
RemoveHandler(ByVal value As EventHandler)
RemoveHandler CommandManager.RequerySuggested, value
End RemoveHandler
RaiseEvent(ByVal sender As System.Object, ByVal e As System.EventArgs)
End RaiseEvent
End Event
Public Custom Event CanExecuteChanged As EventHandler Implements ICommand.CanExecuteChanged
AddHandler(ByVal value As EventHandler)
AddHandler CommandManager.RequerySuggested, value
End AddHandler
RemoveHandler(ByVal value As EventHandler)
RemoveHandler CommandManager.RequerySuggested, value
End RemoveHandler
RaiseEvent(ByVal sender As System.Object, ByVal e As System.EventArgs)
End RaiseEvent
End Event
Public Sub Execute(ByVal parameter As Object) Implements ICommand.Execute
_execute(parameter)
End Sub
Public Sub Execute(ByVal parameter As Object) Implements ICommand.Execute
_execute(parameter)
End Sub
#End Region ' ICommand Members
End Class
End Namespace
End Class
+111 -115
View File
@@ -1,151 +1,147 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Namespace EgtCAM5
Public Class DoorPanelVM
Inherits ViewModelBase
Public Class DoorPanelVM
Inherits ViewModelBase
Public ReadOnly Property MruDoorNames As ObservableCollection(Of String)
Get
Return IniFile.m_MruDoors.m_FileNames
End Get
End Property
Public ReadOnly Property MruDoorNames As ObservableCollection(Of String)
Get
Return IniFile.m_MruDoors.m_FileNames
End Get
End Property
' Definizione comandi
Private m_cmdDoors As ICommand
Private m_cmdDMach As ICommand
Private Shared m_cmdOpenMruDoor As ICommand
Private m_cmdMTableDb As ICommand
' Definizione comandi
Private m_cmdDoors As ICommand
Private m_cmdDMach As ICommand
Private Shared m_cmdOpenMruDoor As ICommand
Private m_cmdMTableDb As ICommand
#Region "COMMANDS"
#Region "DoorsCommand"
''' <summary>
''' Returns a command that do Import.
''' </summary>
Public ReadOnly Property DoorsCommand As ICommand
Get
If m_cmdDoors Is Nothing Then
m_cmdDoors = New RelayCommand(AddressOf Doors)
End If
Return m_cmdDoors
End Get
End Property
''' <summary>
''' Returns a command that do Import.
''' </summary>
Public ReadOnly Property DoorsCommand As ICommand
Get
If m_cmdDoors Is Nothing Then
m_cmdDoors = New RelayCommand(AddressOf Doors)
End If
Return m_cmdDoors
End Get
End Property
''' <summary>
''' Execute the Door. This method is invoked by the DoorsCommand.
''' </summary>
Public Sub Doors(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.DOORSSCRIPT, String.Empty)
End Sub
''' <summary>
''' Execute the Door. This method is invoked by the DoorsCommand.
''' </summary>
Public Sub Doors(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.DOORSSCRIPT, String.Empty)
End Sub
#End Region ' DoorsCommand
#Region "OpenMruDoorCommand"
''' <summary>
''' Returns a command that do Open.
''' </summary>
Public Shared ReadOnly Property OpenMruDoorCommand As ICommand
Get
If m_cmdOpenMruDoor Is Nothing Then
m_cmdOpenMruDoor = New RelayCommand(AddressOf OpenMruDoor)
End If
Return m_cmdOpenMruDoor
End Get
End Property
''' <summary>
''' Returns a command that do Open.
''' </summary>
Public Shared ReadOnly Property OpenMruDoorCommand As ICommand
Get
If m_cmdOpenMruDoor Is Nothing Then
m_cmdOpenMruDoor = New RelayCommand(AddressOf OpenMruDoor)
End If
Return m_cmdOpenMruDoor
End Get
End Property
''' <summary>
''' Execute the Open. This method is invoked by the OpenCommand.
''' </summary>
Public Shared Sub OpenMruDoor(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.DOORSSCRIPT, DirectCast(param, String).Replace("__", "_"))
End Sub
''' <summary>
''' Execute the Open. This method is invoked by the OpenCommand.
''' </summary>
Public Shared Sub OpenMruDoor(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.DOORSSCRIPT, DirectCast(param, String).Replace("__", "_"))
End Sub
#End Region ' OpenMruFileCommand
#Region "DMachCommand"
''' <summary>
''' Returns a command that do Import.
''' </summary>
Public ReadOnly Property DMachCommand As ICommand
Get
If m_cmdDMach Is Nothing Then
m_cmdDMach = New RelayCommand(AddressOf DMach)
End If
Return m_cmdDMach
End Get
End Property
''' <summary>
''' Returns a command that do Import.
''' </summary>
Public ReadOnly Property DMachCommand As ICommand
Get
If m_cmdDMach Is Nothing Then
m_cmdDMach = New RelayCommand(AddressOf DMach)
End If
Return m_cmdDMach
End Get
End Property
''' <summary>
''' Execute the Dmach. This method is invoked by the DMachCommand.
''' </summary>
Public Sub DMach(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.DMACHSCRIPT)
End Sub
''' <summary>
''' Execute the Dmach. This method is invoked by the DMachCommand.
''' </summary>
Public Sub DMach(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.DMACHSCRIPT)
End Sub
#End Region ' DMachCommand
#Region "MTableDbCommand"
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property MTableDbCommand As ICommand
Get
If m_cmdMTableDb Is Nothing Then
m_cmdMTableDb = New RelayCommand(AddressOf MTableDb)
End If
Return m_cmdMTableDb
End Get
End Property
''' <summary>
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub MTableDb(ByVal param As Object)
' Leggo dal file ini il direttorio delle MTable
Dim sTablesDir As String = String.Empty
If GetPrivateProfileString(S_DOORS, K_TABLESDIR, "", sTablesDir) = 0 Then
' Se non lo trovo mando messaggio di errore e chiudo la finestra
MessageBox.Show(EgtMsg(MSG_DOORSERRORS + 4), EgtMsg(MSG_DOORSERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property MTableDbCommand As ICommand
Get
If m_cmdMTableDb Is Nothing Then
m_cmdMTableDb = New RelayCommand(AddressOf MTableDb)
End If
IniFile.m_sTablesRoot = IniFile.m_sDoorsDirPath & "\" & sTablesDir
' Verifico che la cartella indicata esista
If Not My.Computer.FileSystem.DirectoryExists(IniFile.m_sTablesRoot) Then
' Se non la trovo mando messaggio di errore e chiudo la finestra
MessageBox.Show(EgtMsg(MSG_DOORSERRORS + 5), EgtMsg(MSG_DOORSERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
' Verifico che ci sia il file ini per scrivere le tabelle
If Not My.Computer.FileSystem.FileExists(IniFile.m_sTablesRoot & "\" & MTABLETEMPLATE_FILE) OrElse Not My.Computer.FileSystem.FileExists(IniFile.m_sTablesRoot & "\" & GEONAMELIST_FILE) _
OrElse Not My.Computer.FileSystem.FileExists(IniFile.m_sTablesRoot & "\" & OPERATIONLIST_FILE) Then
' Se non la trovo mando messaggio di errore e chiudo la finestra
MessageBox.Show(EgtMsg(MSG_DOORSERRORS + 6), EgtMsg(MSG_DOORSERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
' verifico
If Not EgtVerifyMachinesDir() Then Return
Return m_cmdMTableDb
End Get
End Property
Dim MTableDb As New MTableDbV(Application.Current.MainWindow, New MTableDbVM)
MTableDb.ShowDialog()
''' <summary>
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub MTableDb(ByVal param As Object)
' Leggo dal file ini il direttorio delle MTable
Dim sTablesDir As String = String.Empty
If GetPrivateProfileString(S_DOORS, K_TABLESDIR, "", sTablesDir) = 0 Then
' Se non lo trovo mando messaggio di errore e chiudo la finestra
MessageBox.Show(EgtMsg(MSG_DOORSERRORS + 4), EgtMsg(MSG_DOORSERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
IniFile.m_sTablesRoot = IniFile.m_sDoorsDirPath & "\" & sTablesDir
' Verifico che la cartella indicata esista
If Not My.Computer.FileSystem.DirectoryExists(IniFile.m_sTablesRoot) Then
' Se non la trovo mando messaggio di errore e chiudo la finestra
MessageBox.Show(EgtMsg(MSG_DOORSERRORS + 5), EgtMsg(MSG_DOORSERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
' Verifico che ci sia il file ini per scrivere le tabelle
If Not My.Computer.FileSystem.FileExists(IniFile.m_sTablesRoot & "\" & MTABLETEMPLATE_FILE) OrElse Not My.Computer.FileSystem.FileExists(IniFile.m_sTablesRoot & "\" & GEONAMELIST_FILE) _
OrElse Not My.Computer.FileSystem.FileExists(IniFile.m_sTablesRoot & "\" & OPERATIONLIST_FILE) Then
' Se non la trovo mando messaggio di errore e chiudo la finestra
MessageBox.Show(EgtMsg(MSG_DOORSERRORS + 6), EgtMsg(MSG_DOORSERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
' verifico
If Not EgtVerifyMachinesDir() Then Return
'Dim MTableDbWindow As New MTableDbView
'MTableDbWindow.Height = 614
'MTableDbWindow.Width = 1024
'MTableDbWindow.DataContext = New MTableDbViewModel
'MTableDbWindow.Owner = Application.Current.MainWindow
'MTableDbWindow.ShowDialog()
End Sub
Dim MTableDb As New MTableDbV(Application.Current.MainWindow, New MTableDbVM)
MTableDb.ShowDialog()
'Dim MTableDbWindow As New MTableDbView
'MTableDbWindow.Height = 614
'MTableDbWindow.Width = 1024
'MTableDbWindow.DataContext = New MTableDbViewModel
'MTableDbWindow.Owner = Application.Current.MainWindow
'MTableDbWindow.ShowDialog()
End Sub
#End Region ' MTableDbCommand
#End Region
End Class
End Namespace
End Class
+1149 -1153
View File
File diff suppressed because it is too large Load Diff
+36 -36
View File
@@ -206,26 +206,26 @@
<DependentUpon>MachGroupPanelV.xaml</DependentUpon>
</Compile>
<Compile Include="MachGroupPanel\MachGroupPanelVM.vb" />
<Compile Include="OptionPanel\MachiningOptionPanel\MachiningsTreeViewExpander\MachiningTreeExpanderView.xaml.vb">
<DependentUpon>MachiningTreeExpanderView.xaml</DependentUpon>
<Compile Include="OptionPanel\MachiningOptionPanel\MachiningsTreeViewExpander\MachiningTreeExpanderV.xaml.vb">
<DependentUpon>MachiningTreeExpanderV.xaml</DependentUpon>
</Compile>
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\DispositionParameterExpander\FixtureParameters\FixtureParametersView.xaml.vb">
<DependentUpon>FixtureParametersView.xaml</DependentUpon>
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\DispositionParameterExpander\FixtureParameters\FixtureParametersV.xaml.vb">
<DependentUpon>FixtureParametersV.xaml</DependentUpon>
</Compile>
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\DispositionParameterExpander\FixtureParameters\FixtureParametersViewModel.vb" />
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\DispositionParameterExpander\RawPartOption\RawPartOptionView.xaml.vb">
<DependentUpon>RawPartOptionView.xaml</DependentUpon>
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\DispositionParameterExpander\FixtureParameters\FixtureParametersVM.vb" />
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\DispositionParameterExpander\RawPartOption\RawPartOptionV.xaml.vb">
<DependentUpon>RawPartOptionV.xaml</DependentUpon>
</Compile>
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\DispositionParameterExpander\RawPartOption\RawPartOptionViewModel.vb" />
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\MachiningParameterExpander\MachiningParameterExpanderViewModel.vb" />
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\DispositionParameterExpander\RawPartOption\RawPartOptionVM.vb" />
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\MachiningParameterExpander\MachiningParameterExpanderVM.vb" />
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\OperationListBoxItem\DispositionOpListBoxItem.vb" />
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\DispositionParameterExpander\DispositionParameterExpanderViewModel.vb" />
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\DispositionParameterExpander\DispositionParameterExpanderView.xaml.vb">
<DependentUpon>DispositionParameterExpanderView.xaml</DependentUpon>
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\DispositionParameterExpander\DispositionParameterExpanderVM.vb" />
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\DispositionParameterExpander\DispositionParameterExpanderV.xaml.vb">
<DependentUpon>DispositionParameterExpanderV.xaml</DependentUpon>
</Compile>
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\OperationListBoxItem\MachiningOpListBoxItem.vb" />
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\MachiningParameterExpander\MachiningParameterExpanderView.xaml.vb">
<DependentUpon>MachiningParameterExpanderView.xaml</DependentUpon>
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\MachiningParameterExpander\MachiningParameterExpanderV.xaml.vb">
<DependentUpon>MachiningParameterExpanderV.xaml</DependentUpon>
</Compile>
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\OperationListBoxItem\OperationListBoxItem.vb" />
<Compile Include="OptionPanel\MachiningOptionPanel\SimulationExpander\MachineAxis.vb" />
@@ -254,25 +254,25 @@
<DependentUpon>OptionPanelV.xaml</DependentUpon>
</Compile>
<Compile Include="OptionPanel\OptionPanelVM.vb" />
<Compile Include="OptionPanel\DrawOptionPanel\InfoExpander\InfoExpanderView.xaml.vb">
<DependentUpon>InfoExpanderView.xaml</DependentUpon>
<Compile Include="OptionPanel\DrawOptionPanel\InfoExpander\InfoExpanderV.xaml.vb">
<DependentUpon>InfoExpanderV.xaml</DependentUpon>
</Compile>
<Compile Include="OptionPanel\DrawOptionPanel\InfoExpander\InfoExpanderViewModel.vb" />
<Compile Include="OptionPanel\DrawOptionPanel\InputExpander\InputExpanderView.xaml.vb">
<DependentUpon>InputExpanderView.xaml</DependentUpon>
<Compile Include="OptionPanel\DrawOptionPanel\InfoExpander\InfoExpanderVM.vb" />
<Compile Include="OptionPanel\DrawOptionPanel\InputExpander\InputExpanderV.xaml.vb">
<DependentUpon>InputExpanderV.xaml</DependentUpon>
</Compile>
<Compile Include="OptionPanel\DrawOptionPanel\InputExpander\InputExpanderViewModel.vb" />
<Compile Include="OptionPanel\MachiningOptionPanel\MachiningsTreeViewExpander\MachiningTreeExpanderViewModel.vb" />
<Compile Include="OptionPanel\DrawOptionPanel\InputExpander\InputExpanderVM.vb" />
<Compile Include="OptionPanel\MachiningOptionPanel\MachiningsTreeViewExpander\MachiningTreeExpanderVM.vb" />
<Compile Include="OptionPanel\DrawOptionPanel\ManageLayerExpander\LayerTreeView.vb" />
<Compile Include="OptionPanel\DrawOptionPanel\ManageLayerExpander\ManageLayerExpanderView.xaml.vb">
<DependentUpon>ManageLayerExpanderView.xaml</DependentUpon>
<Compile Include="OptionPanel\DrawOptionPanel\ManageLayerExpander\ManageLayerExpanderV.xaml.vb">
<DependentUpon>ManageLayerExpanderV.xaml</DependentUpon>
</Compile>
<Compile Include="OptionPanel\DrawOptionPanel\ManageLayerExpander\ManageLayerExpanderViewModel.vb" />
<Compile Include="OptionPanel\DrawOptionPanel\ManageLayerExpander\ManageLayerExpanderVM.vb" />
<Compile Include="OptionPanel\MachiningOptionPanel\MachiningsTreeViewExpander\MachiningTreeViewExpander.vb" />
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\OperationExpanderView.xaml.vb">
<DependentUpon>OperationExpanderView.xaml</DependentUpon>
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\OperationExpanderV.xaml.vb">
<DependentUpon>OperationExpanderV.xaml</DependentUpon>
</Compile>
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\OperationExpanderViewModel.vb" />
<Compile Include="OptionPanel\MachiningOptionPanel\OperationExpander\OperationExpanderVM.vb" />
<Compile Include="OptionPanel\MachiningOptionPanel\SimulationExpander\SimulationExpanderView.xaml.vb">
<DependentUpon>SimulationExpanderView.xaml</DependentUpon>
</Compile>
@@ -381,19 +381,19 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="OptionPanel\MachiningOptionPanel\OperationExpander\DispositionParameterExpander\DispositionParameterExpanderView.xaml">
<Page Include="OptionPanel\MachiningOptionPanel\OperationExpander\DispositionParameterExpander\DispositionParameterExpanderV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="OptionPanel\MachiningOptionPanel\OperationExpander\DispositionParameterExpander\FixtureParameters\FixtureParametersView.xaml">
<Page Include="OptionPanel\MachiningOptionPanel\OperationExpander\DispositionParameterExpander\FixtureParameters\FixtureParametersV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="OptionPanel\MachiningOptionPanel\OperationExpander\DispositionParameterExpander\RawPartOption\RawPartOptionView.xaml">
<Page Include="OptionPanel\MachiningOptionPanel\OperationExpander\DispositionParameterExpander\RawPartOption\RawPartOptionV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="OptionPanel\MachiningOptionPanel\OperationExpander\MachiningParameterExpander\MachiningParameterExpanderView.xaml">
<Page Include="OptionPanel\MachiningOptionPanel\OperationExpander\MachiningParameterExpander\MachiningParameterExpanderV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
@@ -421,23 +421,23 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="OptionPanel\DrawOptionPanel\InfoExpander\InfoExpanderView.xaml">
<Page Include="OptionPanel\DrawOptionPanel\InfoExpander\InfoExpanderV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="OptionPanel\DrawOptionPanel\InputExpander\InputExpanderView.xaml">
<Page Include="OptionPanel\DrawOptionPanel\InputExpander\InputExpanderV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="OptionPanel\DrawOptionPanel\ManageLayerExpander\ManageLayerExpanderView.xaml">
<Page Include="OptionPanel\DrawOptionPanel\ManageLayerExpander\ManageLayerExpanderV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="OptionPanel\MachiningOptionPanel\MachiningsTreeViewExpander\MachiningTreeExpanderView.xaml">
<Page Include="OptionPanel\MachiningOptionPanel\MachiningsTreeViewExpander\MachiningTreeExpanderV.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="OptionPanel\MachiningOptionPanel\OperationExpander\OperationExpanderView.xaml">
<Page Include="OptionPanel\MachiningOptionPanel\OperationExpander\OperationExpanderV.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+52 -56
View File
@@ -1,30 +1,28 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Namespace EgtCAM5
Public Class ExecutePanelVM
Inherits ViewModelBase
Public Class ExecutePanelVM
Inherits ViewModelBase
#Region "FIELDS & PROPERTIES"
Public ReadOnly Property MruScriptNames As ObservableCollection(Of String)
Get
Return IniFile.m_MruScripts.m_FileNames
End Get
End Property
Public ReadOnly Property MruScriptNames As ObservableCollection(Of String)
Get
Return IniFile.m_MruScripts.m_FileNames
End Get
End Property
' Definizione comandi
Private m_cmdExec As ICommand
Private Shared m_cmdOpenMruScript As ICommand
' Definizione comandi
Private m_cmdExec As ICommand
Private Shared m_cmdOpenMruScript As ICommand
#Region "ToolTip"
Public ReadOnly Property ExecToolTip As String
Get
Return EgtMsg(MSG_TOPCOMMANDBAR + 8)
End Get
End Property
Public ReadOnly Property ExecToolTip As String
Get
Return EgtMsg(MSG_TOPCOMMANDBAR + 8)
End Get
End Property
#End Region ' ToolTip
@@ -34,54 +32,52 @@ Namespace EgtCAM5
#Region "ExecCommand"
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property ExecCommand As ICommand
Get
If m_cmdExec Is Nothing Then
m_cmdExec = New RelayCommand(AddressOf Exec)
End If
Return m_cmdExec
End Get
End Property
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property ExecCommand As ICommand
Get
If m_cmdExec Is Nothing Then
m_cmdExec = New RelayCommand(AddressOf Exec)
End If
Return m_cmdExec
End Get
End Property
''' <summary>
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub Exec(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.PREEXECSCRIPT, True)
Application.Msn.NotifyColleagues(Application.EXECSCRIPT, String.Empty)
End Sub
''' <summary>
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub Exec(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.PREEXECSCRIPT, True)
Application.Msn.NotifyColleagues(Application.EXECSCRIPT, String.Empty)
End Sub
#End Region ' ExecCommand
#Region "OpenMruScriptCommand"
''' <summary>
''' Returns a command that do Open.
''' </summary>
Public Shared ReadOnly Property OpenMruScriptCommand As ICommand
Get
If m_cmdOpenMruScript Is Nothing Then
m_cmdOpenMruScript = New RelayCommand(AddressOf OpenMruScript)
End If
Return m_cmdOpenMruScript
End Get
End Property
''' <summary>
''' Returns a command that do Open.
''' </summary>
Public Shared ReadOnly Property OpenMruScriptCommand As ICommand
Get
If m_cmdOpenMruScript Is Nothing Then
m_cmdOpenMruScript = New RelayCommand(AddressOf OpenMruScript)
End If
Return m_cmdOpenMruScript
End Get
End Property
''' <summary>
''' Execute the Open. This method is invoked by the OpenCommand.
''' </summary>
Public Shared Sub OpenMruScript(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.PREEXECSCRIPT, True)
Application.Msn.NotifyColleagues(Application.EXECSCRIPT, DirectCast(param, String).Replace("__", "_"))
End Sub
''' <summary>
''' Execute the Open. This method is invoked by the OpenCommand.
''' </summary>
Public Shared Sub OpenMruScript(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.PREEXECSCRIPT, True)
Application.Msn.NotifyColleagues(Application.EXECSCRIPT, DirectCast(param, String).Replace("__", "_"))
End Sub
#End Region ' OpenMruFileCommand
#End Region ' COMMANDS
End Class
End Namespace
End Class
+199 -203
View File
@@ -1,69 +1,67 @@
Imports EgtUILib
Namespace EgtCAM5
Public Class GridPanelVM
Inherits ViewModelBase
Public Class GridPanelVM
Inherits ViewModelBase
#Region "FIELDS & PROPERTIES"
' Definizione comandi
Private m_cmdCPlaneTop As ICommand
Private m_cmdCPlaneFront As ICommand
Private m_cmdCPlaneRight As ICommand
Private m_cmdCPlaneBack As ICommand
Private m_cmdCPlaneLeft As ICommand
Private m_cmdCPlaneBottom As ICommand
Private m_cmdCPlaneView As ICommand
Private m_cmdCPlaneElevation As ICommand
Private m_cmdCPlaneOrigin As ICommand
Private m_cmdCPlaneRotate As ICommand
Private m_cmdCPlane3P As ICommand
Private m_cmdCPlanePerpObj As ICommand
Private m_cmdCPlaneObj As ICommand
' Definizione comandi
Private m_cmdCPlaneTop As ICommand
Private m_cmdCPlaneFront As ICommand
Private m_cmdCPlaneRight As ICommand
Private m_cmdCPlaneBack As ICommand
Private m_cmdCPlaneLeft As ICommand
Private m_cmdCPlaneBottom As ICommand
Private m_cmdCPlaneView As ICommand
Private m_cmdCPlaneElevation As ICommand
Private m_cmdCPlaneOrigin As ICommand
Private m_cmdCPlaneRotate As ICommand
Private m_cmdCPlane3P As ICommand
Private m_cmdCPlanePerpObj As ICommand
Private m_cmdCPlaneObj As ICommand
#Region "ToolTip"
Public ReadOnly Property CPlaneTopToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 19)
End Get
End Property
Public ReadOnly Property CPlaneFrontToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 20)
End Get
End Property
Public ReadOnly Property CPlaneRightToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 21)
End Get
End Property
Public ReadOnly Property CPlaneBackToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 22)
End Get
End Property
Public ReadOnly Property CPlaneLeftToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 23)
End Get
End Property
Public ReadOnly Property CPlaneBottomToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 24)
End Get
End Property
Public ReadOnly Property CPlaneElevationToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 26)
End Get
End Property
Public ReadOnly Property CPlaneOriginToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 27)
End Get
End Property
Public ReadOnly Property CPlaneTopToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 19)
End Get
End Property
Public ReadOnly Property CPlaneFrontToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 20)
End Get
End Property
Public ReadOnly Property CPlaneRightToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 21)
End Get
End Property
Public ReadOnly Property CPlaneBackToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 22)
End Get
End Property
Public ReadOnly Property CPlaneLeftToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 23)
End Get
End Property
Public ReadOnly Property CPlaneBottomToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 24)
End Get
End Property
Public ReadOnly Property CPlaneElevationToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 26)
End Get
End Property
Public ReadOnly Property CPlaneOriginToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 27)
End Get
End Property
#End Region ' Tooltip
@@ -73,196 +71,194 @@ Namespace EgtCAM5
#Region "CPlaneTopCommand"
''' <summary>
''' Returns a command that do CPlaneTop.
''' </summary>
Public ReadOnly Property CPlaneTopCommand As ICommand
Get
If m_cmdCPlaneTop Is Nothing Then
m_cmdCPlaneTop = New RelayCommand(AddressOf CPlaneTop)
End If
Return m_cmdCPlaneTop
End Get
End Property
''' <summary>
''' Returns a command that do CPlaneTop.
''' </summary>
Public ReadOnly Property CPlaneTopCommand As ICommand
Get
If m_cmdCPlaneTop Is Nothing Then
m_cmdCPlaneTop = New RelayCommand(AddressOf CPlaneTop)
End If
Return m_cmdCPlaneTop
End Get
End Property
''' <summary>
''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand.
''' </summary>
Public Sub CPlaneTop(ByVal param As Object)
Map.refProjectVM.GetController.SetLastInteger(Controller.GRID_TYPE.TOP)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID)
End Sub
''' <summary>
''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand.
''' </summary>
Public Sub CPlaneTop(ByVal param As Object)
Map.refProjectVM.GetController.SetLastInteger(Controller.GRID_TYPE.TOP)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID)
End Sub
#End Region ' CPlaneTopCommand
#Region "CPlaneFrontCommand"
''' <summary>
''' Returns a command that do CPlaneFront.
''' </summary>
Public ReadOnly Property CPlaneFrontCommand As ICommand
Get
If m_cmdCPlaneFront Is Nothing Then
m_cmdCPlaneFront = New RelayCommand(AddressOf CPlaneFront)
End If
Return m_cmdCPlaneFront
End Get
End Property
''' <summary>
''' Returns a command that do CPlaneFront.
''' </summary>
Public ReadOnly Property CPlaneFrontCommand As ICommand
Get
If m_cmdCPlaneFront Is Nothing Then
m_cmdCPlaneFront = New RelayCommand(AddressOf CPlaneFront)
End If
Return m_cmdCPlaneFront
End Get
End Property
''' <summary>
''' Execute the CPlaneFront. This method is invoked by the CPlaneFrontCommand.
''' </summary>
Public Sub CPlaneFront(ByVal param As Object)
Map.refProjectVM.GetController.SetLastInteger(Controller.GRID_TYPE.FRONT)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID)
End Sub
''' <summary>
''' Execute the CPlaneFront. This method is invoked by the CPlaneFrontCommand.
''' </summary>
Public Sub CPlaneFront(ByVal param As Object)
Map.refProjectVM.GetController.SetLastInteger(Controller.GRID_TYPE.FRONT)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID)
End Sub
#End Region ' CPlaneFrontCommand
#Region "CPlaneRightCommand"
''' <summary>
''' Returns a command that do CPlaneRight.
''' </summary>
Public ReadOnly Property CPlaneRightCommand As ICommand
Get
If m_cmdCPlaneRight Is Nothing Then
m_cmdCPlaneRight = New RelayCommand(AddressOf CPlaneRight)
End If
Return m_cmdCPlaneRight
End Get
End Property
''' <summary>
''' Returns a command that do CPlaneRight.
''' </summary>
Public ReadOnly Property CPlaneRightCommand As ICommand
Get
If m_cmdCPlaneRight Is Nothing Then
m_cmdCPlaneRight = New RelayCommand(AddressOf CPlaneRight)
End If
Return m_cmdCPlaneRight
End Get
End Property
''' <summary>
''' Execute the CPlaneRight. This method is invoked by the CPlaneRightCommand.
''' </summary>
Public Sub CPlaneRight(ByVal param As Object)
Map.refProjectVM.GetController.SetLastInteger(Controller.GRID_TYPE.RIGHT)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID)
End Sub
''' <summary>
''' Execute the CPlaneRight. This method is invoked by the CPlaneRightCommand.
''' </summary>
Public Sub CPlaneRight(ByVal param As Object)
Map.refProjectVM.GetController.SetLastInteger(Controller.GRID_TYPE.RIGHT)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID)
End Sub
#End Region ' CPlaneRightCommand
#Region "CPlaneBackCommand"
''' <summary>
''' Returns a command that do CPlaneBack.
''' </summary>
Public ReadOnly Property CPlaneBackCommand As ICommand
Get
If m_cmdCPlaneBack Is Nothing Then
m_cmdCPlaneBack = New RelayCommand(AddressOf CPlaneBack)
End If
Return m_cmdCPlaneBack
End Get
End Property
''' <summary>
''' Returns a command that do CPlaneBack.
''' </summary>
Public ReadOnly Property CPlaneBackCommand As ICommand
Get
If m_cmdCPlaneBack Is Nothing Then
m_cmdCPlaneBack = New RelayCommand(AddressOf CPlaneBack)
End If
Return m_cmdCPlaneBack
End Get
End Property
''' <summary>
''' Execute the CPlaneBack. This method is invoked by the CPlaneBackCommand.
''' </summary>
Public Sub CPlaneBack(ByVal param As Object)
Map.refProjectVM.GetController.SetLastInteger(Controller.GRID_TYPE.BACK)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID)
End Sub
''' <summary>
''' Execute the CPlaneBack. This method is invoked by the CPlaneBackCommand.
''' </summary>
Public Sub CPlaneBack(ByVal param As Object)
Map.refProjectVM.GetController.SetLastInteger(Controller.GRID_TYPE.BACK)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID)
End Sub
#End Region ' CPlaneBackCommand
#Region "CPlaneLeftCommand"
''' <summary>
''' Returns a command that do CPlaneLeft.
''' </summary>
Public ReadOnly Property CPlaneLeftCommand As ICommand
Get
If m_cmdCPlaneLeft Is Nothing Then
m_cmdCPlaneLeft = New RelayCommand(AddressOf CPlaneLeft)
End If
Return m_cmdCPlaneLeft
End Get
End Property
''' <summary>
''' Returns a command that do CPlaneLeft.
''' </summary>
Public ReadOnly Property CPlaneLeftCommand As ICommand
Get
If m_cmdCPlaneLeft Is Nothing Then
m_cmdCPlaneLeft = New RelayCommand(AddressOf CPlaneLeft)
End If
Return m_cmdCPlaneLeft
End Get
End Property
''' <summary>
''' Execute the CPlaneLeft. This method is invoked by the CPlaneLeftCommand.
''' </summary>
Public Sub CPlaneLeft(ByVal param As Object)
Map.refProjectVM.GetController.SetLastInteger(Controller.GRID_TYPE.LEFT)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID)
End Sub
''' <summary>
''' Execute the CPlaneLeft. This method is invoked by the CPlaneLeftCommand.
''' </summary>
Public Sub CPlaneLeft(ByVal param As Object)
Map.refProjectVM.GetController.SetLastInteger(Controller.GRID_TYPE.LEFT)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID)
End Sub
#End Region ' CPlaneLeftCommand
#Region "CPlaneBottomCommand"
''' <summary>
''' Returns a command that do CPlaneBottom.
''' </summary>
Public ReadOnly Property CPlaneBottomCommand As ICommand
Get
If m_cmdCPlaneBottom Is Nothing Then
m_cmdCPlaneBottom = New RelayCommand(AddressOf CPlaneBottom)
End If
Return m_cmdCPlaneBottom
End Get
End Property
''' <summary>
''' Returns a command that do CPlaneBottom.
''' </summary>
Public ReadOnly Property CPlaneBottomCommand As ICommand
Get
If m_cmdCPlaneBottom Is Nothing Then
m_cmdCPlaneBottom = New RelayCommand(AddressOf CPlaneBottom)
End If
Return m_cmdCPlaneBottom
End Get
End Property
''' <summary>
''' Execute the CPlaneBottom. This method is invoked by the CPlaneBottomCommand.
''' </summary>
Public Sub CPlaneBottom(ByVal param As Object)
Map.refProjectVM.GetController.SetLastInteger(Controller.GRID_TYPE.BOTTOM)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID)
End Sub
''' <summary>
''' Execute the CPlaneBottom. This method is invoked by the CPlaneBottomCommand.
''' </summary>
Public Sub CPlaneBottom(ByVal param As Object)
Map.refProjectVM.GetController.SetLastInteger(Controller.GRID_TYPE.BOTTOM)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID)
End Sub
#End Region ' CPlaneBottomCommand
#Region "CPlaneElevationCommand"
''' <summary>
''' Returns a command that do CPlaneElevation.
''' </summary>
Public ReadOnly Property CPlaneElevationCommand As ICommand
Get
If m_cmdCPlaneElevation Is Nothing Then
m_cmdCPlaneElevation = New RelayCommand(AddressOf CPlaneElevation)
End If
Return m_cmdCPlaneElevation
End Get
End Property
''' <summary>
''' Returns a command that do CPlaneElevation.
''' </summary>
Public ReadOnly Property CPlaneElevationCommand As ICommand
Get
If m_cmdCPlaneElevation Is Nothing Then
m_cmdCPlaneElevation = New RelayCommand(AddressOf CPlaneElevation)
End If
Return m_cmdCPlaneElevation
End Get
End Property
''' <summary>
''' Execute the CPlaneElevation. This method is invoked by the CPlaneElevationCommand.
''' </summary>
Public Sub CPlaneElevation(ByVal param As Object)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID_ELEVATION)
End Sub
''' <summary>
''' Execute the CPlaneElevation. This method is invoked by the CPlaneElevationCommand.
''' </summary>
Public Sub CPlaneElevation(ByVal param As Object)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID_ELEVATION)
End Sub
#End Region ' CPlaneElevationCommand
#Region "CPlaneOriginCommand"
''' <summary>
''' Returns a command that do CPlaneOrigin.
''' </summary>
Public ReadOnly Property CPlaneOriginCommand As ICommand
Get
If m_cmdCPlaneOrigin Is Nothing Then
m_cmdCPlaneOrigin = New RelayCommand(AddressOf CPlaneOrigin)
End If
Return m_cmdCPlaneOrigin
End Get
End Property
''' <summary>
''' Returns a command that do CPlaneOrigin.
''' </summary>
Public ReadOnly Property CPlaneOriginCommand As ICommand
Get
If m_cmdCPlaneOrigin Is Nothing Then
m_cmdCPlaneOrigin = New RelayCommand(AddressOf CPlaneOrigin)
End If
Return m_cmdCPlaneOrigin
End Get
End Property
''' <summary>
''' Execute the CPlaneOrigin. This method is invoked by the CPlaneOriginCommand.
''' </summary>
Public Sub CPlaneOrigin(ByVal param As Object)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID_ORIGIN)
End Sub
''' <summary>
''' Execute the CPlaneOrigin. This method is invoked by the CPlaneOriginCommand.
''' </summary>
Public Sub CPlaneOrigin(ByVal param As Object)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID_ORIGIN)
End Sub
#End Region ' CPlaneOriginCommand
#End Region ' COMMANDS
End Class
End Namespace
End Class
+106 -110
View File
@@ -1,155 +1,151 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Namespace EgtCAM5
Public Class GunStockPanelVM
Inherits ViewModelBase
Public Class GunStockPanelVM
Inherits ViewModelBase
Public ReadOnly Property MruNewGunStockNames As ObservableCollection(Of String)
Get
Return IniFile.m_MruNewGunStock.m_FileNames
End Get
End Property
Public ReadOnly Property MruNewGunStockNames As ObservableCollection(Of String)
Get
Return IniFile.m_MruNewGunStock.m_FileNames
End Get
End Property
Public ReadOnly Property MruModifyGunStockNames As ObservableCollection(Of String)
Get
Return IniFile.m_MruModifyGunStock.m_FileNames
End Get
End Property
Public ReadOnly Property MruModifyGunStockNames As ObservableCollection(Of String)
Get
Return IniFile.m_MruModifyGunStock.m_FileNames
End Get
End Property
#Region "Messages"
Public ReadOnly Property NewGunStockMsg As String
Get
Return EgtMsg(MSG_GUNSTOCK + 1)
End Get
End Property
Public ReadOnly Property ModifyGunStockMsg As String
Get
Return EgtMsg(MSG_GUNSTOCK + 3)
End Get
End Property
Public ReadOnly Property NewGunStockMsg As String
Get
Return EgtMsg(MSG_GUNSTOCK + 1)
End Get
End Property
Public ReadOnly Property ModifyGunStockMsg As String
Get
Return EgtMsg(MSG_GUNSTOCK + 3)
End Get
End Property
#End Region ' Messages
#Region "ToolTip"
Public ReadOnly Property NewGunStockToolTip As String
Get
Return EgtMsg(MSG_GUNSTOCK + 2)
End Get
End Property
Public ReadOnly Property ModifyGunStockToolTip As String
Get
Return EgtMsg(MSG_GUNSTOCK + 4)
End Get
End Property
Public ReadOnly Property NewGunStockToolTip As String
Get
Return EgtMsg(MSG_GUNSTOCK + 2)
End Get
End Property
Public ReadOnly Property ModifyGunStockToolTip As String
Get
Return EgtMsg(MSG_GUNSTOCK + 4)
End Get
End Property
#End Region ' ToolTip
' Definizione comandi
Private m_cmdNewGunStock As ICommand
Private m_cmdModifyGunStock As ICommand
Private Shared m_cmdOpenMruNewGunStock As ICommand
Private Shared m_cmdOpenMruModifyGunStock As ICommand
' Definizione comandi
Private m_cmdNewGunStock As ICommand
Private m_cmdModifyGunStock As ICommand
Private Shared m_cmdOpenMruNewGunStock As ICommand
Private Shared m_cmdOpenMruModifyGunStock As ICommand
#Region "COMMANDS"
#Region "NewGunStockCommand"
''' <summary>
''' Returns a command that do Import.
''' </summary>
Public ReadOnly Property NewGunStockCommand As ICommand
Get
If m_cmdNewGunStock Is Nothing Then
m_cmdNewGunStock = New RelayCommand(AddressOf NewGunStock)
End If
Return m_cmdNewGunStock
End Get
End Property
''' <summary>
''' Returns a command that do Import.
''' </summary>
Public ReadOnly Property NewGunStockCommand As ICommand
Get
If m_cmdNewGunStock Is Nothing Then
m_cmdNewGunStock = New RelayCommand(AddressOf NewGunStock)
End If
Return m_cmdNewGunStock
End Get
End Property
''' <summary>
''' Execute the Door. This method is invoked by the DoorsCommand.
''' </summary>
Public Sub NewGunStock(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.GUNSTOCKNEW, String.Empty)
End Sub
''' <summary>
''' Execute the Door. This method is invoked by the DoorsCommand.
''' </summary>
Public Sub NewGunStock(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.GUNSTOCKNEW, String.Empty)
End Sub
#End Region ' NewGunStockCommand
#Region "ModifyGunStockCommand"
''' <summary>
''' Returns a command that do Import.
''' </summary>
Public ReadOnly Property ModifyGunStockCommand As ICommand
Get
If m_cmdModifyGunStock Is Nothing Then
m_cmdModifyGunStock = New RelayCommand(AddressOf ModifyGunStock)
End If
Return m_cmdModifyGunStock
End Get
End Property
''' <summary>
''' Returns a command that do Import.
''' </summary>
Public ReadOnly Property ModifyGunStockCommand As ICommand
Get
If m_cmdModifyGunStock Is Nothing Then
m_cmdModifyGunStock = New RelayCommand(AddressOf ModifyGunStock)
End If
Return m_cmdModifyGunStock
End Get
End Property
''' <summary>
''' Execute the Door. This method is invoked by the DoorsCommand.
''' </summary>
Public Sub ModifyGunStock(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.GUNSTOCKMODIF, String.Empty)
End Sub
''' <summary>
''' Execute the Door. This method is invoked by the DoorsCommand.
''' </summary>
Public Sub ModifyGunStock(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.GUNSTOCKMODIF, String.Empty)
End Sub
#End Region ' ModifyGunStockCommand
#Region "OpenMruNewGunStockCommand"
''' <summary>
''' Returns a command that do Open.
''' </summary>
Public Shared ReadOnly Property OpenMruNewGunStockCommand As ICommand
Get
If m_cmdOpenMruNewGunStock Is Nothing Then
m_cmdOpenMruNewGunStock = New RelayCommand(AddressOf OpenMruNewGunStock)
End If
Return m_cmdOpenMruNewGunStock
End Get
End Property
''' <summary>
''' Returns a command that do Open.
''' </summary>
Public Shared ReadOnly Property OpenMruNewGunStockCommand As ICommand
Get
If m_cmdOpenMruNewGunStock Is Nothing Then
m_cmdOpenMruNewGunStock = New RelayCommand(AddressOf OpenMruNewGunStock)
End If
Return m_cmdOpenMruNewGunStock
End Get
End Property
''' <summary>
''' Execute the Open. This method is invoked by the OpenCommand.
''' </summary>
Public Shared Sub OpenMruNewGunStock(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.GUNSTOCKNEW, DirectCast(param, String).Replace("__", "_"))
End Sub
''' <summary>
''' Execute the Open. This method is invoked by the OpenCommand.
''' </summary>
Public Shared Sub OpenMruNewGunStock(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.GUNSTOCKNEW, DirectCast(param, String).Replace("__", "_"))
End Sub
#End Region ' OpenMruNewGunStockCommand
#Region "OpenMruModifyGunStockCommand"
''' <summary>
''' Returns a command that do Open.
''' </summary>
Public Shared ReadOnly Property OpenMruModifyGunStockCommand As ICommand
Get
If m_cmdOpenMruModifyGunStock Is Nothing Then
m_cmdOpenMruModifyGunStock = New RelayCommand(AddressOf OpenMruModifyGunStock)
End If
Return m_cmdOpenMruModifyGunStock
End Get
End Property
''' <summary>
''' Returns a command that do Open.
''' </summary>
Public Shared ReadOnly Property OpenMruModifyGunStockCommand As ICommand
Get
If m_cmdOpenMruModifyGunStock Is Nothing Then
m_cmdOpenMruModifyGunStock = New RelayCommand(AddressOf OpenMruModifyGunStock)
End If
Return m_cmdOpenMruModifyGunStock
End Get
End Property
''' <summary>
''' Execute the Open. This method is invoked by the OpenCommand.
''' </summary>
Public Shared Sub OpenMruModifyGunStock(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.GUNSTOCKMODIF, DirectCast(param, String).Replace("__", "_"))
End Sub
''' <summary>
''' Execute the Open. This method is invoked by the OpenCommand.
''' </summary>
Public Shared Sub OpenMruModifyGunStock(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.GUNSTOCKMODIF, DirectCast(param, String).Replace("__", "_"))
End Sub
#End Region ' OpenMruNewGunStockCommand
#End Region
End Class
End Namespace
End Class
+73 -77
View File
@@ -1,101 +1,97 @@
Imports EgtUILib
Namespace EgtCAM5
Public Class InstrumentPanelVM
Inherits ViewModelBase
Public Class InstrumentPanelVM
Inherits ViewModelBase
#Region "FIELDS & PROPERTIES"
#Region "ToolTip"
Public ReadOnly Property AnalyzeToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 17)
End Get
End Property
Public ReadOnly Property GetDistToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 18)
End Get
End Property
Public ReadOnly Property AnalyzeToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 17)
End Get
End Property
Public ReadOnly Property GetDistToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 18)
End Get
End Property
#End Region ' ToolTip
Private m_AnalyzeIsChecked As Boolean
Public Property AnalyzeIsChecked As Boolean
Get
Return m_AnalyzeIsChecked
End Get
Set(value As Boolean)
If value <> m_AnalyzeIsChecked Then
m_AnalyzeIsChecked = value
If value Then
Map.refProjectVM.GetScene.SetStatusAnalyze()
Else
Map.refProjectVM.GetScene.ResetStatusAnalyze()
Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREE, GDB_ID.NULL)
End If
OnPropertyChanged("AnalyzeIsChecked")
Private m_AnalyzeIsChecked As Boolean
Public Property AnalyzeIsChecked As Boolean
Get
Return m_AnalyzeIsChecked
End Get
Set(value As Boolean)
If value <> m_AnalyzeIsChecked Then
m_AnalyzeIsChecked = value
If value Then
Map.refProjectVM.GetScene.SetStatusAnalyze()
Else
Map.refProjectVM.GetScene.ResetStatusAnalyze()
Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREE, GDB_ID.NULL)
End If
End Set
End Property
OnPropertyChanged("AnalyzeIsChecked")
End If
End Set
End Property
Private m_AnalyzeIsEnabled As Boolean
Public Property AnalyzeIsEnabled As Boolean
Get
Return m_AnalyzeIsEnabled
End Get
Set(value As Boolean)
If value <> m_AnalyzeIsEnabled Then
m_AnalyzeIsEnabled = value
OnPropertyChanged("AnalyzeIsEnabled")
End If
End Set
End Property
Private m_AnalyzeIsEnabled As Boolean
Public Property AnalyzeIsEnabled As Boolean
Get
Return m_AnalyzeIsEnabled
End Get
Set(value As Boolean)
If value <> m_AnalyzeIsEnabled Then
m_AnalyzeIsEnabled = value
OnPropertyChanged("AnalyzeIsEnabled")
End If
End Set
End Property
Private m_GetDistIsChecked As Boolean
Public Property GetDistIsChecked As Boolean
Get
Return m_GetDistIsChecked
End Get
Set(value As Boolean)
If value <> m_GetDistIsChecked Then
m_GetDistIsChecked = value
If value Then
Map.refProjectVM.GetScene.SetStatusGetDistance()
Else
Map.refProjectVM.GetScene.ResetStatusGetDistance()
Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, String.Empty)
End If
OnPropertyChanged("GetDistIsChecked")
Private m_GetDistIsChecked As Boolean
Public Property GetDistIsChecked As Boolean
Get
Return m_GetDistIsChecked
End Get
Set(value As Boolean)
If value <> m_GetDistIsChecked Then
m_GetDistIsChecked = value
If value Then
Map.refProjectVM.GetScene.SetStatusGetDistance()
Else
Map.refProjectVM.GetScene.ResetStatusGetDistance()
Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, String.Empty)
End If
End Set
End Property
OnPropertyChanged("GetDistIsChecked")
End If
End Set
End Property
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New()
Application.Msn.Register(Application.MACHININGMODE_ISCHECKED, Sub()
AnalyzeIsChecked = False
AnalyzeIsEnabled = False
End Sub)
Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub()
AnalyzeIsEnabled = True
Sub New()
Application.Msn.Register(Application.MACHININGMODE_ISCHECKED, Sub()
AnalyzeIsChecked = False
AnalyzeIsEnabled = False
End Sub)
Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub()
AnalyzeIsEnabled = True
End Sub)
Application.Msn.Register(Application.ANALYZE_ISCHECKED, Sub(bIsChecked As Boolean)
AnalyzeIsChecked = bIsChecked
End Sub)
Application.Msn.Register(Application.GETDISTANCE_ISCHECKED, Sub(bIsChecked As Boolean)
GetDistIsChecked = bIsChecked
End Sub)
Application.Msn.Register(Application.ANALYZE_ISCHECKED, Sub(bIsChecked As Boolean)
AnalyzeIsChecked = bIsChecked
End Sub)
Application.Msn.Register(Application.GETDISTANCE_ISCHECKED, Sub(bIsChecked As Boolean)
GetDistIsChecked = bIsChecked
End Sub)
End Sub
End Sub
#End Region ' CONSTRUCTOR
End Class
End Namespace
End Class
-1
View File
@@ -13,7 +13,6 @@
'--------------------------------------------------------------------------------------------------
Imports System.Collections.ObjectModel
'Imports EgtCAM5.EgtCAM5
Public Class MruList
-1
View File
@@ -1,6 +1,5 @@
Imports System.Windows
Imports System.Windows.Controls.Primitives
Imports EgtCAM5.EgtCAM5
Imports EgtWPFLib5
Public Class MTableDbV
+227 -231
View File
@@ -2,162 +2,160 @@
Imports System.IO
Imports EgtUILib
Namespace EgtCAM5
Public Class MachGroupPanelVM
Inherits ViewModelBase
Public Class MachGroupPanelVM
Inherits ViewModelBase
#Region "FIELDS & PROPERTIES"
Private m_MachGroupList As New ObservableCollection(Of String)
Public Property MachGroupList As ObservableCollection(Of String)
Get
Return m_MachGroupList
End Get
Set(value As ObservableCollection(Of String))
If value IsNot m_MachGroupList Then
m_MachGroupList = value
End If
End Set
End Property
Private m_MachGroupList As New ObservableCollection(Of String)
Public Property MachGroupList As ObservableCollection(Of String)
Get
Return m_MachGroupList
End Get
Set(value As ObservableCollection(Of String))
If value IsNot m_MachGroupList Then
m_MachGroupList = value
End If
End Set
End Property
Private m_SelectedMachGroup As String
Public Property SelectedMachGroup As String
Get
Return m_SelectedMachGroup
End Get
Set(value As String)
m_SelectedMachGroup = value
OnPropertyChanged("SelectedMachGroup")
End Set
End Property
Private m_SelectedMachGroup As String
Public Property SelectedMachGroup As String
Get
Return m_SelectedMachGroup
End Get
Set(value As String)
m_SelectedMachGroup = value
OnPropertyChanged("SelectedMachGroup")
End Set
End Property
Private m_IsEnabled As Boolean = True
Public Property MachGroupPanelIsEnabled As Boolean
Get
Return m_IsEnabled
End Get
Set(value As Boolean)
m_IsEnabled = value
OnPropertyChanged("MachGroupPanelIsEnabled")
End Set
End Property
Private m_IsEnabled As Boolean = True
Public Property MachGroupPanelIsEnabled As Boolean
Get
Return m_IsEnabled
End Get
Set(value As Boolean)
m_IsEnabled = value
OnPropertyChanged("MachGroupPanelIsEnabled")
End Set
End Property
' Definizione comandi
Private m_cmdSetCurrMachGroup As ICommand
Private m_cmdAddMachGroup As ICommand
Private m_cmdRemoveMachGroup As ICommand
' Definizione comandi
Private m_cmdSetCurrMachGroup As ICommand
Private m_cmdAddMachGroup As ICommand
Private m_cmdRemoveMachGroup As ICommand
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New()
Application.Msn.Register(Application.INITIALIZEMACHGROUPS, Sub()
InitializeMachGroups()
End Sub)
Application.Msn.Register(Application.MACHGROUPSISENABLED, Sub(MgpIsEnabled As Boolean)
Me.MachGroupPanelIsEnabled = MgpIsEnabled
End Sub)
End Sub
Sub New()
Application.Msn.Register(Application.INITIALIZEMACHGROUPS, Sub()
InitializeMachGroups()
End Sub)
Application.Msn.Register(Application.MACHGROUPSISENABLED, Sub(MgpIsEnabled As Boolean)
Me.MachGroupPanelIsEnabled = MgpIsEnabled
End Sub)
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Private Sub InitializeMachGroups()
' calcolo bbox di tutti i pezzi disegnati
'Dim bboxAllParts As New BBox3d
'CalculateAllPartsBbox(bboxAllParts)
Dim bOk As Boolean = False
Dim nId = EgtGetLastMachGroup()
If nId <> GDB_ID.NULL Then
bOk = EgtSetCurrMachGroup(nId)
Else
bOk = AddNewMachGroup()
Private Sub InitializeMachGroups()
' calcolo bbox di tutti i pezzi disegnati
'Dim bboxAllParts As New BBox3d
'CalculateAllPartsBbox(bboxAllParts)
Dim bOk As Boolean = False
Dim nId = EgtGetLastMachGroup()
If nId <> GDB_ID.NULL Then
bOk = EgtSetCurrMachGroup(nId)
Else
bOk = AddNewMachGroup()
End If
If bOk Then
'CalculatePartsTranslationVt(bboxAllParts)
'TraslateParts()
LoadMachGroups()
SelectedMachGroup = MachGroupList(MachGroupList.Count() - 1)
End If
If IniFile.m_bShowOnlyTable Then EgtShowOnlyTable(True)
Application.Msn.NotifyColleagues(Application.MACHGROUPSRESULT, bOk)
End Sub
Private Sub CalculateAllPartsBbox(ByRef bboxAllParts As BBox3d)
Dim nPart As Integer = EgtGetFirstPart()
While nPart <> GDB_ID.NULL
Dim bboxPart As New BBox3d
EgtGetBBoxGlob(nPart, GDB_BB.STANDARD, bboxPart)
bboxAllParts.Add(bboxPart)
nPart = EgtGetNextPart(nPart)
End While
End Sub
Private Sub CalculatePartsTranslationVt(bboxAllParts As BBox3d)
' recupero area della tavola
Dim ptTableMin As Point3d
Dim ptTableMax As Point3d
Dim X = EgtGetTableArea(1, ptTableMin, ptTableMax)
IniFile.m_vtMachPartsPos = (New Point3d(ptTableMin.x, ptTableMin.y - 250, ptTableMin.z) - New Point3d(bboxAllParts.Min.x, bboxAllParts.Max.y, bboxAllParts.Min.z))
End Sub
Private Sub TraslateParts()
Dim nPart As Integer = EgtGetFirstPart()
While nPart <> GDB_ID.NULL
EgtMove(nPart, IniFile.m_vtMachPartsPos)
nPart = EgtGetNextPart(nPart)
End While
nPart = EgtGetFirstGhostPart()
While nPart <> GDB_ID.NULL
EgtMove(nPart, IniFile.m_vtMachPartsPos)
nPart = EgtGetNextGhostPart(nPart)
End While
End Sub
Private Sub LoadMachGroups()
' Pulisco la lista
MachGroupList.Clear()
' Carico i gruppi di lavorazione nella lista
Dim nId = EgtGetFirstMachGroup()
While nId <> GDB_ID.NULL
Dim sName As String = String.Empty
EgtGetMachGroupName(nId, sName)
MachGroupList.Add(sName)
nId = EgtGetNextMachGroup(nId)
End While
End Sub
Private Function AddNewMachGroup() As Boolean
' Creazione nuovo gruppo di lavorazione
Dim sNewMachName As String = "Mach_1"
EgtGetMachGroupNewName(sNewMachName)
Dim bOk As Boolean = (EgtAddMachGroup(sNewMachName) <> GDB_ID.NULL)
' leggo nome script di disposizione automatica
Dim sInitScriptPath As String = String.Empty
EgtUILib.GetPrivateProfileString(S_DISPOSITION, K_INITSCRIPT, "", sInitScriptPath, IniFile.m_sCurrMachIniFilePath)
' se è attivo, uso lo script di disposizione
If bOk AndAlso OptionModule.m_bUseDispositionScript And Not String.IsNullOrEmpty(sInitScriptPath) Then
sInitScriptPath = IniFile.m_sCurrMachScriptsDirPath & "\" & sInitScriptPath
If Not File.Exists(sInitScriptPath) OrElse Not EgtLuaExecFile(sInitScriptPath) Then
EgtOutLog("Error executing disposition init script " & sInitScriptPath)
MessageBox.Show(EgtMsg(MSG_DISPOSITIONERRORS + 2) & " " & sInitScriptPath, EgtMsg(MSG_DISPOSITIONERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Exclamation)
End If
If bOk Then
'CalculatePartsTranslationVt(bboxAllParts)
'TraslateParts()
LoadMachGroups()
SelectedMachGroup = MachGroupList(MachGroupList.Count() - 1)
End If
' leggo nome attrezzaggio di default
Dim sDefaultSetUpName As String = String.Empty
EgtUILib.GetPrivateProfileString(S_SETUP, K_DEFAULT, "", sDefaultSetUpName, IniFile.m_sCurrMachIniFilePath)
' se è attiva l'opzione, rendo corrente l'attrezzaggio di default
If bOk And Not String.IsNullOrEmpty(sDefaultSetUpName) Then
If Not EgtImportSetup(String.Empty) Then
EgtOutLog("Error loading default setup " & sDefaultSetUpName)
MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 9) & " " & sDefaultSetUpName, EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Exclamation)
End If
If IniFile.m_bShowOnlyTable Then EgtShowOnlyTable(True)
Application.Msn.NotifyColleagues(Application.MACHGROUPSRESULT, bOk)
End Sub
Private Sub CalculateAllPartsBbox(ByRef bboxAllParts As BBox3d)
Dim nPart As Integer = EgtGetFirstPart()
While nPart <> GDB_ID.NULL
Dim bboxPart As New BBox3d
EgtGetBBoxGlob(nPart, GDB_BB.STANDARD, bboxPart)
bboxAllParts.Add(bboxPart)
nPart = EgtGetNextPart(nPart)
End While
End Sub
Private Sub CalculatePartsTranslationVt(bboxAllParts As BBox3d)
' recupero area della tavola
Dim ptTableMin As Point3d
Dim ptTableMax As Point3d
Dim X = EgtGetTableArea(1, ptTableMin, ptTableMax)
IniFile.m_vtMachPartsPos = (New Point3d(ptTableMin.x, ptTableMin.y - 250, ptTableMin.z) - New Point3d(bboxAllParts.Min.x, bboxAllParts.Max.y, bboxAllParts.Min.z))
End Sub
Private Sub TraslateParts()
Dim nPart As Integer = EgtGetFirstPart()
While nPart <> GDB_ID.NULL
EgtMove(nPart, IniFile.m_vtMachPartsPos)
nPart = EgtGetNextPart(nPart)
End While
nPart = EgtGetFirstGhostPart()
While nPart <> GDB_ID.NULL
EgtMove(nPart, IniFile.m_vtMachPartsPos)
nPart = EgtGetNextGhostPart(nPart)
End While
End Sub
Private Sub LoadMachGroups()
' Pulisco la lista
MachGroupList.Clear()
' Carico i gruppi di lavorazione nella lista
Dim nId = EgtGetFirstMachGroup()
While nId <> GDB_ID.NULL
Dim sName As String = String.Empty
EgtGetMachGroupName(nId, sName)
MachGroupList.Add(sName)
nId = EgtGetNextMachGroup(nId)
End While
End Sub
Private Function AddNewMachGroup() As Boolean
' Creazione nuovo gruppo di lavorazione
Dim sNewMachName As String = "Mach_1"
EgtGetMachGroupNewName(sNewMachName)
Dim bOk As Boolean = (EgtAddMachGroup(sNewMachName) <> GDB_ID.NULL)
' leggo nome script di disposizione automatica
Dim sInitScriptPath As String = String.Empty
EgtUILib.GetPrivateProfileString(S_DISPOSITION, K_INITSCRIPT, "", sInitScriptPath, IniFile.m_sCurrMachIniFilePath)
' se è attivo, uso lo script di disposizione
If bOk AndAlso OptionModule.m_bUseDispositionScript And Not String.IsNullOrEmpty(sInitScriptPath) Then
sInitScriptPath = IniFile.m_sCurrMachScriptsDirPath & "\" & sInitScriptPath
If Not File.Exists(sInitScriptPath) OrElse Not EgtLuaExecFile(sInitScriptPath) Then
EgtOutLog("Error executing disposition init script " & sInitScriptPath)
MessageBox.Show(EgtMsg(MSG_DISPOSITIONERRORS + 2) & " " & sInitScriptPath, EgtMsg(MSG_DISPOSITIONERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Exclamation)
End If
End If
' leggo nome attrezzaggio di default
Dim sDefaultSetUpName As String = String.Empty
EgtUILib.GetPrivateProfileString(S_SETUP, K_DEFAULT, "", sDefaultSetUpName, IniFile.m_sCurrMachIniFilePath)
' se è attiva l'opzione, rendo corrente l'attrezzaggio di default
If bOk And Not String.IsNullOrEmpty(sDefaultSetUpName) Then
If Not EgtImportSetup(String.Empty) Then
EgtOutLog("Error loading default setup " & sDefaultSetUpName)
MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 9) & " " & sDefaultSetUpName, EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Exclamation)
End If
End If
Return bOk
End Function
End If
Return bOk
End Function
#End Region
@@ -165,115 +163,113 @@ Namespace EgtCAM5
#Region "SetCurrMachGroupCommand"
''' <summary>
''' Returns a command that set the selected MachGroup as the Current one.
''' </summary>
Public ReadOnly Property SetCurrMachGroupCommand As ICommand
Get
If m_cmdSetCurrMachGroup Is Nothing Then
m_cmdSetCurrMachGroup = New RelayCommand(AddressOf SetCurrMachGroup)
End If
Return m_cmdSetCurrMachGroup
End Get
End Property
''' <summary>
''' Returns a command that set the selected MachGroup as the Current one.
''' </summary>
Public ReadOnly Property SetCurrMachGroupCommand As ICommand
Get
If m_cmdSetCurrMachGroup Is Nothing Then
m_cmdSetCurrMachGroup = New RelayCommand(AddressOf SetCurrMachGroup)
End If
Return m_cmdSetCurrMachGroup
End Get
End Property
Public Sub SetCurrMachGroup(ByVal param As Object)
EgtSetCurrMachGroup(EgtGetMachGroupId(DirectCast(param, String)))
If IniFile.m_bShowOnlyTable Then EgtShowOnlyTable(True)
EgtZoom(ZM.ALL)
Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, -1)
Application.Msn.NotifyColleagues(Application.UPDATECURRENTMACHINE)
End Sub
Public Sub SetCurrMachGroup(ByVal param As Object)
EgtSetCurrMachGroup(EgtGetMachGroupId(DirectCast(param, String)))
If IniFile.m_bShowOnlyTable Then EgtShowOnlyTable(True)
EgtZoom(ZM.ALL)
Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, -1)
Application.Msn.NotifyColleagues(Application.UPDATECURRENTMACHINE)
End Sub
#End Region ' SetCurrMachGroupCommand
#Region "AddMachGroupCommand"
''' <summary>
''' Returns a command that set the selected MachGroup as the Current one.
''' </summary>
Public ReadOnly Property AddMachGroupCommand As ICommand
Get
If m_cmdAddMachGroup Is Nothing Then
m_cmdAddMachGroup = New RelayCommand(AddressOf AddMachGroup)
End If
Return m_cmdAddMachGroup
End Get
End Property
Public Sub AddMachGroup()
If AddNewMachGroup() Then
Dim sMachName As String = String.Empty
EgtGetMachGroupName(EgtGetCurrMachGroup(), sMachName)
MachGroupList.Add(sMachName)
SelectedMachGroup = sMachName
EgtDraw()
Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, -1)
Application.Msn.NotifyColleagues(Application.UPDATECURRENTMACHINE)
''' <summary>
''' Returns a command that set the selected MachGroup as the Current one.
''' </summary>
Public ReadOnly Property AddMachGroupCommand As ICommand
Get
If m_cmdAddMachGroup Is Nothing Then
m_cmdAddMachGroup = New RelayCommand(AddressOf AddMachGroup)
End If
End Sub
Return m_cmdAddMachGroup
End Get
End Property
Public Sub AddMachGroup()
If AddNewMachGroup() Then
Dim sMachName As String = String.Empty
EgtGetMachGroupName(EgtGetCurrMachGroup(), sMachName)
MachGroupList.Add(sMachName)
SelectedMachGroup = sMachName
EgtDraw()
Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, -1)
Application.Msn.NotifyColleagues(Application.UPDATECURRENTMACHINE)
End If
End Sub
#End Region ' AddMachGroupCommand
#Region "RemoveMachGroupCommand"
''' <summary>
''' Returns a command that set the selected MachGroup as the Current one.
''' </summary>
Public ReadOnly Property RemoveMachGroupCommand As ICommand
Get
If m_cmdRemoveMachGroup Is Nothing Then
m_cmdRemoveMachGroup = New RelayCommand(AddressOf RemoveMachGroup)
End If
Return m_cmdRemoveMachGroup
End Get
End Property
Public Sub RemoveMachGroup()
' Calcolo indice del gruppo da cancellare
Dim nSelectedMachGroupIndex As Integer = MachGroupList.IndexOf(SelectedMachGroup)
If nSelectedMachGroupIndex = 0 And MachGroupList.Count = 1 Then
' chiedo conferma prima di cancellare il gruppo di lavorazione
Select Case MessageBox.Show(EgtMsg(MSG_MACHGROUP + 2), "", MessageBoxButton.YesNo, MessageBoxImage.Question)
Case MessageBoxResult.Yes
' cancello il gruppo corrente
EgtRemoveMachGroup(EgtGetMachGroupId(MachGroupList(nSelectedMachGroupIndex)))
' aggiorno la lista dei gruppi
MachGroupList.RemoveAt(nSelectedMachGroupIndex)
' ritorno alla modalità disegno
Map.refTopCommandBarVM.DrawIsChecked = True
Case MessageBoxResult.No
Return
End Select
Else
' chiedo conferma prima di cancellare il gruppo di lavorazione
Select Case MessageBox.Show(EgtMsg(MSG_MACHGROUP + 2), "", MessageBoxButton.YesNo, MessageBoxImage.Question)
Case MessageBoxResult.Yes
If nSelectedMachGroupIndex = 0 And MachGroupList.Count > 1 Then
' rendo corrente il gruppo di lavorazione successivo a quello da cancellare
EgtSetCurrMachGroup(EgtGetMachGroupId(MachGroupList(nSelectedMachGroupIndex + 1)))
SelectedMachGroup = MachGroupList(nSelectedMachGroupIndex + 1)
ElseIf nSelectedMachGroupIndex > 0 Then
' rendo corrente il gruppo di lavorazione precedente a quello da cancellare
EgtSetCurrMachGroup(EgtGetMachGroupId(MachGroupList(nSelectedMachGroupIndex - 1)))
SelectedMachGroup = MachGroupList(nSelectedMachGroupIndex - 1)
End If
EgtDraw()
' cancello quello selezionato
EgtRemoveMachGroup(EgtGetMachGroupId(MachGroupList(nSelectedMachGroupIndex)))
' aggiorno la lista dei gruppi
MachGroupList.RemoveAt(nSelectedMachGroupIndex)
Case MessageBoxResult.No
Return
End Select
''' <summary>
''' Returns a command that set the selected MachGroup as the Current one.
''' </summary>
Public ReadOnly Property RemoveMachGroupCommand As ICommand
Get
If m_cmdRemoveMachGroup Is Nothing Then
m_cmdRemoveMachGroup = New RelayCommand(AddressOf RemoveMachGroup)
End If
Return m_cmdRemoveMachGroup
End Get
End Property
End Sub
Public Sub RemoveMachGroup()
' Calcolo indice del gruppo da cancellare
Dim nSelectedMachGroupIndex As Integer = MachGroupList.IndexOf(SelectedMachGroup)
If nSelectedMachGroupIndex = 0 And MachGroupList.Count = 1 Then
' chiedo conferma prima di cancellare il gruppo di lavorazione
Select Case MessageBox.Show(EgtMsg(MSG_MACHGROUP + 2), "", MessageBoxButton.YesNo, MessageBoxImage.Question)
Case MessageBoxResult.Yes
' cancello il gruppo corrente
EgtRemoveMachGroup(EgtGetMachGroupId(MachGroupList(nSelectedMachGroupIndex)))
' aggiorno la lista dei gruppi
MachGroupList.RemoveAt(nSelectedMachGroupIndex)
' ritorno alla modalità disegno
Map.refTopCommandBarVM.DrawIsChecked = True
Case MessageBoxResult.No
Return
End Select
Else
' chiedo conferma prima di cancellare il gruppo di lavorazione
Select Case MessageBox.Show(EgtMsg(MSG_MACHGROUP + 2), "", MessageBoxButton.YesNo, MessageBoxImage.Question)
Case MessageBoxResult.Yes
If nSelectedMachGroupIndex = 0 And MachGroupList.Count > 1 Then
' rendo corrente il gruppo di lavorazione successivo a quello da cancellare
EgtSetCurrMachGroup(EgtGetMachGroupId(MachGroupList(nSelectedMachGroupIndex + 1)))
SelectedMachGroup = MachGroupList(nSelectedMachGroupIndex + 1)
ElseIf nSelectedMachGroupIndex > 0 Then
' rendo corrente il gruppo di lavorazione precedente a quello da cancellare
EgtSetCurrMachGroup(EgtGetMachGroupId(MachGroupList(nSelectedMachGroupIndex - 1)))
SelectedMachGroup = MachGroupList(nSelectedMachGroupIndex - 1)
End If
EgtDraw()
' cancello quello selezionato
EgtRemoveMachGroup(EgtGetMachGroupId(MachGroupList(nSelectedMachGroupIndex)))
' aggiorno la lista dei gruppi
MachGroupList.RemoveAt(nSelectedMachGroupIndex)
Case MessageBoxResult.No
Return
End Select
End If
End Sub
#End Region ' RemoveMachGroupCommand
#End Region ' COMMANDS
End Class
End Namespace
End Class
+166 -170
View File
@@ -1,204 +1,200 @@
Imports System.IO
Imports EgtUILib
Namespace EgtCAM5
Public Class MachOptionVM
Public Class MachOptionVM
Private m_sSafeZ As String
Public Property SafeZ As String
Get
Return m_sSafeZ
End Get
Set(value As String)
Dim dSafeZ As Double = 0
If StringToLen(value, dSafeZ) Then
EgtMdbSetGeneralParam(MCH_GP.SAFEZ, dSafeZ)
EgtMdbSave()
m_sSafeZ = value
End If
End Set
End Property
Private m_sSafeAggrBottZ As String
Public Property SafeAggrBottZ As String
Get
Return m_sSafeAggrBottZ
End Get
Set(value As String)
Dim dSafeAggrBottZ As Double = 0
If StringToLen(value, dSafeAggrBottZ) Then
EgtMdbSetGeneralParam(MCH_GP.SAFEAGGRBOTTZ, dSafeAggrBottZ)
EgtMdbSave()
m_sSafeAggrBottZ = value
End If
End Set
End Property
Private m_sHolesTolerance As String
Public Property HolesTolerance As String
Get
Return m_sHolesTolerance
End Get
Set(value As String)
Dim dHolesTolerance As Double = 0
If StringToLen(value, dHolesTolerance) Then
EgtMdbSetGeneralParam(MCH_GP.HOLEDIAMTOLER, dHolesTolerance)
EgtMdbSave()
m_sHolesTolerance = value
End If
End Set
End Property
Private m_SplitArcsList As New List(Of MCH_SA)({MCH_SA.NEVER, MCH_SA.GEN_PLANE, MCH_SA.NO_XY_PLANE, MCH_SA.ALWAYS})
Public ReadOnly Property SplitArcsList As List(Of MCH_SA)
Get
Return m_SplitArcsList
End Get
End Property
Private m_SelectedSplitArcs As MCH_SA
Public Property SelectedSplitArcs As MCH_SA
Get
Return m_SelectedSplitArcs
End Get
Set(value As MCH_SA)
EgtMdbSetGeneralParam(MCH_GP.SPLITARCS, value)
Private m_sSafeZ As String
Public Property SafeZ As String
Get
Return m_sSafeZ
End Get
Set(value As String)
Dim dSafeZ As Double = 0
If StringToLen(value, dSafeZ) Then
EgtMdbSetGeneralParam(MCH_GP.SAFEZ, dSafeZ)
EgtMdbSave()
m_SelectedSplitArcs = value
End Set
End Property
m_sSafeZ = value
End If
End Set
End Property
Private m_ArchivedSetUpList As New List(Of String)
Public Property ArchivedSetUpList As List(Of String)
Get
Return m_ArchivedSetUpList
End Get
Set(value As List(Of String))
m_ArchivedSetUpList = value
End Set
End Property
Private m_sSafeAggrBottZ As String
Public Property SafeAggrBottZ As String
Get
Return m_sSafeAggrBottZ
End Get
Set(value As String)
Dim dSafeAggrBottZ As Double = 0
If StringToLen(value, dSafeAggrBottZ) Then
EgtMdbSetGeneralParam(MCH_GP.SAFEAGGRBOTTZ, dSafeAggrBottZ)
EgtMdbSave()
m_sSafeAggrBottZ = value
End If
End Set
End Property
Public Property SelectedDefaultSetUp As String
Get
Return MachOptionModule.m_sSelectedDefaultSetUp
End Get
Set(value As String)
MachOptionModule.m_sSelectedDefaultSetUp = value
EgtUILib.WritePrivateProfileString(S_SETUP, K_DEFAULT, If(Not IsNothing(value), value, String.Empty), IniFile.m_sCurrMachIniFilePath)
End Set
End Property
Private m_sHolesTolerance As String
Public Property HolesTolerance As String
Get
Return m_sHolesTolerance
End Get
Set(value As String)
Dim dHolesTolerance As Double = 0
If StringToLen(value, dHolesTolerance) Then
EgtMdbSetGeneralParam(MCH_GP.HOLEDIAMTOLER, dHolesTolerance)
EgtMdbSave()
m_sHolesTolerance = value
End If
End Set
End Property
Private m_SplitArcsList As New List(Of MCH_SA)({MCH_SA.NEVER, MCH_SA.GEN_PLANE, MCH_SA.NO_XY_PLANE, MCH_SA.ALWAYS})
Public ReadOnly Property SplitArcsList As List(Of MCH_SA)
Get
Return m_SplitArcsList
End Get
End Property
Private m_SelectedSplitArcs As MCH_SA
Public Property SelectedSplitArcs As MCH_SA
Get
Return m_SelectedSplitArcs
End Get
Set(value As MCH_SA)
EgtMdbSetGeneralParam(MCH_GP.SPLITARCS, value)
EgtMdbSave()
m_SelectedSplitArcs = value
End Set
End Property
Private m_ArchivedSetUpList As New List(Of String)
Public Property ArchivedSetUpList As List(Of String)
Get
Return m_ArchivedSetUpList
End Get
Set(value As List(Of String))
m_ArchivedSetUpList = value
End Set
End Property
Public Property SelectedDefaultSetUp As String
Get
Return MachOptionModule.m_sSelectedDefaultSetUp
End Get
Set(value As String)
MachOptionModule.m_sSelectedDefaultSetUp = value
EgtUILib.WritePrivateProfileString(S_SETUP, K_DEFAULT, If(Not IsNothing(value), value, String.Empty), IniFile.m_sCurrMachIniFilePath)
End Set
End Property
#Region "Messages"
Public ReadOnly Property SafeZMsg As String
Get
Return EgtMsg(MSG_MACHININGOPTIONPAGE + 1)
End Get
End Property
Public ReadOnly Property SafeZMsg As String
Get
Return EgtMsg(MSG_MACHININGOPTIONPAGE + 1)
End Get
End Property
Public ReadOnly Property SafeAggrBottZMsg As String
Get
Return EgtMsg(MSG_MACHININGOPTIONPAGE + 8)
End Get
End Property
Public ReadOnly Property SafeAggrBottZMsg As String
Get
Return EgtMsg(MSG_MACHININGOPTIONPAGE + 8)
End Get
End Property
Public ReadOnly Property HolesToleranceMsg As String
Get
Return EgtMsg(MSG_MACHININGOPTIONPAGE + 9)
End Get
End Property
Public ReadOnly Property HolesToleranceMsg As String
Get
Return EgtMsg(MSG_MACHININGOPTIONPAGE + 9)
End Get
End Property
Public ReadOnly Property SplitArcsMsg As String
Get
Return EgtMsg(MSG_MACHININGOPTIONPAGE + 2)
End Get
End Property
Public ReadOnly Property SplitArcsMsg As String
Get
Return EgtMsg(MSG_MACHININGOPTIONPAGE + 2)
End Get
End Property
Public ReadOnly Property DefaultSetUpMsg As String
Get
Return EgtMsg(MSG_MACHININGOPTIONPAGE + 7)
End Get
End Property
Public ReadOnly Property DefaultSetUpMsg As String
Get
Return EgtMsg(MSG_MACHININGOPTIONPAGE + 7)
End Get
End Property
#End Region
' Definizione comandi
Private m_cmdCloseMachOptions As ICommand
' Definizione comandi
Private m_cmdCloseMachOptions As ICommand
Sub New()
' Leggo distanza di sicurezza
Dim dVal As Double = 0
EgtMdbGetGeneralParam(MCH_GP.SAFEZ, dVal)
m_sSafeZ = LenToString(dVal, 2)
' Leggo distanza di sicurezza per rinvii da sotto
dVal = 0
EgtMdbGetGeneralParam(MCH_GP.SAFEAGGRBOTTZ, dVal)
m_sSafeAggrBottZ = LenToString(dVal, 2)
' Leggo tolleranza tra diametro punta e diametro foro
dVal = 0
EgtMdbGetGeneralParam(MCH_GP.HOLEDIAMTOLER, dVal)
m_sHolesTolerance = LenToString(dVal, 2)
' Leggo tipo di spezzatura archi
Dim nVal As Integer = 0
EgtMdbGetGeneralParam(MCH_GP.SPLITARCS, nVal)
m_SelectedSplitArcs = DirectCast(nVal, MCH_SA)
' Riempio lista attrezzaggi salvati
m_ArchivedSetUpList.Add(String.Empty)
If Directory.Exists(IniFile.m_sCurrMachSetUpDirPath) Then
Dim SetUpFileNames() As String = Directory.GetFiles(IniFile.m_sCurrMachSetUpDirPath)
For FileIndex = 0 To SetUpFileNames.Count - 1
If Path.GetExtension(SetUpFileNames(FileIndex)).ToLower = ".stu" Then
m_ArchivedSetUpList.Add(Path.GetFileNameWithoutExtension(SetUpFileNames(FileIndex)))
End If
Next
End If
' Leggo attrezzaggio predefinito
If EgtUILib.GetPrivateProfileString(S_SETUP, K_DEFAULT, "", MachOptionModule.m_sSelectedDefaultSetUp, IniFile.m_sCurrMachIniFilePath) <= 0 Then
SelectedDefaultSetUp = Nothing
Else
If Not m_ArchivedSetUpList.Contains(MachOptionModule.m_sSelectedDefaultSetUp) Then
SelectedDefaultSetUp = Nothing
Sub New()
' Leggo distanza di sicurezza
Dim dVal As Double = 0
EgtMdbGetGeneralParam(MCH_GP.SAFEZ, dVal)
m_sSafeZ = LenToString(dVal, 2)
' Leggo distanza di sicurezza per rinvii da sotto
dVal = 0
EgtMdbGetGeneralParam(MCH_GP.SAFEAGGRBOTTZ, dVal)
m_sSafeAggrBottZ = LenToString(dVal, 2)
' Leggo tolleranza tra diametro punta e diametro foro
dVal = 0
EgtMdbGetGeneralParam(MCH_GP.HOLEDIAMTOLER, dVal)
m_sHolesTolerance = LenToString(dVal, 2)
' Leggo tipo di spezzatura archi
Dim nVal As Integer = 0
EgtMdbGetGeneralParam(MCH_GP.SPLITARCS, nVal)
m_SelectedSplitArcs = DirectCast(nVal, MCH_SA)
' Riempio lista attrezzaggi salvati
m_ArchivedSetUpList.Add(String.Empty)
If Directory.Exists(IniFile.m_sCurrMachSetUpDirPath) Then
Dim SetUpFileNames() As String = Directory.GetFiles(IniFile.m_sCurrMachSetUpDirPath)
For FileIndex = 0 To SetUpFileNames.Count - 1
If Path.GetExtension(SetUpFileNames(FileIndex)).ToLower = ".stu" Then
m_ArchivedSetUpList.Add(Path.GetFileNameWithoutExtension(SetUpFileNames(FileIndex)))
End If
Next
End If
' Leggo attrezzaggio predefinito
If EgtUILib.GetPrivateProfileString(S_SETUP, K_DEFAULT, "", MachOptionModule.m_sSelectedDefaultSetUp, IniFile.m_sCurrMachIniFilePath) <= 0 Then
SelectedDefaultSetUp = Nothing
Else
If Not m_ArchivedSetUpList.Contains(MachOptionModule.m_sSelectedDefaultSetUp) Then
SelectedDefaultSetUp = Nothing
End If
End Sub
End If
End Sub
#Region "COMMANDS"
#Region "CloseMachOptionsCommand"
''' <summary>
''' Returns a command that remove the current selected machining.
''' </summary>
Public ReadOnly Property CloseMachOptionsCommand() As ICommand
Get
If m_cmdCloseMachOptions Is Nothing Then
m_cmdCloseMachOptions = New RelayCommand(AddressOf CloseMachOptions)
End If
Return m_cmdCloseMachOptions
End Get
End Property
''' <summary>
''' Returns a command that remove the current selected machining.
''' </summary>
Public ReadOnly Property CloseMachOptionsCommand() As ICommand
Get
If m_cmdCloseMachOptions Is Nothing Then
m_cmdCloseMachOptions = New RelayCommand(AddressOf CloseMachOptions)
End If
Return m_cmdCloseMachOptions
End Get
End Property
''' <summary>
''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand.
''' </summary>
Public Sub CloseMachOptions()
' Chiusura finestra
For Each Window In Application.Current.Windows
If TypeOf Window Is MachOptionV Then
Dim MachOptionsWindow As MachOptionV = DirectCast(Window, MachOptionV)
MachOptionsWindow.Close()
End If
Next
End Sub
''' <summary>
''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand.
''' </summary>
Public Sub CloseMachOptions()
' Chiusura finestra
For Each Window In Application.Current.Windows
If TypeOf Window Is MachOptionV Then
Dim MachOptionsWindow As MachOptionV = DirectCast(Window, MachOptionV)
MachOptionsWindow.Close()
End If
Next
End Sub
#End Region ' CloseMachOptionsCommand
#End Region ' COMMANDS
End Class
End Namespace
End Class
Public Class SplitArcTypeConverter
Implements IValueConverter
+107 -111
View File
@@ -1,44 +1,42 @@
Imports EgtUILib
Namespace EgtCAM5
Public Class MachinePanelVM
Inherits ViewModelBase
Public Class MachinePanelVM
Inherits ViewModelBase
#Region "FIELDS & PROPERTIES"
' Definizione comandi
Private m_cmdToolDb As ICommand
Private m_cmdMachDb As ICommand
Private m_cmdMachOptions As ICommand
' Definizione comandi
Private m_cmdToolDb As ICommand
Private m_cmdMachDb As ICommand
Private m_cmdMachOptions As ICommand
#Region "Messages"
Public ReadOnly Property ToolDBMsg As String
Get
Return EgtMsg(MSG_MAINWINDOW + 6)
End Get
End Property
Public ReadOnly Property MachiningDbMsg As String
Get
Return EgtMsg(MSG_MAINWINDOW + 7)
End Get
End Property
Public ReadOnly Property ToolDBMsg As String
Get
Return EgtMsg(MSG_MAINWINDOW + 6)
End Get
End Property
Public ReadOnly Property MachiningDbMsg As String
Get
Return EgtMsg(MSG_MAINWINDOW + 7)
End Get
End Property
#End Region ' Messages
#Region "ToolTip"
Public ReadOnly Property ToolDBToolTip As String
Get
Return EgtMsg(MSG_MAINWINDOW + 3)
End Get
End Property
Public ReadOnly Property MachiningDbToolTip As String
Get
Return EgtMsg(MSG_MAINWINDOW + 4)
End Get
End Property
Public ReadOnly Property ToolDBToolTip As String
Get
Return EgtMsg(MSG_MAINWINDOW + 3)
End Get
End Property
Public ReadOnly Property MachiningDbToolTip As String
Get
Return EgtMsg(MSG_MAINWINDOW + 4)
End Get
End Property
#End Region ' ToolTip
@@ -48,104 +46,102 @@ Namespace EgtCAM5
#Region "ToolDbCommand"
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property ToolDbCommand As ICommand
Get
If m_cmdToolDb Is Nothing Then
m_cmdToolDb = New RelayCommand(AddressOf ToolDb)
End If
Return m_cmdToolDb
End Get
End Property
''' <summary>
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub ToolDb(ByVal param As Object)
If Not EgtVerifyMachinesDir() Then Return
' ricarico il database per intercettare eventuali aggiornamenti fatti da altre istanze del programma (se la cartella Machines è condivisa)
If Not EgtTdbReload() Then
EgtOutLog("Impossible reloading tool Db")
MessageBox.Show(EgtMsg(MSG_TOOLSERRORS + 30), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property ToolDbCommand As ICommand
Get
If m_cmdToolDb Is Nothing Then
m_cmdToolDb = New RelayCommand(AddressOf ToolDb)
End If
Dim ToolDbWindow As New ToolsDbV
ToolDbWindow.Height = 640
ToolDbWindow.Width = 1024
ToolDbWindow.DataContext = New ToolsDbVM
ToolDbWindow.Owner = Application.Current.MainWindow
ToolDbWindow.ShowDialog()
End Sub
Return m_cmdToolDb
End Get
End Property
''' <summary>
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub ToolDb(ByVal param As Object)
If Not EgtVerifyMachinesDir() Then Return
' ricarico il database per intercettare eventuali aggiornamenti fatti da altre istanze del programma (se la cartella Machines è condivisa)
If Not EgtTdbReload() Then
EgtOutLog("Impossible reloading tool Db")
MessageBox.Show(EgtMsg(MSG_TOOLSERRORS + 30), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
Dim ToolDbWindow As New ToolsDbV
ToolDbWindow.Height = 640
ToolDbWindow.Width = 1024
ToolDbWindow.DataContext = New ToolsDbVM
ToolDbWindow.Owner = Application.Current.MainWindow
ToolDbWindow.ShowDialog()
End Sub
#End Region ' ToolDbCommand
#Region "MachDbCommand"
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property MachDbCommand As ICommand
Get
If m_cmdMachDb Is Nothing Then
m_cmdMachDb = New RelayCommand(AddressOf MachDb)
End If
Return m_cmdMachDb
End Get
End Property
''' <summary>
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub MachDb(ByVal param As Object)
If Not EgtVerifyMachinesDir() Then Return
' ricarico il database per intercettare eventuali aggiornamenti fatti da altre istanze del programma (se la cartella Machines è condivisa)
If Not EgtMdbReload() Then
EgtOutLog("Impossible reloading machining Db")
MessageBox.Show(EgtMsg(MSG_MACHININGSERRORS + 7), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property MachDbCommand As ICommand
Get
If m_cmdMachDb Is Nothing Then
m_cmdMachDb = New RelayCommand(AddressOf MachDb)
End If
Dim MachDbWindow As New MachiningDbV
MachDbWindow.Height = 614
MachDbWindow.Width = 1024
MachDbWindow.DataContext = New MachiningDbVM
MachDbWindow.Owner = Application.Current.MainWindow
MachDbWindow.ShowDialog()
End Sub
Return m_cmdMachDb
End Get
End Property
''' <summary>
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub MachDb(ByVal param As Object)
If Not EgtVerifyMachinesDir() Then Return
' ricarico il database per intercettare eventuali aggiornamenti fatti da altre istanze del programma (se la cartella Machines è condivisa)
If Not EgtMdbReload() Then
EgtOutLog("Impossible reloading machining Db")
MessageBox.Show(EgtMsg(MSG_MACHININGSERRORS + 7), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
Dim MachDbWindow As New MachiningDbV
MachDbWindow.Height = 614
MachDbWindow.Width = 1024
MachDbWindow.DataContext = New MachiningDbVM
MachDbWindow.Owner = Application.Current.MainWindow
MachDbWindow.ShowDialog()
End Sub
#End Region ' MachDbCommand
#Region "MachOptionsCommand"
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property MachOptionsCommand As ICommand
Get
If m_cmdMachOptions Is Nothing Then
m_cmdMachOptions = New RelayCommand(AddressOf MachOptions)
End If
Return m_cmdMachOptions
End Get
End Property
''' <summary>
''' Returns a command that do Exec.
''' </summary>
Public ReadOnly Property MachOptionsCommand As ICommand
Get
If m_cmdMachOptions Is Nothing Then
m_cmdMachOptions = New RelayCommand(AddressOf MachOptions)
End If
Return m_cmdMachOptions
End Get
End Property
''' <summary>
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub MachOptions(ByVal param As Object)
Dim MachOptionWindow As New MachOptionV
'MachOptionWindow.Height = 614
'MachOptionWindow.Width = 256
MachOptionWindow.DataContext = New MachOptionVM
MachOptionWindow.Owner = Application.Current.MainWindow
MachOptionWindow.ShowDialog()
End Sub
''' <summary>
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub MachOptions(ByVal param As Object)
Dim MachOptionWindow As New MachOptionV
'MachOptionWindow.Height = 614
'MachOptionWindow.Width = 256
MachOptionWindow.DataContext = New MachOptionVM
MachOptionWindow.Owner = Application.Current.MainWindow
MachOptionWindow.ShowDialog()
End Sub
#End Region ' MachOptionsCommand
#End Region ' COMMANDS
End Class
End Namespace
End Class
File diff suppressed because it is too large Load Diff
-1
View File
@@ -4,7 +4,6 @@
xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:local="clr-namespace:EgtCAM5"
xmlns:EgtCAM5="clr-namespace:EgtCAM5.EgtCAM5"
Title="{Binding Title}" Icon="/Resources/EgtCAM5.ico"
TitleBarBrush="{StaticResource EgaltechBlue1}" TitleBarHeight="32"
BorderBrush="{StaticResource EgaltechBlue1}" BorderThickness="2"
+393 -397
View File
@@ -5,103 +5,101 @@ Imports System.Runtime.InteropServices
Imports System.Math
Imports EgtUILib
Namespace EgtCAM5
Public Class MainWindowVM
Inherits ViewModelBase
Public Class MainWindowVM
Inherits ViewModelBase
#Region "FIELDS"
' EGALTECH ENVIRONMENT FIELDS
Private m_objMutex As Mutex
Private m_sDataRoot As String = String.Empty
Private m_sConfigDir As String = String.Empty
Private m_nDebug As Integer = 0
' EGALTECH ENVIRONMENT FIELDS
Private m_objMutex As Mutex
Private m_sDataRoot As String = String.Empty
Private m_sConfigDir As String = String.Empty
Private m_nDebug As Integer = 0
' EGALTECH ENVIRONMENT FIELDS WITH PROPERTY
' EGALTECH ENVIRONMENT FIELDS WITH PROPERTY
' GRAPHICAL FIELDS
' Event commands
' MainWindow ContentRendered Event
' GRAPHICAL FIELDS
' Event commands
' MainWindow ContentRendered Event
Private m_Title As String = String.Empty
Public Property Title As String
Get
Return m_Title
End Get
Set(value As String)
If value <> m_Title Then
m_Title = value
OnPropertyChanged("Title")
End If
End Set
End Property
Private m_Title As String = String.Empty
Public Property Title As String
Get
Return m_Title
End Get
Set(value As String)
If value <> m_Title Then
m_Title = value
OnPropertyChanged("Title")
End If
End Set
End Property
Private m_cmdMainWindow_ContentRendered As ICommand
Private m_cmdAboutBox As ICommand
' MainWindow Activated Event
Private m_cmdMainWindow_Activated As ICommand
' MainWindow Deactivated Event
Private m_cmdMainWindow_Deactivated As ICommand
' MainWindow Closing Event
Private m_cmdMainWindow_Closing As ICommand
Private m_cmdCloseApplication As ICommand
Private m_cmdMainWindow_ContentRendered As ICommand
Private m_cmdAboutBox As ICommand
' MainWindow Activated Event
Private m_cmdMainWindow_Activated As ICommand
' MainWindow Deactivated Event
Private m_cmdMainWindow_Deactivated As ICommand
' MainWindow Closing Event
Private m_cmdMainWindow_Closing As ICommand
Private m_cmdCloseApplication As ICommand
' GRAPHICAL ELEMENTS
Private m_TopCommandBar As TopCommandBarV
Public ReadOnly Property TopCommandBar As TopCommandBarV
Get
If IsNothing(m_TopCommandBar) Then
m_TopCommandBar = New TopCommandBarV
m_TopCommandBar.DataContext = New TopCommandBarVM
End If
Return m_TopCommandBar
End Get
End Property
' GRAPHICAL ELEMENTS
Private m_TopCommandBar As TopCommandBarV
Public ReadOnly Property TopCommandBar As TopCommandBarV
Get
If IsNothing(m_TopCommandBar) Then
m_TopCommandBar = New TopCommandBarV
m_TopCommandBar.DataContext = New TopCommandBarVM
End If
Return m_TopCommandBar
End Get
End Property
' GRAPHICAL FIELDS WITH PROPERTY
' GRAPHICAL FIELDS WITH PROPERTY
Private m_StatusBar As StatusBarV
Private m_bfirst As Boolean = True
Public ReadOnly Property StatusBar As StatusBarV
Get
If m_bfirst Then
m_bfirst = False
m_StatusBar = New StatusBarV
m_StatusBar.DataContext = New StatusBarVM
End If
Return m_StatusBar
End Get
End Property
Private m_StatusBar As StatusBarV
Private m_bfirst As Boolean = True
Public ReadOnly Property StatusBar As StatusBarV
Get
If m_bfirst Then
m_bfirst = False
m_StatusBar = New StatusBarV
m_StatusBar.DataContext = New StatusBarVM
End If
Return m_StatusBar
End Get
End Property
Private m_ProjectPage As ProjectV
Private m_bFirstProjectPage As Boolean = True
Public ReadOnly Property ProjectPage As ProjectV
Get
If m_bFirstProjectPage Then
m_bFirstProjectPage = False
m_ProjectPage = New ProjectV
m_ProjectPage.DataContext = New ProjectVM
End If
Return m_ProjectPage
End Get
End Property
Private m_ProjectPage As ProjectV
Private m_bFirstProjectPage As Boolean = True
Public ReadOnly Property ProjectPage As ProjectV
Get
If m_bFirstProjectPage Then
m_bFirstProjectPage = False
m_ProjectPage = New ProjectV
m_ProjectPage.DataContext = New ProjectVM
End If
Return m_ProjectPage
End Get
End Property
#End Region
#Region "CONSTRUCTOR"
Sub New()
' Inizializzo EgtCAM5Map
Map.BeginInit(Me)
' INITIALIZE EGALTECH ENVIRONMENT
InitializeEgtEnvironment()
Sub New()
' Inizializzo EgtCAM5Map
Map.BeginInit(Me)
' INITIALIZE EGALTECH ENVIRONMENT
InitializeEgtEnvironment()
RegisterMyMessages()
RegisterMyMessages()
AddHandler Application.Current.MainWindow.KeyDown, AddressOf MainWindow_KeyDown
AddHandler Application.Current.MainWindow.KeyDown, AddressOf MainWindow_KeyDown
End Sub
End Sub
#End Region ' Constructor
@@ -109,154 +107,154 @@ Namespace EgtCAM5
#Region "AboutBoxCommand"
' Returns a command that manage the MainWindow_Unloaded command
Public ReadOnly Property AboutBoxCommand() As ICommand
Get
If m_cmdAboutBox Is Nothing Then
m_cmdAboutBox = New Command(AddressOf AboutBox)
End If
Return m_cmdAboutBox
End Get
End Property
' Returns a command that manage the MainWindow_Unloaded command
Public ReadOnly Property AboutBoxCommand() As ICommand
Get
If m_cmdAboutBox Is Nothing Then
m_cmdAboutBox = New Command(AddressOf AboutBox)
End If
Return m_cmdAboutBox
End Get
End Property
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
Public Sub AboutBox(ByVal param As Object)
Dim AboutBoxWindow As New AboutBoxWndV
AboutBoxWindow.Owner = Application.Current.MainWindow
AboutBoxWindow.ShowDialog()
End Sub
' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
Public Sub AboutBox(ByVal param As Object)
Dim AboutBoxWindow As New AboutBoxWndV
AboutBoxWindow.Owner = Application.Current.MainWindow
AboutBoxWindow.ShowDialog()
End Sub
#End Region ' AboutBoxCommand
#Region "CloseApplicationCommand"
''' <summary>
''' Returns a command that manage the MainWindow_Unloaded command
''' </summary>
Public ReadOnly Property CloseApplicationCommand() As ICommand
Get
If m_cmdCloseApplication Is Nothing Then
m_cmdCloseApplication = New RelayCommand(AddressOf CloseApplication)
End If
Return m_cmdCloseApplication
End Get
End Property
''' <summary>
''' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
''' </summary>
Public Sub CloseApplication(ByVal param As Object)
If IniFile.m_bScriptRunning Then
If Not IniFile.m_bFailedRun Then
'MessageBox.Show("Can't exit now. Wait until the end of the script execution", "", MessageBoxButton.OK, MessageBoxImage.Stop)
Return
End If
''' <summary>
''' Returns a command that manage the MainWindow_Unloaded command
''' </summary>
Public ReadOnly Property CloseApplicationCommand() As ICommand
Get
If m_cmdCloseApplication Is Nothing Then
m_cmdCloseApplication = New RelayCommand(AddressOf CloseApplication)
End If
If IniFile.m_bSimulExecuting Then
' Impossibile uscire ora. Prima fermare la simulazione o aspettarne la fine!
MessageBox.Show(EgtMsg(MSG_SIMULATION + 13), "", MessageBoxButton.OK, MessageBoxImage.Exclamation)
Return m_cmdCloseApplication
End Get
End Property
''' <summary>
''' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded.
''' </summary>
Public Sub CloseApplication(ByVal param As Object)
If IniFile.m_bScriptRunning Then
If Not IniFile.m_bFailedRun Then
'MessageBox.Show("Can't exit now. Wait until the end of the script execution", "", MessageBoxButton.OK, MessageBoxImage.Stop)
Return
End If
' Gestisco eventuale file corrente modificato
Application.Msn.NotifyColleagues(Application.MANAGEMODIFIED)
If m_allowWindowToClose Then
Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATION)
' Salvo posizione Form (se non minimizzato)
If Application.Current.MainWindow.WindowState <> WindowState.Minimized Then
Dim WinPos As New WinPos
WindowToWinPos(Application.Current.MainWindow, WinPos)
WritePrivateProfileWinPos(S_GENERAL, K_WINPLACE, WinPos.nFlag, WinPos.nLeft, WinPos.nTop, WinPos.nWidth, WinPos.nHeight)
End If
' Terminazione generale di EgtInterface
EgtExit()
' Rilascio mutex
If Not IsNothing(m_objMutex) Then m_objMutex.Close()
' Aggiorno istanze usate
Dim nTmp As Integer = GetPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
nTmp -= (1 << (IniFile.m_nInstance - 1))
WritePrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
' Salvo impostazione macchina corrente
Application.Msn.NotifyColleagues(Application.SAVECURRENTMACHINE)
' Chiudo la finestra principale del programma
Application.Current.MainWindow.Close()
End If
If IniFile.m_bSimulExecuting Then
' Impossibile uscire ora. Prima fermare la simulazione o aspettarne la fine!
MessageBox.Show(EgtMsg(MSG_SIMULATION + 13), "", MessageBoxButton.OK, MessageBoxImage.Exclamation)
Return
End If
' Gestisco eventuale file corrente modificato
Application.Msn.NotifyColleagues(Application.MANAGEMODIFIED)
If m_allowWindowToClose Then
Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATION)
' Salvo posizione Form (se non minimizzato)
If Application.Current.MainWindow.WindowState <> WindowState.Minimized Then
Dim WinPos As New WinPos
WindowToWinPos(Application.Current.MainWindow, WinPos)
WritePrivateProfileWinPos(S_GENERAL, K_WINPLACE, WinPos.nFlag, WinPos.nLeft, WinPos.nTop, WinPos.nWidth, WinPos.nHeight)
End If
End Sub
' Terminazione generale di EgtInterface
EgtExit()
' Rilascio mutex
If Not IsNothing(m_objMutex) Then m_objMutex.Close()
' Aggiorno istanze usate
Dim nTmp As Integer = GetPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
nTmp -= (1 << (IniFile.m_nInstance - 1))
WritePrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
' Salvo impostazione macchina corrente
Application.Msn.NotifyColleagues(Application.SAVECURRENTMACHINE)
' Chiudo la finestra principale del programma
Application.Current.MainWindow.Close()
End If
End Sub
#End Region ' CloseApplicationCommand
#Region "cmdMainWindow_ContentRendered"
''' <summary>
''' Returns a command that manage the MainWindow_ContentRendered command
''' </summary>
Public ReadOnly Property cmdMainWindow_ContentRendered() As ICommand
Get
If m_cmdMainWindow_ContentRendered Is Nothing Then
m_cmdMainWindow_ContentRendered = New RelayCommand(AddressOf MainWindow_ContentRendered)
End If
Return m_cmdMainWindow_ContentRendered
End Get
End Property
''' <summary>
''' Manage the MainWindow_ContentRendered event. This method is invoked by the cmdMainWindow_ContentRendered.
''' </summary>
Public Sub MainWindow_ContentRendered(ByVal param As Object)
' Notify the ContentRendered event
Application.Msn.NotifyColleagues(Application.MAINWINDOW_CONTENTRENDERED)
' se sono in modalità solo cad
If IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then
Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, "Impossible finding Machines dir. EgtCAM5 will run in CAD-ONLY mode.")
''' <summary>
''' Returns a command that manage the MainWindow_ContentRendered command
''' </summary>
Public ReadOnly Property cmdMainWindow_ContentRendered() As ICommand
Get
If m_cmdMainWindow_ContentRendered Is Nothing Then
m_cmdMainWindow_ContentRendered = New RelayCommand(AddressOf MainWindow_ContentRendered)
End If
End Sub
Return m_cmdMainWindow_ContentRendered
End Get
End Property
''' <summary>
''' Manage the MainWindow_ContentRendered event. This method is invoked by the cmdMainWindow_ContentRendered.
''' </summary>
Public Sub MainWindow_ContentRendered(ByVal param As Object)
' Notify the ContentRendered event
Application.Msn.NotifyColleagues(Application.MAINWINDOW_CONTENTRENDERED)
' se sono in modalità solo cad
If IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then
Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, "Impossible finding Machines dir. EgtCAM5 will run in CAD-ONLY mode.")
End If
End Sub
#End Region ' ContentRendered Command
#Region "cmdMainWindow_Activated"
''' <summary>
''' Returns a command that manage the MainWindow_ContentRendered command
''' </summary>
Public ReadOnly Property cmdMainWindow_Activated() As ICommand
Get
If m_cmdMainWindow_Activated Is Nothing Then
m_cmdMainWindow_Activated = New RelayCommand(AddressOf MainWindow_Activated)
End If
Return m_cmdMainWindow_Activated
End Get
End Property
''' <summary>
''' Returns a command that manage the MainWindow_ContentRendered command
''' </summary>
Public ReadOnly Property cmdMainWindow_Activated() As ICommand
Get
If m_cmdMainWindow_Activated Is Nothing Then
m_cmdMainWindow_Activated = New RelayCommand(AddressOf MainWindow_Activated)
End If
Return m_cmdMainWindow_Activated
End Get
End Property
''' <summary>
''' Manage the MainWindow_ContentRendered event. This method is invoked by the cmdMainWindow_ContentRendered.
''' </summary>
Public Sub MainWindow_Activated(ByVal param As Object)
' Notify the ContentRendered event
Application.Msn.NotifyColleagues(Application.MAINWINDOW_ACTIVATED)
End Sub
''' <summary>
''' Manage the MainWindow_ContentRendered event. This method is invoked by the cmdMainWindow_ContentRendered.
''' </summary>
Public Sub MainWindow_Activated(ByVal param As Object)
' Notify the ContentRendered event
Application.Msn.NotifyColleagues(Application.MAINWINDOW_ACTIVATED)
End Sub
#End Region ' Activated Command
#Region "cmdMainWindow_Deactivated"
''' <summary>
''' Returns a command that manage the MainWindow_ContentRendered command
''' </summary>
Public ReadOnly Property cmdMainWindow_Deactivated() As ICommand
Get
If m_cmdMainWindow_Deactivated Is Nothing Then
m_cmdMainWindow_Deactivated = New RelayCommand(AddressOf MainWindow_Deactivated)
End If
Return m_cmdMainWindow_Deactivated
End Get
End Property
''' <summary>
''' Returns a command that manage the MainWindow_ContentRendered command
''' </summary>
Public ReadOnly Property cmdMainWindow_Deactivated() As ICommand
Get
If m_cmdMainWindow_Deactivated Is Nothing Then
m_cmdMainWindow_Deactivated = New RelayCommand(AddressOf MainWindow_Deactivated)
End If
Return m_cmdMainWindow_Deactivated
End Get
End Property
''' <summary>
''' Manage the MainWindow_ContentRendered event. This method is invoked by the cmdMainWindow_ContentRendered.
''' </summary>
Public Sub MainWindow_Deactivated(ByVal param As Object)
' Notify the ContentRendered event
Application.Msn.NotifyColleagues(Application.MAINWINDOW_DEACTIVATED)
End Sub
''' <summary>
''' Manage the MainWindow_ContentRendered event. This method is invoked by the cmdMainWindow_ContentRendered.
''' </summary>
Public Sub MainWindow_Deactivated(ByVal param As Object)
' Notify the ContentRendered event
Application.Msn.NotifyColleagues(Application.MAINWINDOW_DEACTIVATED)
End Sub
#End Region ' Deactivated Command
@@ -264,173 +262,183 @@ Namespace EgtCAM5
#Region "METHODS"
Private Sub RegisterMyMessages()
Application.Msn.Register(Application.CLOSEAPPLICATIONCOMMAND, Sub()
Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATION)
' Terminazione generale di EgtInterface
EgtExit()
' Rilascio mutex
If Not IsNothing(m_objMutex) Then m_objMutex.Close()
' Aggiorno istanze usate
Dim nTmp As Integer = GetPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
nTmp -= (1 << (IniFile.m_nInstance - 1))
WritePrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
Application.Current.Shutdown()
End Sub)
Application.Msn.Register(Application.ALLOWWINDOWTOCLOSE, Sub(bBoolean As Boolean)
m_allowWindowToClose = bBoolean
Private Sub RegisterMyMessages()
Application.Msn.Register(Application.CLOSEAPPLICATIONCOMMAND, Sub()
Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATION)
' Terminazione generale di EgtInterface
EgtExit()
' Rilascio mutex
If Not IsNothing(m_objMutex) Then m_objMutex.Close()
' Aggiorno istanze usate
Dim nTmp As Integer = GetPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
nTmp -= (1 << (IniFile.m_nInstance - 1))
WritePrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
Application.Current.Shutdown()
End Sub)
Application.Msn.Register(Application.ALLOWWINDOWTOCLOSE, Sub(bBoolean As Boolean)
m_allowWindowToClose = bBoolean
End Sub)
Application.Msn.Register(Application.UPDATEMAINWINDOWTITLE, Sub(sString As String)
Title = sString
End Sub)
Application.Msn.Register(Application.UPDATEMAINWINDOWTITLE, Sub(sString As String)
Title = sString
End Sub)
End Sub
End Sub
''' <summary>
''' Method that initialize EgalTech environment
''' </summary>
Private Sub InitializeEgtEnvironment()
' Title
Application.Msn.NotifyColleagues(Application.EMITTITLE)
' Impostazione path radice per i dati
''' <summary>
''' Method that initialize EgalTech environment
''' </summary>
Private Sub InitializeEgtEnvironment()
' Title
Application.Msn.NotifyColleagues(Application.EMITTITLE)
' Impostazione path radice per i dati
m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory
If EgtUILib.GetPrivateProfileString(S_DATA, K_DATAROOT, "", m_sDataRoot, m_sDataRoot & "\" & DAT_FILE_NAME) = 0 Then
m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory
If EgtUILib.GetPrivateProfileString(S_DATA, K_DATAROOT, "", m_sDataRoot, m_sDataRoot & "\" & DAT_FILE_NAME) = 0 Then
m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory
End If
IniFile.m_sDataRoot = m_sDataRoot
' Impostazione direttorio di configurazione
m_sConfigDir = m_sDataRoot & "\" & CONF_DIR
IniFile.m_sConfigDir = m_sConfigDir
' Impostazione direttorio per file temporanei
IniFile.m_sTempDir = m_sDataRoot & "\" & TEMP_DIR
' Impostazione path Ini file
IniFile.m_sIniFile = m_sConfigDir & "\" & INI_FILE_NAME
EgtWPFLib5.IniFile.m_sIniFile = m_sIniFile
' Impostazione path resources dir
IniFile.m_sResourcesRoot = m_sDataRoot & "\" & RES_DIR
' Impostazione direttorio per le macchine
If GetPrivateProfileString(S_MACH, K_MACHINESDIR, "", m_sMachinesRoot) = 0 Then
m_sMachinesRoot = m_sDataRoot & "\" & MACHINES_DFL_DIR
End If
IniFile.m_sMachinesRoot = m_sMachinesRoot
' Verifico indice di istanza
ManageInstance()
' Imposto tipo di chiave
EgtSetLockType(KEY_TYPE.HW)
' Leggo e imposto chiave di protezione
Dim sLicFileName As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName)
Dim sLicFile As String = m_sConfigDir & "\" & sLicFileName
Dim sKey As String = String.Empty
EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile)
EgtSetKey(sKey)
' Recupero livello e opzioni della chiave
Dim bKey As Boolean = EgtGetKeyLevel(3279, 18, 1, IniFile.m_nKeyLevel) And
EgtGetKeyOptions(3279, 18, 1, IniFile.m_nKeyOptions)
' Inizializzazione generale di EgtInterface
m_nDebug = GetPrivateProfileInt(S_GENERAL, K_DEBUG, 0)
IniFile.m_sLogFile = m_sTempDir & "\" & GENLOG_FILE_NAME.Replace("#", IniFile.m_nInstance.ToString())
Dim sLogMsg As String = "User " & Environment.MachineName & "\" & Environment.UserName & " (" & IniFile.m_nInstance.ToString() & ")" & vbLf &
My.Application.Info.Title.ToString() & " ver. " &
My.Application.Info.Version.Major.ToString() &
"." & My.Application.Info.Version.Minor.ToString() &
(ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() &
My.Application.Info.Version.Revision.ToString()
EgtInit(m_nDebug, IniFile.m_sLogFile, sLogMsg)
' Leggo direttorio dei messaggi (se manca uso direttorio di configurazione)
Dim sMsgDir As String = String.Empty
If GetPrivateProfileString(S_GENERAL, K_MESSAGESDIR, "", sMsgDir) = 0 Then
sMsgDir = m_sConfigDir
End If
' Leggo elenco lingue disponibili da file ini
Dim nIndex As Integer = 1
Dim ReadLanguage As Language = GetPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex)
While Not IsNothing(ReadLanguage)
OptionModule.m_LanguageList.Add(ReadLanguage)
nIndex += 1
ReadLanguage = GetPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex)
End While
' Inizializzo OptionModule
OptionModule.InitOptionModule()
' Leggo file messaggi
Dim sMsgName As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_MESSAGES, "", sMsgName)
Dim sMsgFilePath As String = sMsgDir & "\EgalTechIta.txt"
For Each Language In OptionModule.m_LanguageList
If Language.Name = sMsgName Then
OptionModule.m_SelectedLanguage = Language
sMsgFilePath = sMsgDir & "\" & Language.FilePath
End If
IniFile.m_sDataRoot = m_sDataRoot
' Impostazione direttorio di configurazione
m_sConfigDir = m_sDataRoot & "\" & CONF_DIR
IniFile.m_sConfigDir = m_sConfigDir
' Impostazione direttorio per file temporanei
IniFile.m_sTempDir = m_sDataRoot & "\" & TEMP_DIR
' Impostazione path Ini file
IniFile.m_sIniFile = m_sConfigDir & "\" & INI_FILE_NAME
EgtWPFLib5.IniFile.m_sIniFile = m_sIniFile
' Impostazione path resources dir
IniFile.m_sResourcesRoot = m_sDataRoot & "\" & RES_DIR
' Impostazione direttorio per le macchine
If GetPrivateProfileString(S_MACH, K_MACHINESDIR, "", m_sMachinesRoot) = 0 Then
m_sMachinesRoot = m_sDataRoot & "\" & MACHINES_DFL_DIR
End If
IniFile.m_sMachinesRoot = m_sMachinesRoot
' Verifico indice di istanza
ManageInstance()
' Imposto tipo di chiave
EgtSetLockType(KEY_TYPE.HW)
' Leggo e imposto chiave di protezione
Dim sLicFileName As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName)
Dim sLicFile As String = m_sConfigDir & "\" & sLicFileName
Dim sKey As String = String.Empty
EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile)
EgtSetKey(sKey)
' Recupero livello e opzioni della chiave
Dim bKey As Boolean = EgtGetKeyLevel(3279, 18, 1, IniFile.m_nKeyLevel) And
EgtGetKeyOptions(3279, 18, 1, IniFile.m_nKeyOptions)
' Inizializzazione generale di EgtInterface
m_nDebug = GetPrivateProfileInt(S_GENERAL, K_DEBUG, 0)
IniFile.m_sLogFile = m_sTempDir & "\" & GENLOG_FILE_NAME.Replace("#", IniFile.m_nInstance.ToString())
Dim sLogMsg As String = "User " & Environment.MachineName & "\" & Environment.UserName & " (" & IniFile.m_nInstance.ToString() & ")" & vbLf &
My.Application.Info.Title.ToString() & " ver. " &
My.Application.Info.Version.Major.ToString() &
"." & My.Application.Info.Version.Minor.ToString() &
(ChrW(97 - 1 + My.Application.Info.Version.Build)).ToString() &
My.Application.Info.Version.Revision.ToString()
EgtInit(m_nDebug, IniFile.m_sLogFile, sLogMsg)
' Leggo direttorio dei messaggi (se manca uso direttorio di configurazione)
Dim sMsgDir As String = String.Empty
If GetPrivateProfileString(S_GENERAL, K_MESSAGESDIR, "", sMsgDir) = 0 Then
sMsgDir = m_sConfigDir
End If
' Leggo elenco lingue disponibili da file ini
Dim nIndex As Integer = 1
Dim ReadLanguage As Language = GetPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex)
While Not IsNothing(ReadLanguage)
OptionModule.m_LanguageList.Add(ReadLanguage)
nIndex += 1
ReadLanguage = GetPrivateProfileLanguage(S_LANGUAGES, K_LANGUAGE & nIndex)
End While
' Inizializzo OptionModule
OptionModule.InitOptionModule()
' Leggo file messaggi
Dim sMsgName As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_MESSAGES, "", sMsgName)
Dim sMsgFilePath As String = sMsgDir & "\EgalTechIta.txt"
For Each Language In OptionModule.m_LanguageList
If Language.Name = sMsgName Then
OptionModule.m_SelectedLanguage = Language
sMsgFilePath = sMsgDir & "\" & Language.FilePath
End If
Next
If Not EgtLoadMessages(sMsgFilePath) Then
EgtOutLog("Error in EgtLoadMessages")
End If
' Leggo e imposto livello utilizzatore
m_nUserLevel = Math.Min(m_nKeyLevel, GetPrivateProfileInt(S_GENERAL, K_USERLEVEL, 1))
' imposto dir font Nfe e font default
Dim sNfeDir As String = String.Empty
GetPrivateProfileString(S_GEOMDB, K_NFEFONTDIR, "", sNfeDir)
Dim sDefFont As String = String.Empty
GetPrivateProfileString(S_GEOMDB, K_DEFAULTFONT, "", sDefFont)
EgtSetFont(sNfeDir, sDefFont)
' imposto dir di default per libreria Lua e lancio libreria di base
Dim sLuaLibsDir As String = String.Empty
GetPrivateProfileString(S_LUA, K_LIBSDIR, "", sLuaLibsDir)
EgtSetLuaLibs(sLuaLibsDir)
Dim sLuaBaseLib As String = String.Empty
GetPrivateProfileString(S_LUA, K_BASELIB, "EgtBase", sLuaBaseLib)
EgtLuaRequire(sLuaBaseLib)
' imposto IniFile a EgtInterface
EgtSetIniFile(m_sIniFile)
' verifico se avviare programma in modalità CAD-ONLY
IniFile.m_ProjectMode = If(GetPrivateProfileInt(S_GENERAL, K_ONLYDRAW, 0) = 0, ProjectModeOpt.DRAW, ProjectModeOpt.ONLYDRAW)
' Impostazioni MruLists
m_MruFiles.Init(S_MRUFILES, 8)
m_MruScripts.Init(S_MRUSCRIPTS, 8)
If IniFile.IsActiveDoors() Then
m_MruDoors.Init(S_MRUDOORS, 8)
End If
If IniFile.IsActiveGunStock() Then
m_MruNewGunStock.Init(S_MRUGUNSTOCKMOD, 8)
m_MruModifyGunStock.Init(S_MRUGUNSTOCKPEZ, 8)
End If
' Info su opzioni chiave
EgtOutLog("KeyOptions : " & bKey.ToString() & " " & IniFile.m_nKeyOptions.ToString())
End Sub
Next
If Not EgtLoadMessages(sMsgFilePath) Then
EgtOutLog("Error in EgtLoadMessages")
End If
' Leggo e imposto livello utilizzatore
m_nUserLevel = Math.Min(m_nKeyLevel, GetPrivateProfileInt(S_GENERAL, K_USERLEVEL, 1))
' imposto dir font Nfe e font default
Dim sNfeDir As String = String.Empty
GetPrivateProfileString(S_GEOMDB, K_NFEFONTDIR, "", sNfeDir)
Dim sDefFont As String = String.Empty
GetPrivateProfileString(S_GEOMDB, K_DEFAULTFONT, "", sDefFont)
EgtSetFont(sNfeDir, sDefFont)
' imposto dir di default per libreria Lua e lancio libreria di base
Dim sLuaLibsDir As String = String.Empty
GetPrivateProfileString(S_LUA, K_LIBSDIR, "", sLuaLibsDir)
EgtSetLuaLibs(sLuaLibsDir)
Dim sLuaBaseLib As String = String.Empty
GetPrivateProfileString(S_LUA, K_BASELIB, "EgtBase", sLuaBaseLib)
EgtLuaRequire(sLuaBaseLib)
' imposto IniFile a EgtInterface
EgtSetIniFile(m_sIniFile)
' verifico se avviare programma in modalità CAD-ONLY
IniFile.m_ProjectMode = If(GetPrivateProfileInt(S_GENERAL, K_ONLYDRAW, 0) = 0, ProjectModeOpt.DRAW, ProjectModeOpt.ONLYDRAW)
' Impostazioni MruLists
m_MruFiles.Init(S_MRUFILES, 8)
m_MruScripts.Init(S_MRUSCRIPTS, 8)
If IniFile.IsActiveDoors() Then
m_MruDoors.Init(S_MRUDOORS, 8)
End If
If IniFile.IsActiveGunStock() Then
m_MruNewGunStock.Init(S_MRUGUNSTOCKMOD, 8)
m_MruModifyGunStock.Init(S_MRUGUNSTOCKPEZ, 8)
End If
' Info su opzioni chiave
EgtOutLog("KeyOptions : " & bKey.ToString() & " " & IniFile.m_nKeyOptions.ToString())
End Sub
''' <summary>
''' Funzione che permette di gestire il numero di istanze del programma attive contemporaneamente
''' </summary>
Private Sub ManageInstance()
Dim bCreated As Boolean
Try
m_objMutex = New Mutex(False, "Global\EgtCAM5", bCreated)
Catch
bCreated = False
End Try
If bCreated Then
' Prima istanza
IniFile.m_nInstance = 1
' Aggiorno stato istanze attive
WritePrivateProfileString(S_GENERAL, K_INSTANCES, IniFile.m_nInstance.ToString)
Else
' Leggo il massimo numero di istanze ammesse
Const MAX_INST As Integer = 32
Dim nMaxInst As Integer = GetPrivateProfileInt(S_GENERAL, K_MAXINST, 1)
nMaxInst = Max(1, Min(nMaxInst, MAX_INST))
' Cerco il primo indice di istanza libero (max 32)
Dim nTmp As Integer = GetPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
IniFile.m_nInstance = 1
Dim nMask As Integer = 1
While (nTmp And nMask) <> 0 And IniFile.m_nInstance < MAX_INST
IniFile.m_nInstance += 1
nMask *= 2
End While
' Se l'indice supera il massimo
If IniFile.m_nInstance > nMaxInst Then
' porto in primo piano la prima istanza
Dim bFound As Boolean = False
' processi del programma a 32 bit
Dim localProc As Process() = Process.GetProcessesByName("EgtCAM5R32")
''' <summary>
''' Funzione che permette di gestire il numero di istanze del programma attive contemporaneamente
''' </summary>
Private Sub ManageInstance()
Dim bCreated As Boolean
Try
m_objMutex = New Mutex(False, "Global\EgtCAM5", bCreated)
Catch
bCreated = False
End Try
If bCreated Then
' Prima istanza
IniFile.m_nInstance = 1
' Aggiorno stato istanze attive
WritePrivateProfileString(S_GENERAL, K_INSTANCES, IniFile.m_nInstance.ToString)
Else
' Leggo il massimo numero di istanze ammesse
Const MAX_INST As Integer = 32
Dim nMaxInst As Integer = GetPrivateProfileInt(S_GENERAL, K_MAXINST, 1)
nMaxInst = Max(1, Min(nMaxInst, MAX_INST))
' Cerco il primo indice di istanza libero (max 32)
Dim nTmp As Integer = GetPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
IniFile.m_nInstance = 1
Dim nMask As Integer = 1
While (nTmp And nMask) <> 0 And IniFile.m_nInstance < MAX_INST
IniFile.m_nInstance += 1
nMask *= 2
End While
' Se l'indice supera il massimo
If IniFile.m_nInstance > nMaxInst Then
' porto in primo piano la prima istanza
Dim bFound As Boolean = False
' processi del programma a 32 bit
Dim localProc As Process() = Process.GetProcessesByName("EgtCAM5R32")
For Each p As Process In localProc
If p.Id <> Process.GetCurrentProcess().Id Then
bFound = True
ShowWindow(p.MainWindowHandle, SW.SHOWMAXIMIZED)
Exit For
End If
Next
' se non trovati processi a 32 bit provo a 64 bit
If Not bFound Then
localProc = Process.GetProcessesByName("EgtCAM5R64")
For Each p As Process In localProc
If p.Id <> Process.GetCurrentProcess().Id Then
bFound = True
@@ -438,56 +446,44 @@ Namespace EgtCAM5
Exit For
End If
Next
' se non trovati processi a 32 bit provo a 64 bit
If Not bFound Then
localProc = Process.GetProcessesByName("EgtCAM5R64")
For Each p As Process In localProc
If p.Id <> Process.GetCurrentProcess().Id Then
bFound = True
ShowWindow(p.MainWindowHandle, SW.SHOWMAXIMIZED)
Exit For
End If
Next
End If
' esco dal programma
End
End If
' Aggiorno stato istanze attive
nTmp += (1 << (IniFile.m_nInstance - 1))
WritePrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
' esco dal programma
End
End If
End Sub
' Aggiorno stato istanze attive
nTmp += (1 << (IniFile.m_nInstance - 1))
WritePrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
End If
End Sub
#End Region
#Region "Events"
Private Sub MainWindow_KeyDown(ByVal sender As System.Object, ByVal e As KeyEventArgs)
' Con ESC esco dall'azione corrente
If e.Key = Key.Escape Then
' reset Azione corrente
Application.Msn.NotifyColleagues(Application.RESETSTATUS)
' reset Analisi e Distanza
Application.Msn.NotifyColleagues(Application.ANALYZE_ISCHECKED, False)
Application.Msn.NotifyColleagues(Application.GETDISTANCE_ISCHECKED, False)
' pulisco output
Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, "")
Application.Msn.NotifyColleagues(Application.RESETINPUTBOX)
End If
End Sub
Private Sub MainWindow_KeyDown(ByVal sender As System.Object, ByVal e As KeyEventArgs)
' Con ESC esco dall'azione corrente
If e.Key = Key.Escape Then
' reset Azione corrente
Application.Msn.NotifyColleagues(Application.RESETSTATUS)
' reset Analisi e Distanza
Application.Msn.NotifyColleagues(Application.ANALYZE_ISCHECKED, False)
Application.Msn.NotifyColleagues(Application.GETDISTANCE_ISCHECKED, False)
' pulisco output
Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, "")
Application.Msn.NotifyColleagues(Application.RESETINPUTBOX)
End If
End Sub
#End Region
#Region "Verify closing"
''' <summary>
''' Should we let our window close?
''' </summary>
Private m_allowWindowToClose As Boolean = False
''' <summary>
''' Should we let our window close?
''' </summary>
Private m_allowWindowToClose As Boolean = False
#End Region
End Class
End Namespace
End Class
@@ -1,7 +1,6 @@
<UserControl x:Class="InfoExpanderView"
<UserControl x:Class="InfoExpanderV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:EgtCAM5.EgtCAM5">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Expander IsExpanded="{Binding IsEnabled}" IsEnabled="{Binding IsEnabled}"
Style="{StaticResource ExpanderStyle}">
@@ -0,0 +1,3 @@
Public Class InfoExpanderV
End Class
@@ -0,0 +1,82 @@
Imports EgtUILib
Public Class InfoExpanderVM
Inherits ViewModelBase
#Region "Messages"
Public ReadOnly Property PropertiesMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 1)
End Get
End Property
#End Region
Private m_IsExpanded As Boolean
Public Property IsEnabled As Boolean
Get
Return m_IsExpanded
End Get
Set(value As Boolean)
If value <> m_IsExpanded Then
m_IsExpanded = value
OnPropertyChanged("IsEnabled")
End If
End Set
End Property
Private m_InfoBox As String
Public Property InfoBox As String
Get
Return m_InfoBox
End Get
Set(value As String)
If value <> m_InfoBox Then
m_InfoBox = value
If value <> String.Empty Then
IsEnabled = True
Else
IsEnabled = False
End If
OnPropertyChanged("InfoBox")
End If
End Set
End Property
Sub New()
Application.Msn.Register(Application.UPDATEOBJDATAINOBJTREE, Sub(Id As Integer)
UpdateObjDataInObjTree(Id)
End Sub)
Application.Msn.Register(Application.SETINFOBOX, Sub(sString As String)
InfoBox = sString
End Sub)
End Sub
Private Sub UpdateObjDataInObjTree(ByVal nId As Integer)
' recupero il tipo del nuovo oggetto
Dim nType As Integer = EgtGetType(nId)
' stampa dei dati dell'oggetto
Dim sDump As String = String.Empty
If nType = GDB_TY.NONE Then
InfoBox = String.Empty
ElseIf nType = GDB_TY.GROUP Then
If EgtGroupDump(nId, sDump) Then
InfoBox = sDump
IsEnabled = True
Else
InfoBox = String.Empty
IsEnabled = False
End If
Else
If EgtGeoObjDump(nId, sDump) Then
InfoBox = sDump
IsEnabled = True
Else
InfoBox = String.Empty
IsEnabled = False
End If
End If
End Sub
End Class
@@ -1,3 +0,0 @@
Public Class InfoExpanderView
End Class
@@ -1,86 +0,0 @@
Imports EgtUILib
Namespace EgtCAM5
Public Class InfoExpanderViewModel
Inherits ViewModelBase
#Region "Messages"
Public ReadOnly Property PropertiesMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 1)
End Get
End Property
#End Region
Private m_IsExpanded As Boolean
Public Property IsEnabled As Boolean
Get
Return m_IsExpanded
End Get
Set(value As Boolean)
If value <> m_IsExpanded Then
m_IsExpanded = value
OnPropertyChanged("IsEnabled")
End If
End Set
End Property
Private m_InfoBox As String
Public Property InfoBox As String
Get
Return m_InfoBox
End Get
Set(value As String)
If value <> m_InfoBox Then
m_InfoBox = value
If value <> String.Empty Then
IsEnabled = True
Else
IsEnabled = False
End If
OnPropertyChanged("InfoBox")
End If
End Set
End Property
Sub New()
Application.Msn.Register(Application.UPDATEOBJDATAINOBJTREE, Sub(Id As Integer)
UpdateObjDataInObjTree(Id)
End Sub)
Application.Msn.Register(Application.SETINFOBOX, Sub(sString As String)
InfoBox = sString
End Sub)
End Sub
Private Sub UpdateObjDataInObjTree(ByVal nId As Integer)
' recupero il tipo del nuovo oggetto
Dim nType As Integer = EgtGetType(nId)
' stampa dei dati dell'oggetto
Dim sDump As String = String.Empty
If nType = GDB_TY.NONE Then
InfoBox = String.Empty
ElseIf nType = GDB_TY.GROUP Then
If EgtGroupDump(nId, sDump) Then
InfoBox = sDump
IsEnabled = True
Else
InfoBox = String.Empty
IsEnabled = False
End If
Else
If EgtGeoObjDump(nId, sDump) Then
InfoBox = sDump
IsEnabled = True
Else
InfoBox = String.Empty
IsEnabled = False
End If
End If
End Sub
End Class
End Namespace
@@ -1,4 +1,4 @@
<UserControl x:Class="InputExpanderView"
<UserControl x:Class="InputExpanderV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
@@ -0,0 +1,3 @@
Public Class InputExpanderV
End Class
@@ -0,0 +1,339 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Public Class InputExpanderVM
Inherits ViewModelBase
#Region "FIELDS & PROPERTIES"
' Expander fields
Private m_IsExpanded As Boolean
Public Property IsExpanded As Boolean
Get
Return m_IsExpanded
End Get
Set(value As Boolean)
m_IsExpanded = value
OnPropertyChanged("IsExpanded")
End Set
End Property
Private m_IsEnabled As Boolean
Public Property IsEnabled As Boolean
Get
Return m_IsEnabled
End Get
Set(value As Boolean)
m_IsEnabled = value
OnPropertyChanged("IsEnabled")
End Set
End Property
Private m_Title As String
Public Property Title As String
Get
Return m_Title
End Get
Set(value As String)
m_Title = value
OnPropertyChanged("Title")
End Set
End Property
' TextBlock fields
Private m_TextBlock As String
Public Property TextBlock As String
Get
Return m_TextBlock
End Get
Set(value As String)
m_TextBlock = value
OnPropertyChanged("TextBlock")
End Set
End Property
' TextBox fields
Private m_TextBox As String
Public Property TextBox As String
Get
Return m_TextBox
End Get
Set(value As String)
m_TextBox = value
Application.Msn.NotifyColleagues(Application.NOTIFYINPUTTEXT, value)
OnPropertyChanged("TextBox")
End Set
End Property
Private m_FocusTextBox As Boolean
Public Property FocusTextBox As Boolean
Get
Return m_FocusTextBox
End Get
Set(value As Boolean)
m_FocusTextBox = value
OnPropertyChanged("FocusTextBox")
End Set
End Property
'CheckBox fields
Private m_CheckBoxText As String
Public Property CheckBoxText As String
Get
Return m_CheckBoxText
End Get
Set(value As String)
m_CheckBoxText = value
OnPropertyChanged("CheckBoxText")
End Set
End Property
Private m_IsChecked As Boolean
Public Property IsChecked As Boolean
Get
Return m_IsChecked
End Get
Set(value As Boolean)
If value <> m_IsChecked Then
Application.Msn.NotifyColleagues(Application.SETLASTBOOLEAN, value)
m_IsChecked = value
OnPropertyChanged("IsChecked")
End If
End Set
End Property
Private m_CheckVisibility As Visibility
Public Property CheckVisibility As Visibility
Get
Return m_CheckVisibility
End Get
Set(value As Visibility)
If value <> m_CheckVisibility Then
m_CheckVisibility = value
OnPropertyChanged("CheckVisibility")
End If
End Set
End Property
' ComboBox fields
Private m_ComboItemsList As New ObservableCollection(Of String)
Public Property ComboItemsList As ObservableCollection(Of String)
Get
Return m_ComboItemsList
End Get
Set(value As ObservableCollection(Of String))
m_ComboItemsList = value
OnPropertyChanged("ComboItemsList")
End Set
End Property
Private m_ComboSelectedIndex As Integer
Public Property ComboSelectedIndex As Integer
Get
Return m_ComboSelectedIndex
End Get
Set(value As Integer)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, value)
m_ComboSelectedIndex = value
OnPropertyChanged("ComboSelectedIndex")
End Set
End Property
Private m_ComboVisibility As Visibility
Public Property ComboVisibility As Visibility
Get
Return m_ComboVisibility
End Get
Set(value As Visibility)
If value <> m_ComboVisibility Then
m_ComboVisibility = value
OnPropertyChanged("ComboVisibility")
End If
End Set
End Property
' Buttons fields
Private m_ShowBtnVisibility As Visibility
Public Property ShowBtnVisibility As Visibility
Get
Return m_ShowBtnVisibility
End Get
Set(value As Visibility)
m_ShowBtnVisibility = value
OnPropertyChanged("ShowBtnVisibility")
End Set
End Property
' Commands definition
Private m_cmdShow As ICommand
Private m_cmdDone As ICommand
#Region "Messages"
Public ReadOnly Property ShowMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 14)
End Get
End Property
Public ReadOnly Property OkMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 15)
End Get
End Property
#End Region
#End Region ' Fields & Properties
#Region "CONSTRUCTOR"
Sub New()
RegisterMethodsCall()
End Sub
#End Region ' Constructor
#Region "COMMANDS"
#Region "ShowCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property ShowCommand As ICommand
Get
If m_cmdShow Is Nothing Then
m_cmdShow = New RelayCommand(AddressOf Show, AddressOf CanShow)
End If
Return m_cmdShow
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Show(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SHOW, TextBox)
End Sub
''' <summary>
''' Returns always true.
''' </summary>
Private Function CanShow(ByVal param As Object) As Boolean
Return If(m_ShowBtnVisibility = Visibility.Visible, True, False)
End Function
#End Region ' ShowCommand
#Region "DoneCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property DoneCommand As ICommand
Get
If m_cmdDone Is Nothing Then
m_cmdDone = New RelayCommand(AddressOf Done, AddressOf CanDone)
End If
Return m_cmdDone
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Done(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.DONE, m_TextBox)
End Sub
''' <summary>
''' Returns always true.
''' </summary>
Private Function CanDone(ByVal param As Object) As Boolean
Return True
End Function
#End Region ' DoneCommand
#End Region
#Region "METHODS"
Sub RegisterMethodsCall()
Application.Msn.Register(Application.PREPAREINPUTBOX, Sub(PrepareInputBoxParam As PrepareInputBoxParam)
PrepareInputBox(PrepareInputBoxParam)
End Sub)
Application.Msn.Register(Application.SETINPUTBOXTEXT, Sub(sString As String)
SetInputBoxText(sString)
End Sub)
Application.Msn.Register(Application.SETINPUTBOXCHECK, Sub(bBoolean As Boolean)
SetInputBoxCheck(bBoolean)
End Sub)
Application.Msn.Register(Application.CHANGEINPUTBOXCHECK, Sub()
ChangeInputBoxCheck()
End Sub)
Application.Msn.Register(Application.ADDINPUTBOXCOMBO, Sub(AddInputBoxComboParam As AddInputBoxComboParam)
AddInputBoxCombo(AddInputBoxComboParam.sText, AddInputBoxComboParam.bSelected)
End Sub)
Application.Msn.Register(Application.RESETINPUTBOX, Sub()
ResetInputBox()
End Sub)
End Sub
Private Sub PrepareInputBox(PrepareInputBoxParam As PrepareInputBoxParam)
Title = PrepareInputBoxParam.sTitle
TextBlock = PrepareInputBoxParam.sLabel
TextBox = ""
If PrepareInputBoxParam.sCheckLabel <> "" Then
CheckBoxText = PrepareInputBoxParam.sCheckLabel
CheckVisibility = Visibility.Visible
End If
If PrepareInputBoxParam.bShowCombo Then
ComboItemsList.Clear()
ComboVisibility = Visibility.Visible
End If
If PrepareInputBoxParam.bShowBtn Then
ShowBtnVisibility = Visibility.Visible
End If
IsEnabled = True
IsExpanded = True
FocusTextBox = True
End Sub
Private Sub ResetInputBox()
Title = EgtMsg(MSG_DRAWOPTION + 5)
CheckVisibility = Visibility.Collapsed
ComboVisibility = Visibility.Collapsed
ShowBtnVisibility = Visibility.Collapsed
IsExpanded = False
IsEnabled = False
End Sub
Private Function SetInputBoxText(ByVal sVal As String) As Boolean
TextBox = sVal
FocusTextBox = True
Return True
End Function
Private Function ChangeInputBoxCheck() As Boolean
IsChecked = Not m_IsChecked
Return True
End Function
Private Function SetInputBoxCheck(ByVal bCheck As Boolean) As Boolean
IsChecked = bCheck
Application.Msn.NotifyColleagues(Application.SETLASTBOOLEAN, IsChecked)
Return True
End Function
Private Function AddInputBoxCombo(ByVal sText As String, ByVal bSelected As Boolean) As Boolean
ComboItemsList.Add(sText)
If bSelected Then
ComboSelectedIndex = ComboItemsList.Count - 1
End If
Return True
End Function
#End Region ' Methods
End Class
@@ -1,3 +0,0 @@
Public Class InputExpanderView
End Class
@@ -1,343 +0,0 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Namespace EgtCAM5
Public Class InputExpanderViewModel
Inherits ViewModelBase
#Region "FIELDS & PROPERTIES"
' Expander fields
Private m_IsExpanded As Boolean
Public Property IsExpanded As Boolean
Get
Return m_IsExpanded
End Get
Set(value As Boolean)
m_IsExpanded = value
OnPropertyChanged("IsExpanded")
End Set
End Property
Private m_IsEnabled As Boolean
Public Property IsEnabled As Boolean
Get
Return m_IsEnabled
End Get
Set(value As Boolean)
m_IsEnabled = value
OnPropertyChanged("IsEnabled")
End Set
End Property
Private m_Title As String
Public Property Title As String
Get
Return m_Title
End Get
Set(value As String)
m_Title = value
OnPropertyChanged("Title")
End Set
End Property
' TextBlock fields
Private m_TextBlock As String
Public Property TextBlock As String
Get
Return m_TextBlock
End Get
Set(value As String)
m_TextBlock = value
OnPropertyChanged("TextBlock")
End Set
End Property
' TextBox fields
Private m_TextBox As String
Public Property TextBox As String
Get
Return m_TextBox
End Get
Set(value As String)
m_TextBox = value
Application.Msn.NotifyColleagues(Application.NOTIFYINPUTTEXT, value)
OnPropertyChanged("TextBox")
End Set
End Property
Private m_FocusTextBox As Boolean
Public Property FocusTextBox As Boolean
Get
Return m_FocusTextBox
End Get
Set(value As Boolean)
m_FocusTextBox = value
OnPropertyChanged("FocusTextBox")
End Set
End Property
'CheckBox fields
Private m_CheckBoxText As String
Public Property CheckBoxText As String
Get
Return m_CheckBoxText
End Get
Set(value As String)
m_CheckBoxText = value
OnPropertyChanged("CheckBoxText")
End Set
End Property
Private m_IsChecked As Boolean
Public Property IsChecked As Boolean
Get
Return m_IsChecked
End Get
Set(value As Boolean)
If value <> m_IsChecked Then
Application.Msn.NotifyColleagues(Application.SETLASTBOOLEAN, value)
m_IsChecked = value
OnPropertyChanged("IsChecked")
End If
End Set
End Property
Private m_CheckVisibility As Visibility
Public Property CheckVisibility As Visibility
Get
Return m_CheckVisibility
End Get
Set(value As Visibility)
If value <> m_CheckVisibility Then
m_CheckVisibility = value
OnPropertyChanged("CheckVisibility")
End If
End Set
End Property
' ComboBox fields
Private m_ComboItemsList As New ObservableCollection(Of String)
Public Property ComboItemsList As ObservableCollection(Of String)
Get
Return m_ComboItemsList
End Get
Set(value As ObservableCollection(Of String))
m_ComboItemsList = value
OnPropertyChanged("ComboItemsList")
End Set
End Property
Private m_ComboSelectedIndex As Integer
Public Property ComboSelectedIndex As Integer
Get
Return m_ComboSelectedIndex
End Get
Set(value As Integer)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, value)
m_ComboSelectedIndex = value
OnPropertyChanged("ComboSelectedIndex")
End Set
End Property
Private m_ComboVisibility As Visibility
Public Property ComboVisibility As Visibility
Get
Return m_ComboVisibility
End Get
Set(value As Visibility)
If value <> m_ComboVisibility Then
m_ComboVisibility = value
OnPropertyChanged("ComboVisibility")
End If
End Set
End Property
' Buttons fields
Private m_ShowBtnVisibility As Visibility
Public Property ShowBtnVisibility As Visibility
Get
Return m_ShowBtnVisibility
End Get
Set(value As Visibility)
m_ShowBtnVisibility = value
OnPropertyChanged("ShowBtnVisibility")
End Set
End Property
' Commands definition
Private m_cmdShow As ICommand
Private m_cmdDone As ICommand
#Region "Messages"
Public ReadOnly Property ShowMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 14)
End Get
End Property
Public ReadOnly Property OkMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 15)
End Get
End Property
#End Region
#End Region ' Fields & Properties
#Region "CONSTRUCTOR"
Sub New()
RegisterMethodsCall()
End Sub
#End Region ' Constructor
#Region "COMMANDS"
#Region "ShowCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property ShowCommand As ICommand
Get
If m_cmdShow Is Nothing Then
m_cmdShow = New RelayCommand(AddressOf Show, AddressOf CanShow)
End If
Return m_cmdShow
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Show(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SHOW, TextBox)
End Sub
''' <summary>
''' Returns always true.
''' </summary>
Private Function CanShow(ByVal param As Object) As Boolean
Return If(m_ShowBtnVisibility = Visibility.Visible, True, False)
End Function
#End Region ' ShowCommand
#Region "DoneCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property DoneCommand As ICommand
Get
If m_cmdDone Is Nothing Then
m_cmdDone = New RelayCommand(AddressOf Done, AddressOf CanDone)
End If
Return m_cmdDone
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Done(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.DONE, m_TextBox)
End Sub
''' <summary>
''' Returns always true.
''' </summary>
Private Function CanDone(ByVal param As Object) As Boolean
Return True
End Function
#End Region ' DoneCommand
#End Region
#Region "METHODS"
Sub RegisterMethodsCall()
Application.Msn.Register(Application.PREPAREINPUTBOX, Sub(PrepareInputBoxParam As PrepareInputBoxParam)
PrepareInputBox(PrepareInputBoxParam)
End Sub)
Application.Msn.Register(Application.SETINPUTBOXTEXT, Sub(sString As String)
SetInputBoxText(sString)
End Sub)
Application.Msn.Register(Application.SETINPUTBOXCHECK, Sub(bBoolean As Boolean)
SetInputBoxCheck(bBoolean)
End Sub)
Application.Msn.Register(Application.CHANGEINPUTBOXCHECK, Sub()
ChangeInputBoxCheck()
End Sub)
Application.Msn.Register(Application.ADDINPUTBOXCOMBO, Sub(AddInputBoxComboParam As AddInputBoxComboParam)
AddInputBoxCombo(AddInputBoxComboParam.sText, AddInputBoxComboParam.bSelected)
End Sub)
Application.Msn.Register(Application.RESETINPUTBOX, Sub()
ResetInputBox()
End Sub)
End Sub
Private Sub PrepareInputBox(PrepareInputBoxParam As PrepareInputBoxParam)
Title = PrepareInputBoxParam.sTitle
TextBlock = PrepareInputBoxParam.sLabel
TextBox = ""
If PrepareInputBoxParam.sCheckLabel <> "" Then
CheckBoxText = PrepareInputBoxParam.sCheckLabel
CheckVisibility = Visibility.Visible
End If
If PrepareInputBoxParam.bShowCombo Then
ComboItemsList.Clear()
ComboVisibility = Visibility.Visible
End If
If PrepareInputBoxParam.bShowBtn Then
ShowBtnVisibility = Visibility.Visible
End If
IsEnabled = True
IsExpanded = True
FocusTextBox = True
End Sub
Private Sub ResetInputBox()
Title = EgtMsg(MSG_DRAWOPTION + 5)
CheckVisibility = Visibility.Collapsed
ComboVisibility = Visibility.Collapsed
ShowBtnVisibility = Visibility.Collapsed
IsExpanded = False
IsEnabled = False
End Sub
Private Function SetInputBoxText(ByVal sVal As String) As Boolean
TextBox = sVal
FocusTextBox = True
Return True
End Function
Private Function ChangeInputBoxCheck() As Boolean
IsChecked = Not m_IsChecked
Return True
End Function
Private Function SetInputBoxCheck(ByVal bCheck As Boolean) As Boolean
IsChecked = bCheck
Application.Msn.NotifyColleagues(Application.SETLASTBOOLEAN, IsChecked)
Return True
End Function
Private Function AddInputBoxCombo(ByVal sText As String, ByVal bSelected As Boolean) As Boolean
ComboItemsList.Add(sText)
If bSelected Then
ComboSelectedIndex = ComboItemsList.Count - 1
End If
Return True
End Function
#End Region ' Methods
End Class
End Namespace
@@ -1,4 +1,4 @@
<UserControl x:Class="ManageLayerExpanderView"
<UserControl x:Class="ManageLayerExpanderV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
@@ -0,0 +1,3 @@
Public Class ManageLayerExpanderV
End Class
@@ -0,0 +1,853 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Imports EgtCAM5.IniFile
Public Class ManageLayerExpanderVM
Inherits ViewModelBase
#Region "FIELDS & PROPERTIES"
' Expander Header Properties
Private m_HeaderName As String
Public Property HeaderName As String
Get
Return m_HeaderName
End Get
Set(value As String)
m_HeaderName = value
OnPropertyChanged("HeaderName")
End Set
End Property
Private m_HeaderColor As SolidColorBrush
Public Property HeaderColor As SolidColorBrush
Get
Return m_HeaderColor
End Get
Set(value As SolidColorBrush)
m_HeaderColor = value
OnPropertyChanged("HeaderColor")
End Set
End Property
' Definizione comandi
Private m_cmdNewPart As ICommand
Private m_cmdNewLayer As ICommand
Private m_cmdLayerColor As ICommand
Private m_cmdTreeViewDoubleClick As ICommand
Private m_cmdTreeViewMouseUp As ICommand
Private m_cmdTreeViewMouseRightButton As ICommand
Private m_cmdSelect As ICommand
Private m_cmdDeselect As ICommand
Private m_cmdName As ICommand
Private m_cmdInfo As ICommand
Private m_cmdRelocate As ICommand
Private m_cmdCopy As ICommand
Private m_cmdDelete As ICommand
Private m_cmdSave As ICommand
' Lista dei layer
Private m_LayerList As New ObservableCollection(Of LayerTreeViewItem)
Public Property LayerList As ObservableCollection(Of LayerTreeViewItem)
Get
Return m_LayerList
End Get
Set(value As ObservableCollection(Of LayerTreeViewItem))
m_LayerList = value
End Set
End Property
Private m_IsRightClickedTreeItem As Boolean
Public ReadOnly Property IsRightClickedTreeItem As Integer
Get
Return m_RightClickedTreeItemId
End Get
End Property
Private m_RightClickedTreeItemId As Integer
Public ReadOnly Property RightClickedTreeItemId As Integer
Get
Return m_RightClickedTreeItemId
End Get
End Property
#Region "Messages"
Public ReadOnly Property NewPartMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 2)
End Get
End Property
Public ReadOnly Property NewLayerMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 3)
End Get
End Property
Public ReadOnly Property ColorMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 4)
End Get
End Property
Public ReadOnly Property SelectMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 6)
End Get
End Property
Public ReadOnly Property DeselectMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 7)
End Get
End Property
Public ReadOnly Property NameMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 8)
End Get
End Property
Public ReadOnly Property InfoMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 9)
End Get
End Property
Public ReadOnly Property RelocateMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 10)
End Get
End Property
Public ReadOnly Property CopyMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 11)
End Get
End Property
Public ReadOnly Property DeleteMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 12)
End Get
End Property
Public ReadOnly Property SaveMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 13)
End Get
End Property
#End Region
#End Region
#Region "CONSTRUCTOR"
Sub New()
'Imposto tempo di evidenziazione delle entità clickate
ObjTreeTimer.Interval = TimeSpan.FromMilliseconds(1000)
Application.Msn.Register(Application.LOADOBJTREE, Sub()
LoadObjTree()
End Sub)
Application.Msn.Register(Application.UPDATEOBJINOBJTREE, Sub(nId As Integer)
UpdateObjInObjTree(nId)
End Sub)
Application.Msn.Register(Application.UPDATEOBJINOBJTREENOMARK, Sub(nId As Integer)
UpdateObjInObjTreeNoMark(nId)
End Sub)
Application.Msn.Register(Application.SELECTIDINOBJTREE, Sub(nId As Integer)
SelectIdInObjTree(nId, True)
End Sub)
Application.Msn.Register(Application.SELECTIDINOBJTREENOMARK, Sub(nId As Integer)
SelectIdInObjTree(nId, False)
End Sub)
Application.Msn.Register(Application.CLEAROBJTREE, Sub()
ClearObjTree()
End Sub)
Application.Msn.Register(Application.UPDATEOBJTREE, Sub()
UpdateObjTree()
End Sub)
Application.Msn.Register(Application.UPDATEHEADERNAME, Sub(HeaderName As String)
Me.HeaderName = HeaderName
End Sub)
Application.Msn.Register(Application.UPDATEHEADERCOLOR, Sub(HeaderColor As Color3d)
Me.HeaderColor = New SolidColorBrush(Color.FromArgb(CByte(HeaderColor.A * 255 / 100), CByte(HeaderColor.R), CByte(HeaderColor.G), CByte(HeaderColor.B)))
End Sub)
Application.Msn.Register(Application.UPDATEOBJTREEOLDID, Sub(ObjTreeOldId As Integer)
Me.m_nObjTreeOldId = ObjTreeOldId
End Sub)
Application.Msn.Register(Application.RIGHTCLICKEDLAYERTREEITEM, Sub(Id As Integer)
EgtResetMark(m_RightClickedTreeItemId)
m_RightClickedTreeItemId = Id
End Sub)
Application.Msn.Register(Application.ISRIGHTCLICKEDLAYERTREEITEM, Sub(Value As Boolean)
m_IsRightClickedTreeItem = Value
End Sub)
End Sub
#End Region ' Constructor
#Region "COMMANDS"
#Region "NewPartCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property NewPartCommand As ICommand
Get
If m_cmdNewPart Is Nothing Then
m_cmdNewPart = New RelayCommand(AddressOf NewPart)
End If
Return m_cmdNewPart
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub NewPart(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.NEWPART)
' Seleziono nell'albero il layer del pezzo appena creato
SelectIdInObjTree(EgtGetCurrLayer(), False)
End Sub
#End Region ' NewPartCommand
#Region "NewLayerCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property NewLayerCommand As ICommand
Get
If m_cmdNewLayer Is Nothing Then
m_cmdNewLayer = New RelayCommand(AddressOf NewLayer)
End If
Return m_cmdNewLayer
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub NewLayer(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.NEWLAYER)
' Seleziono nell'albero il layer appena creato
SelectIdInObjTree(EgtGetCurrLayer(), False)
End Sub
#End Region ' NewLayerCommand
#Region "LayerColorCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property LayerColorCommand As ICommand
Get
If m_cmdLayerColor Is Nothing Then
m_cmdLayerColor = New RelayCommand(AddressOf LayerColor)
End If
Return m_cmdLayerColor
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub LayerColor(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.LAYERCOLOR)
Application.Msn.NotifyColleagues(Application.LOADOBJTREE)
End Sub
#End Region ' LayerColorCommand
#Region "TreeViewDoubleClickCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property TreeViewDoubleClickCommand As ICommand
Get
If m_cmdTreeViewDoubleClick Is Nothing Then
m_cmdTreeViewDoubleClick = New RelayCommand(AddressOf TreeViewDoubleClick)
End If
Return m_cmdTreeViewDoubleClick
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub TreeViewDoubleClick(ByVal param As Object)
If m_nObjTreeOldId <> GDB_ID.NULL Then
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, m_nObjTreeOldId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SETCURRPARTLAYER)
End If
End Sub
#End Region ' TreeViewDoubleClickCommand
#Region "TreeViewMouseRightButtonCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property TreeViewMouseRightButtonCommand As ICommand
Get
If m_cmdTreeViewMouseRightButton Is Nothing Then
m_cmdTreeViewMouseRightButton = New RelayCommand(AddressOf TreeViewMouseRightButton)
End If
Return m_cmdTreeViewMouseRightButton
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub TreeViewMouseRightButton(ByVal param As Object)
If m_nObjTreeOldId <> GDB_ID.NULL Then
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, m_nObjTreeOldId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SETCURRPARTLAYER)
End If
End Sub
#End Region ' TreeViewMouseRightButtonCommand
#Region "TreeViewMouseUpCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property TreeViewMouseUpCommand As ICommand
Get
If m_cmdTreeViewMouseUp Is Nothing Then
m_cmdTreeViewMouseUp = New RelayCommand(AddressOf TreeViewMouseUp)
End If
Return m_cmdTreeViewMouseUp
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub TreeViewMouseUp(ByVal param As Object)
' determino Id di eventuale item sotto il mouse
Dim nId As Integer = GDB_ID.NULL
If m_IsRightClickedTreeItem Then
nId = m_RightClickedTreeItemId
Else
nId = m_nObjTreeOldId
End If
' se Id coincide con il corrente
If nId <> GDB_ID.NULL Then 'And nId = m_nObjTreeOldId Then
' evidenzio
EgtSetMark(nId)
EgtDraw()
' lancio timer per successiva de-evidenziazione
ObjTreeTimer.Stop()
ObjTreeTimer.Start()
End If
' se rilascio tasto destro
'If e.Button = Windows.Forms.MouseButtons.Right Then
' ' Id pezzo sotto il mouse
' m_nObjTreeMenuId = nId
' ' verifico stato visualizzazione per abilitare voci menù
' Dim nStat As GDB_ST = GDB_ST.ON_
' Dim bOn As Boolean = EgtGetCalcStatus(m_nObjTreeMenuId, nStat) And nStat <> GDB_ST.OFF
' For Each Item As ToolStripItem In ContextMenuTreeView1.Items
' If Item.Name = "cmdSetName" Or Item.Name = "cmdSetInfo" Then
' Item.Enabled = True
' Else
' Item.Enabled = bOn
' End If
' Next
' 'ContextMenuTreeView1.Show(TreeView1, e.Location)
'End If
End Sub
#End Region ' TreeViewMouseUpCommand
#Region "SelectCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property SelectCommand As ICommand
Get
If m_cmdSelect Is Nothing Then
m_cmdSelect = New RelayCommand(AddressOf SelectCmd)
End If
Return m_cmdSelect
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub SelectCmd(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SELECTPARTLAYEROBJ)
End Sub
#End Region ' SelectCommand
#Region "DeselectCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property DeselectCommand As ICommand
Get
If m_cmdDeselect Is Nothing Then
m_cmdDeselect = New RelayCommand(AddressOf Deselect)
End If
Return m_cmdDeselect
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Deselect(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.DESELECTPARTLAYEROBJ)
End Sub
#End Region ' DeselectCommand
#Region "NameCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property NameCommand As ICommand
Get
If m_cmdName Is Nothing Then
m_cmdName = New RelayCommand(AddressOf Name)
End If
Return m_cmdName
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Name(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SETNAME)
End Sub
#End Region ' NameCommand
#Region "InfoCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property InfoCommand As ICommand
Get
If m_cmdInfo Is Nothing Then
m_cmdInfo = New RelayCommand(AddressOf Info)
End If
Return m_cmdInfo
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Info(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SETINFO)
End Sub
#End Region ' InfoCommand
#Region "RelocateCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property RelocateCommand As ICommand
Get
If m_cmdRelocate Is Nothing Then
m_cmdRelocate = New RelayCommand(AddressOf Relocate)
End If
Return m_cmdRelocate
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Relocate(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.RELOCATEPARTLAYEROBJ)
End Sub
#End Region ' RelocateCommand
#Region "CopyCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property CopyCommand As ICommand
Get
If m_cmdCopy Is Nothing Then
m_cmdCopy = New RelayCommand(AddressOf Copy)
End If
Return m_cmdCopy
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Copy(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.COPYPARTLAYEROBJ)
End Sub
#End Region ' CopyCommand
#Region "DeleteCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property DeleteCommand As ICommand
Get
If m_cmdDelete Is Nothing Then
m_cmdDelete = New RelayCommand(AddressOf Delete)
End If
Return m_cmdDelete
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Delete(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.DELETE)
End Sub
#End Region ' DeleteCommand
#Region "SaveCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property SaveCommand As ICommand
Get
If m_cmdSave Is Nothing Then
m_cmdSave = New RelayCommand(AddressOf Save)
End If
Return m_cmdSave
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Save(ByVal param As Object)
Dim sDir As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_LASTNGEOBJDIR, "", sDir)
Dim nType As NGE = DirectCast(GetPrivateProfileInt(S_GEOMDB, K_SAVETYPE, NGE.CMPTEXT), NGE)
Application.Msn.NotifyColleagues(Application.SAVEOBJECT, New SaveObjectParam(m_RightClickedTreeItemId, sDir, nType))
End Sub
#End Region ' SaveCommand
#End Region ' Commands
#Region "METHODS"
Private WithEvents ObjTreeTimer As New System.Windows.Threading.DispatcherTimer
Private m_nObjTreeOldId As Integer = GDB_ID.NULL
Private m_nObjTreeMenuId As Integer = GDB_ID.NULL
Private m_bEnableUpdateObjInObjTree As Boolean = True
Private Sub ObjTreeTickEvent(source As Object, e As EventArgs) Handles ObjTreeTimer.Tick
Dim nId As Integer = GDB_ID.NULL
If m_IsRightClickedTreeItem Then
nId = m_RightClickedTreeItemId
Else
nId = m_nObjTreeOldId
End If
If nId <> GDB_ID.NULL Then
EgtResetMark(nId)
EgtDraw()
End If
ObjTreeTimer.Stop()
End Sub
Public Sub LoadObjTree()
LayerTreeViewItem.m_SendCmd = False
Dim nOldId As Integer = ClearObjTree()
AddGroupInObjTree(GDB_ID.ROOT, GDB_LV.USER, 0, LayerList)
If nOldId <> GDB_ID.NULL Then
m_bEnableUpdateObjInObjTree = False
SelectIdInObjTree(nOldId, True)
m_bEnableUpdateObjInObjTree = True
Else
Application.Msn.NotifyColleagues(Application.SETINFOBOX, String.Empty)
End If
LayerTreeViewItem.m_SendCmd = True
End Sub
Private Function ClearObjTree() As Integer
Dim nOldId As Integer = RevertOldIdInObjTree()
LayerList.Clear()
Return nOldId
End Function
Private Sub AddGroupInObjTree(ByVal nGroupId As Integer, ByVal nLevel As Integer, ByVal nDepth As Integer, ByRef PrevNodColl As ObservableCollection(Of LayerTreeViewItem))
Dim CurrNodColl As ObservableCollection(Of LayerTreeViewItem)
If nGroupId = GDB_ID.ROOT Then
CurrNodColl = PrevNodColl
Else
' livello
Dim nObjLev As Integer = GDB_LV.USER
EgtGetLevel(nGroupId, nObjLev)
If nObjLev = GDB_LV.TEMP Then
nLevel = GDB_LV.TEMP
ElseIf nLevel = GDB_LV.USER Then
nLevel = nObjLev
End If
' tipo
Dim nGroupType As Integer = 0 ' 0=gruppo generico, 1=pezzo, 2=layer
If nLevel = GDB_LV.USER Then
nGroupType = nDepth
End If
' nome
Dim sName As String = String.Empty
Dim sText As String = String.Empty
If EgtGetName(nGroupId, sName) Then
If nGroupType = 1 Then
sText = sName + " (Part " + nGroupId.ToString + ")"
ElseIf nGroupType = 2 Then
sText = sName + " (Layer " + nGroupId.ToString + ")"
Else
sText = sName + " (Group " + nGroupId.ToString + ")"
End If
Else
If nGroupType = 1 Then
sText = "Part " + nGroupId.ToString
ElseIf nGroupType = 2 Then
sText = "Layer " + nGroupId.ToString
Else
sText = "Group " + nGroupId.ToString
End If
End If
' per visualizzare oggetti di livello diverso da utente, si deve avere il permesso
If nLevel <> GDB_LV.USER And m_nUserLevel < 5 Then
Return
End If
' inserisco il nodo nell'albero
Dim CurrColor As Color3d
EgtGetCalcColor(nGroupId, CurrColor)
Dim sImage As String = TypeToImageInObjTree(GDB_TY.GROUP, nGroupType)
Dim CurrNod As LayerTreeViewItem = New LayerTreeViewItem(nGroupId, sText, sImage, CurrColor)
PrevNodColl.Add(CurrNod)
CurrNodColl = CurrNod.Items
Dim nStat As Integer = GDB_ST.ON_
EgtGetStatus(nGroupId, nStat)
CurrNod.OnOff = (nStat <> GDB_ST.OFF)
End If
Dim nObjs As Integer = EgtGetGroupObjs(nGroupId)
If (nObjs > 275000) Then
Dim sText As String = "Too many entities (" + nObjs.ToString() + ")"
CurrNodColl.Add(New LayerTreeViewItem(GDB_ID.NULL, sText))
Return
End If
Dim nId As Integer = EgtGetFirstInGroup(nGroupId)
While nId <> GDB_ID.NULL
'recupero il tipo di nodo
Dim nType As Integer = EgtGetType(nId)
'se gruppo
If nType = GDB_TY.GROUP Then
AddGroupInObjTree(nId, nLevel, nDepth + 1, CurrNodColl)
'se oggetto geometrico
ElseIf nType >= GDB_TY.GEO_VECTOR Then
Dim sTitle As String = String.Empty
EgtGetTitle(nId, sTitle)
Dim sName As String = String.Empty
Dim sText As String = String.Empty
If EgtGetName(nId, sName) Then
sText = sName + " (" + sTitle + " " + nId.ToString + ")"
Else
sText = sTitle + " " + nId.ToString
End If
Dim CurrColor As New Color3d(0, 0, 0, 0)
EgtGetColor(nId, CurrColor)
Dim sImage As String = TypeToImageInObjTree(nType, nDepth)
Dim CurrNod As LayerTreeViewItem = New LayerTreeViewItem(nId, sText, sImage, CurrColor)
CurrNodColl.Add(CurrNod)
Dim nStat As Integer = GDB_ST.ON_
EgtGetStatus(nId, nStat)
CurrNod.OnOff = (nStat <> GDB_ST.OFF)
End If
'passo al successivo
nId = EgtGetNext(nId)
End While
End Sub
Private Function TypeToImageInObjTree(ByVal nType As Integer, ByVal nSubType As Integer) As String
Select Case nType
Case GDB_TY.GROUP
If nSubType = 1 Then
Return "/Resources/TreeView/Folder.png"
ElseIf nSubType = 2 Then
Return "/Resources/TreeView/Folder.png"
Else
Return "/Resources/TreeView/Group.ico"
End If
Case GDB_TY.GEO_VECTOR
Return "/Resources/TreeView/Vector.ico"
Case GDB_TY.GEO_POINT
Return "/Resources/TreeView/Point.ico"
Case GDB_TY.GEO_FRAME
Return "/Resources/TreeView/Frame.ico"
Case GDB_TY.CRV_LINE
Return "/Resources/TreeView/Line.ico"
Case GDB_TY.CRV_ARC
Return "/Resources/TreeView/Arc.ico"
Case GDB_TY.CRV_BEZ
Return "/Resources/TreeView/CBezier.ico"
Case GDB_TY.CRV_COMPO
Return "/Resources/TreeView/CCompo.ico"
Case GDB_TY.SRF_MESH
Return "/Resources/TreeView/STriMesh.ico"
Case GDB_TY.SRF_FRGN
Return "/Resources/TreeView/SFlatRegion.ico"
Case GDB_TY.VOL_ZMAP
Return "/Resources/TreeView/VolZmap.ico"
Case GDB_TY.EXT_TEXT
Return "/Resources/TreeView/Text.ico"
End Select
Return ""
End Function
Private Sub UpdateObjTree()
' per aggiornare l'albero senza ricostruirlo da capo
' se c'è una entità corrente, ne aggiorno i dati
If m_nObjTreeOldId <> GDB_ID.NULL Then
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, m_nObjTreeOldId)
End If
End Sub
Private Sub UpdateObjInObjTree(nId As Integer)
If m_bEnableUpdateObjInObjTree Then
' ripristino eventuale vecchio oggetto selezionato
RevertOldIdInObjTree()
' stampa dei dati del nuovo oggetto
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, nId)
' evidenzio l'oggetto
EgtSetMark(nId)
m_nObjTreeOldId = nId
' imposto il ridisegno della scena
EgtDraw()
' lancio timer per successiva de-evidenziazione
ObjTreeTimer.Stop()
ObjTreeTimer.Start()
Else
' stampa dei dati del nuovo oggetto
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, nId)
End If
End Sub
Private Sub UpdateObjInObjTreeNoMark(nId As Integer)
If m_bEnableUpdateObjInObjTree Then
' ripristino eventuale vecchio oggetto selezionato
RevertOldIdInObjTree()
' stampa dei dati del nuovo oggetto
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, nId)
' salvo id corrente
m_nObjTreeOldId = nId
Else
' stampa dei dati del nuovo oggetto
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, nId)
End If
End Sub
Private Function RevertOldIdInObjTree() As Integer
' salvo il vecchio Id
Dim nOldId As Integer = m_nObjTreeOldId
' se non nullo...
If EgtExistsObj(m_nObjTreeOldId) Then
' smarco l'oggetto
EgtResetMark(m_nObjTreeOldId)
' annullo oggetto da ripristinare
m_nObjTreeOldId = GDB_ID.NULL
End If
Return nOldId
End Function
Private Function SelectIdInObjTree(nId As Integer, bMark As Boolean) As Boolean
Dim tNode As LayerTreeViewItem = SearchIdInLayerList(LayerList, nId, True)
If Not IsNothing(tNode) Then
If Not bMark Then LayerTreeViewItem.m_MarkOnSel = False
tNode.IsSelected = True
If Not bMark Then LayerTreeViewItem.m_MarkOnSel = True
tNode.IsExpanded = True
m_nObjTreeOldId = nId
Return True
Else
m_nObjTreeOldId = GDB_ID.NULL
Return False
End If
End Function
Private Function SearchIdInLayerList(Tree As ObservableCollection(Of LayerTreeViewItem), nId As Integer, bExpand As Boolean) As LayerTreeViewItem
For Each Item In Tree
If Item.Id = nId Then
If bExpand Then Item.IsExpanded = True
Return Item
ElseIf Item.Items.Count() > 0 Then
Dim Item2 As LayerTreeViewItem = SearchIdInLayerList(Item.Items, nId, bExpand)
If Not IsNothing(Item2) Then
If bExpand Then Item.IsExpanded = True
Return Item2
End If
End If
Next
Return Nothing
End Function
'Private Sub MenuObjTree_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) Handles ContextMenuTreeView1.ItemClicked
' If e.ClickedItem.Name = "cmdSelectPartLayObj" Then
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
' m_Controller.ExecuteCommand(CMD.SELECTPARTLAYEROBJ)
' ElseIf e.ClickedItem.Name = "cmdDeselectPartLayObj" Then
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
' m_Controller.ExecuteCommand(CMD.DESELECTPARTLAYEROBJ)
' ElseIf e.ClickedItem.Name = "cmdSetName" Then
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
' m_Controller.ExecuteCommand(CMD.SETNAME)
' ElseIf e.ClickedItem.Name = "cmdSetInfo" Then
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
' m_Controller.ExecuteCommand(CMD.SETINFO)
' ElseIf e.ClickedItem.Name = "cmdRelocatePartLayObj" Then
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
' m_Controller.ExecuteCommand(CMD.RELOCATEPARTLAYEROBJ)
' ElseIf e.ClickedItem.Name = "cmdCopyPartLayObj" Then
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
' m_Controller.ExecuteCommand(CMD.COPYPARTLAYEROBJ)
' ElseIf e.ClickedItem.Name = "cmdDeletePartLayObj" Then
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
' m_Controller.ExecuteCommand(CMD.DELETE)
' ElseIf e.ClickedItem.Name = "cmdSavePartLay" Then
' ContextMenuTreeView1.Close()
' Dim sDir As String = String.Empty
' GetPrivateProfileString(S_GENERAL, K_LASTNGEOBJDIR, "", sDir, m_sIniFile)
' Dim nType As NGE = GetPrivateProfileInt(S_GEOMDB, K_SAVETYPE, NGE.CMPTEXT, m_sIniFile)
' m_Controller.SaveObject(m_nObjTreeMenuId, sDir, nType)
' End If
'End Sub
#End Region ' Methods
End Class
@@ -1,3 +0,0 @@
Public Class ManageLayerExpanderView
End Class
@@ -1,857 +0,0 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Imports EgtCAM5.IniFile
Namespace EgtCAM5
Public Class ManageLayerExpanderViewModel
Inherits ViewModelBase
#Region "FIELDS & PROPERTIES"
' Expander Header Properties
Private m_HeaderName As String
Public Property HeaderName As String
Get
Return m_HeaderName
End Get
Set(value As String)
m_HeaderName = value
OnPropertyChanged("HeaderName")
End Set
End Property
Private m_HeaderColor As SolidColorBrush
Public Property HeaderColor As SolidColorBrush
Get
Return m_HeaderColor
End Get
Set(value As SolidColorBrush)
m_HeaderColor = value
OnPropertyChanged("HeaderColor")
End Set
End Property
' Definizione comandi
Private m_cmdNewPart As ICommand
Private m_cmdNewLayer As ICommand
Private m_cmdLayerColor As ICommand
Private m_cmdTreeViewDoubleClick As ICommand
Private m_cmdTreeViewMouseUp As ICommand
Private m_cmdTreeViewMouseRightButton As ICommand
Private m_cmdSelect As ICommand
Private m_cmdDeselect As ICommand
Private m_cmdName As ICommand
Private m_cmdInfo As ICommand
Private m_cmdRelocate As ICommand
Private m_cmdCopy As ICommand
Private m_cmdDelete As ICommand
Private m_cmdSave As ICommand
' Lista dei layer
Private m_LayerList As New ObservableCollection(Of LayerTreeViewItem)
Public Property LayerList As ObservableCollection(Of LayerTreeViewItem)
Get
Return m_LayerList
End Get
Set(value As ObservableCollection(Of LayerTreeViewItem))
m_LayerList = value
End Set
End Property
Private m_IsRightClickedTreeItem As Boolean
Public ReadOnly Property IsRightClickedTreeItem As Integer
Get
Return m_RightClickedTreeItemId
End Get
End Property
Private m_RightClickedTreeItemId As Integer
Public ReadOnly Property RightClickedTreeItemId As Integer
Get
Return m_RightClickedTreeItemId
End Get
End Property
#Region "Messages"
Public ReadOnly Property NewPartMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 2)
End Get
End Property
Public ReadOnly Property NewLayerMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 3)
End Get
End Property
Public ReadOnly Property ColorMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 4)
End Get
End Property
Public ReadOnly Property SelectMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 6)
End Get
End Property
Public ReadOnly Property DeselectMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 7)
End Get
End Property
Public ReadOnly Property NameMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 8)
End Get
End Property
Public ReadOnly Property InfoMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 9)
End Get
End Property
Public ReadOnly Property RelocateMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 10)
End Get
End Property
Public ReadOnly Property CopyMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 11)
End Get
End Property
Public ReadOnly Property DeleteMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 12)
End Get
End Property
Public ReadOnly Property SaveMsg As String
Get
Return EgtMsg(MSG_DRAWOPTION + 13)
End Get
End Property
#End Region
#End Region
#Region "CONSTRUCTOR"
Sub New()
'Imposto tempo di evidenziazione delle entità clickate
ObjTreeTimer.Interval = TimeSpan.FromMilliseconds(1000)
Application.Msn.Register(Application.LOADOBJTREE, Sub()
LoadObjTree()
End Sub)
Application.Msn.Register(Application.UPDATEOBJINOBJTREE, Sub(nId As Integer)
UpdateObjInObjTree(nId)
End Sub)
Application.Msn.Register(Application.UPDATEOBJINOBJTREENOMARK, Sub(nId As Integer)
UpdateObjInObjTreeNoMark(nId)
End Sub)
Application.Msn.Register(Application.SELECTIDINOBJTREE, Sub(nId As Integer)
SelectIdInObjTree(nId, True)
End Sub)
Application.Msn.Register(Application.SELECTIDINOBJTREENOMARK, Sub(nId As Integer)
SelectIdInObjTree(nId, False)
End Sub)
Application.Msn.Register(Application.CLEAROBJTREE, Sub()
ClearObjTree()
End Sub)
Application.Msn.Register(Application.UPDATEOBJTREE, Sub()
UpdateObjTree()
End Sub)
Application.Msn.Register(Application.UPDATEHEADERNAME, Sub(HeaderName As String)
Me.HeaderName = HeaderName
End Sub)
Application.Msn.Register(Application.UPDATEHEADERCOLOR, Sub(HeaderColor As Color3d)
Me.HeaderColor = New SolidColorBrush(Color.FromArgb(CByte(HeaderColor.A * 255 / 100), CByte(HeaderColor.R), CByte(HeaderColor.G), CByte(HeaderColor.B)))
End Sub)
Application.Msn.Register(Application.UPDATEOBJTREEOLDID, Sub(ObjTreeOldId As Integer)
Me.m_nObjTreeOldId = ObjTreeOldId
End Sub)
Application.Msn.Register(Application.RIGHTCLICKEDLAYERTREEITEM, Sub(Id As Integer)
EgtResetMark(m_RightClickedTreeItemId)
m_RightClickedTreeItemId = Id
End Sub)
Application.Msn.Register(Application.ISRIGHTCLICKEDLAYERTREEITEM, Sub(Value As Boolean)
m_IsRightClickedTreeItem = Value
End Sub)
End Sub
#End Region ' Constructor
#Region "COMMANDS"
#Region "NewPartCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property NewPartCommand As ICommand
Get
If m_cmdNewPart Is Nothing Then
m_cmdNewPart = New RelayCommand(AddressOf NewPart)
End If
Return m_cmdNewPart
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub NewPart(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.NEWPART)
' Seleziono nell'albero il layer del pezzo appena creato
SelectIdInObjTree(EgtGetCurrLayer(), False)
End Sub
#End Region ' NewPartCommand
#Region "NewLayerCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property NewLayerCommand As ICommand
Get
If m_cmdNewLayer Is Nothing Then
m_cmdNewLayer = New RelayCommand(AddressOf NewLayer)
End If
Return m_cmdNewLayer
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub NewLayer(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.NEWLAYER)
' Seleziono nell'albero il layer appena creato
SelectIdInObjTree(EgtGetCurrLayer(), False)
End Sub
#End Region ' NewLayerCommand
#Region "LayerColorCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property LayerColorCommand As ICommand
Get
If m_cmdLayerColor Is Nothing Then
m_cmdLayerColor = New RelayCommand(AddressOf LayerColor)
End If
Return m_cmdLayerColor
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub LayerColor(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.LAYERCOLOR)
Application.Msn.NotifyColleagues(Application.LOADOBJTREE)
End Sub
#End Region ' LayerColorCommand
#Region "TreeViewDoubleClickCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property TreeViewDoubleClickCommand As ICommand
Get
If m_cmdTreeViewDoubleClick Is Nothing Then
m_cmdTreeViewDoubleClick = New RelayCommand(AddressOf TreeViewDoubleClick)
End If
Return m_cmdTreeViewDoubleClick
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub TreeViewDoubleClick(ByVal param As Object)
If m_nObjTreeOldId <> GDB_ID.NULL Then
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, m_nObjTreeOldId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SETCURRPARTLAYER)
End If
End Sub
#End Region ' TreeViewDoubleClickCommand
#Region "TreeViewMouseRightButtonCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property TreeViewMouseRightButtonCommand As ICommand
Get
If m_cmdTreeViewMouseRightButton Is Nothing Then
m_cmdTreeViewMouseRightButton = New RelayCommand(AddressOf TreeViewMouseRightButton)
End If
Return m_cmdTreeViewMouseRightButton
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub TreeViewMouseRightButton(ByVal param As Object)
If m_nObjTreeOldId <> GDB_ID.NULL Then
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, m_nObjTreeOldId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SETCURRPARTLAYER)
End If
End Sub
#End Region ' TreeViewMouseRightButtonCommand
#Region "TreeViewMouseUpCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property TreeViewMouseUpCommand As ICommand
Get
If m_cmdTreeViewMouseUp Is Nothing Then
m_cmdTreeViewMouseUp = New RelayCommand(AddressOf TreeViewMouseUp)
End If
Return m_cmdTreeViewMouseUp
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub TreeViewMouseUp(ByVal param As Object)
' determino Id di eventuale item sotto il mouse
Dim nId As Integer = GDB_ID.NULL
If m_IsRightClickedTreeItem Then
nId = m_RightClickedTreeItemId
Else
nId = m_nObjTreeOldId
End If
' se Id coincide con il corrente
If nId <> GDB_ID.NULL Then 'And nId = m_nObjTreeOldId Then
' evidenzio
EgtSetMark(nId)
EgtDraw()
' lancio timer per successiva de-evidenziazione
ObjTreeTimer.Stop()
ObjTreeTimer.Start()
End If
' se rilascio tasto destro
'If e.Button = Windows.Forms.MouseButtons.Right Then
' ' Id pezzo sotto il mouse
' m_nObjTreeMenuId = nId
' ' verifico stato visualizzazione per abilitare voci menù
' Dim nStat As GDB_ST = GDB_ST.ON_
' Dim bOn As Boolean = EgtGetCalcStatus(m_nObjTreeMenuId, nStat) And nStat <> GDB_ST.OFF
' For Each Item As ToolStripItem In ContextMenuTreeView1.Items
' If Item.Name = "cmdSetName" Or Item.Name = "cmdSetInfo" Then
' Item.Enabled = True
' Else
' Item.Enabled = bOn
' End If
' Next
' 'ContextMenuTreeView1.Show(TreeView1, e.Location)
'End If
End Sub
#End Region ' TreeViewMouseUpCommand
#Region "SelectCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property SelectCommand As ICommand
Get
If m_cmdSelect Is Nothing Then
m_cmdSelect = New RelayCommand(AddressOf SelectCmd)
End If
Return m_cmdSelect
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub SelectCmd(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SELECTPARTLAYEROBJ)
End Sub
#End Region ' SelectCommand
#Region "DeselectCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property DeselectCommand As ICommand
Get
If m_cmdDeselect Is Nothing Then
m_cmdDeselect = New RelayCommand(AddressOf Deselect)
End If
Return m_cmdDeselect
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Deselect(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.DESELECTPARTLAYEROBJ)
End Sub
#End Region ' DeselectCommand
#Region "NameCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property NameCommand As ICommand
Get
If m_cmdName Is Nothing Then
m_cmdName = New RelayCommand(AddressOf Name)
End If
Return m_cmdName
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Name(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SETNAME)
End Sub
#End Region ' NameCommand
#Region "InfoCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property InfoCommand As ICommand
Get
If m_cmdInfo Is Nothing Then
m_cmdInfo = New RelayCommand(AddressOf Info)
End If
Return m_cmdInfo
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Info(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SETINFO)
End Sub
#End Region ' InfoCommand
#Region "RelocateCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property RelocateCommand As ICommand
Get
If m_cmdRelocate Is Nothing Then
m_cmdRelocate = New RelayCommand(AddressOf Relocate)
End If
Return m_cmdRelocate
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Relocate(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.RELOCATEPARTLAYEROBJ)
End Sub
#End Region ' RelocateCommand
#Region "CopyCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property CopyCommand As ICommand
Get
If m_cmdCopy Is Nothing Then
m_cmdCopy = New RelayCommand(AddressOf Copy)
End If
Return m_cmdCopy
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Copy(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.COPYPARTLAYEROBJ)
End Sub
#End Region ' CopyCommand
#Region "DeleteCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property DeleteCommand As ICommand
Get
If m_cmdDelete Is Nothing Then
m_cmdDelete = New RelayCommand(AddressOf Delete)
End If
Return m_cmdDelete
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Delete(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.DELETE)
End Sub
#End Region ' DeleteCommand
#Region "SaveCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property SaveCommand As ICommand
Get
If m_cmdSave Is Nothing Then
m_cmdSave = New RelayCommand(AddressOf Save)
End If
Return m_cmdSave
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Save(ByVal param As Object)
Dim sDir As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_LASTNGEOBJDIR, "", sDir)
Dim nType As NGE = DirectCast(GetPrivateProfileInt(S_GEOMDB, K_SAVETYPE, NGE.CMPTEXT), NGE)
Application.Msn.NotifyColleagues(Application.SAVEOBJECT, New SaveObjectParam(m_RightClickedTreeItemId, sDir, nType))
End Sub
#End Region ' SaveCommand
#End Region ' Commands
#Region "METHODS"
Private WithEvents ObjTreeTimer As New System.Windows.Threading.DispatcherTimer
Private m_nObjTreeOldId As Integer = GDB_ID.NULL
Private m_nObjTreeMenuId As Integer = GDB_ID.NULL
Private m_bEnableUpdateObjInObjTree As Boolean = True
Private Sub ObjTreeTickEvent(source As Object, e As EventArgs) Handles ObjTreeTimer.Tick
Dim nId As Integer = GDB_ID.NULL
If m_IsRightClickedTreeItem Then
nId = m_RightClickedTreeItemId
Else
nId = m_nObjTreeOldId
End If
If nId <> GDB_ID.NULL Then
EgtResetMark(nId)
EgtDraw()
End If
ObjTreeTimer.Stop()
End Sub
Public Sub LoadObjTree()
LayerTreeViewItem.m_SendCmd = False
Dim nOldId As Integer = ClearObjTree()
AddGroupInObjTree(GDB_ID.ROOT, GDB_LV.USER, 0, LayerList)
If nOldId <> GDB_ID.NULL Then
m_bEnableUpdateObjInObjTree = False
SelectIdInObjTree(nOldId, True)
m_bEnableUpdateObjInObjTree = True
Else
Application.Msn.NotifyColleagues(Application.SETINFOBOX, String.Empty)
End If
LayerTreeViewItem.m_SendCmd = True
End Sub
Private Function ClearObjTree() As Integer
Dim nOldId As Integer = RevertOldIdInObjTree()
LayerList.Clear()
Return nOldId
End Function
Private Sub AddGroupInObjTree(ByVal nGroupId As Integer, ByVal nLevel As Integer, ByVal nDepth As Integer, ByRef PrevNodColl As ObservableCollection(Of LayerTreeViewItem))
Dim CurrNodColl As ObservableCollection(Of LayerTreeViewItem)
If nGroupId = GDB_ID.ROOT Then
CurrNodColl = PrevNodColl
Else
' livello
Dim nObjLev As Integer = GDB_LV.USER
EgtGetLevel(nGroupId, nObjLev)
If nObjLev = GDB_LV.TEMP Then
nLevel = GDB_LV.TEMP
ElseIf nLevel = GDB_LV.USER Then
nLevel = nObjLev
End If
' tipo
Dim nGroupType As Integer = 0 ' 0=gruppo generico, 1=pezzo, 2=layer
If nLevel = GDB_LV.USER Then
nGroupType = nDepth
End If
' nome
Dim sName As String = String.Empty
Dim sText As String = String.Empty
If EgtGetName(nGroupId, sName) Then
If nGroupType = 1 Then
sText = sName + " (Part " + nGroupId.ToString + ")"
ElseIf nGroupType = 2 Then
sText = sName + " (Layer " + nGroupId.ToString + ")"
Else
sText = sName + " (Group " + nGroupId.ToString + ")"
End If
Else
If nGroupType = 1 Then
sText = "Part " + nGroupId.ToString
ElseIf nGroupType = 2 Then
sText = "Layer " + nGroupId.ToString
Else
sText = "Group " + nGroupId.ToString
End If
End If
' per visualizzare oggetti di livello diverso da utente, si deve avere il permesso
If nLevel <> GDB_LV.USER And m_nUserLevel < 5 Then
Return
End If
' inserisco il nodo nell'albero
Dim CurrColor As Color3d
EgtGetCalcColor(nGroupId, CurrColor)
Dim sImage As String = TypeToImageInObjTree(GDB_TY.GROUP, nGroupType)
Dim CurrNod As LayerTreeViewItem = New LayerTreeViewItem(nGroupId, sText, sImage, CurrColor)
PrevNodColl.Add(CurrNod)
CurrNodColl = CurrNod.Items
Dim nStat As Integer = GDB_ST.ON_
EgtGetStatus(nGroupId, nStat)
CurrNod.OnOff = (nStat <> GDB_ST.OFF)
End If
Dim nObjs As Integer = EgtGetGroupObjs(nGroupId)
If (nObjs > 275000) Then
Dim sText As String = "Too many entities (" + nObjs.ToString() + ")"
CurrNodColl.Add(New LayerTreeViewItem(GDB_ID.NULL, sText))
Return
End If
Dim nId As Integer = EgtGetFirstInGroup(nGroupId)
While nId <> GDB_ID.NULL
'recupero il tipo di nodo
Dim nType As Integer = EgtGetType(nId)
'se gruppo
If nType = GDB_TY.GROUP Then
AddGroupInObjTree(nId, nLevel, nDepth + 1, CurrNodColl)
'se oggetto geometrico
ElseIf nType >= GDB_TY.GEO_VECTOR Then
Dim sTitle As String = String.Empty
EgtGetTitle(nId, sTitle)
Dim sName As String = String.Empty
Dim sText As String = String.Empty
If EgtGetName(nId, sName) Then
sText = sName + " (" + sTitle + " " + nId.ToString + ")"
Else
sText = sTitle + " " + nId.ToString
End If
Dim CurrColor As New Color3d(0, 0, 0, 0)
EgtGetColor(nId, CurrColor)
Dim sImage As String = TypeToImageInObjTree(nType, nDepth)
Dim CurrNod As LayerTreeViewItem = New LayerTreeViewItem(nId, sText, sImage, CurrColor)
CurrNodColl.Add(CurrNod)
Dim nStat As Integer = GDB_ST.ON_
EgtGetStatus(nId, nStat)
CurrNod.OnOff = (nStat <> GDB_ST.OFF)
End If
'passo al successivo
nId = EgtGetNext(nId)
End While
End Sub
Private Function TypeToImageInObjTree(ByVal nType As Integer, ByVal nSubType As Integer) As String
Select Case nType
Case GDB_TY.GROUP
If nSubType = 1 Then
Return "/Resources/TreeView/Folder.png"
ElseIf nSubType = 2 Then
Return "/Resources/TreeView/Folder.png"
Else
Return "/Resources/TreeView/Group.ico"
End If
Case GDB_TY.GEO_VECTOR
Return "/Resources/TreeView/Vector.ico"
Case GDB_TY.GEO_POINT
Return "/Resources/TreeView/Point.ico"
Case GDB_TY.GEO_FRAME
Return "/Resources/TreeView/Frame.ico"
Case GDB_TY.CRV_LINE
Return "/Resources/TreeView/Line.ico"
Case GDB_TY.CRV_ARC
Return "/Resources/TreeView/Arc.ico"
Case GDB_TY.CRV_BEZ
Return "/Resources/TreeView/CBezier.ico"
Case GDB_TY.CRV_COMPO
Return "/Resources/TreeView/CCompo.ico"
Case GDB_TY.SRF_MESH
Return "/Resources/TreeView/STriMesh.ico"
Case GDB_TY.SRF_FRGN
Return "/Resources/TreeView/SFlatRegion.ico"
Case GDB_TY.VOL_ZMAP
Return "/Resources/TreeView/VolZmap.ico"
Case GDB_TY.EXT_TEXT
Return "/Resources/TreeView/Text.ico"
End Select
Return ""
End Function
Private Sub UpdateObjTree()
' per aggiornare l'albero senza ricostruirlo da capo
' se c'è una entità corrente, ne aggiorno i dati
If m_nObjTreeOldId <> GDB_ID.NULL Then
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, m_nObjTreeOldId)
End If
End Sub
Private Sub UpdateObjInObjTree(nId As Integer)
If m_bEnableUpdateObjInObjTree Then
' ripristino eventuale vecchio oggetto selezionato
RevertOldIdInObjTree()
' stampa dei dati del nuovo oggetto
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, nId)
' evidenzio l'oggetto
EgtSetMark(nId)
m_nObjTreeOldId = nId
' imposto il ridisegno della scena
EgtDraw()
' lancio timer per successiva de-evidenziazione
ObjTreeTimer.Stop()
ObjTreeTimer.Start()
Else
' stampa dei dati del nuovo oggetto
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, nId)
End If
End Sub
Private Sub UpdateObjInObjTreeNoMark(nId As Integer)
If m_bEnableUpdateObjInObjTree Then
' ripristino eventuale vecchio oggetto selezionato
RevertOldIdInObjTree()
' stampa dei dati del nuovo oggetto
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, nId)
' salvo id corrente
m_nObjTreeOldId = nId
Else
' stampa dei dati del nuovo oggetto
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, nId)
End If
End Sub
Private Function RevertOldIdInObjTree() As Integer
' salvo il vecchio Id
Dim nOldId As Integer = m_nObjTreeOldId
' se non nullo...
If EgtExistsObj(m_nObjTreeOldId) Then
' smarco l'oggetto
EgtResetMark(m_nObjTreeOldId)
' annullo oggetto da ripristinare
m_nObjTreeOldId = GDB_ID.NULL
End If
Return nOldId
End Function
Private Function SelectIdInObjTree(nId As Integer, bMark As Boolean) As Boolean
Dim tNode As LayerTreeViewItem = SearchIdInLayerList(LayerList, nId, True)
If Not IsNothing(tNode) Then
If Not bMark Then LayerTreeViewItem.m_MarkOnSel = False
tNode.IsSelected = True
If Not bMark Then LayerTreeViewItem.m_MarkOnSel = True
tNode.IsExpanded = True
m_nObjTreeOldId = nId
Return True
Else
m_nObjTreeOldId = GDB_ID.NULL
Return False
End If
End Function
Private Function SearchIdInLayerList(Tree As ObservableCollection(Of LayerTreeViewItem), nId As Integer, bExpand As Boolean) As LayerTreeViewItem
For Each Item In Tree
If Item.Id = nId Then
If bExpand Then Item.IsExpanded = True
Return Item
ElseIf Item.Items.Count() > 0 Then
Dim Item2 As LayerTreeViewItem = SearchIdInLayerList(Item.Items, nId, bExpand)
If Not IsNothing(Item2) Then
If bExpand Then Item.IsExpanded = True
Return Item2
End If
End If
Next
Return Nothing
End Function
'Private Sub MenuObjTree_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) Handles ContextMenuTreeView1.ItemClicked
' If e.ClickedItem.Name = "cmdSelectPartLayObj" Then
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
' m_Controller.ExecuteCommand(CMD.SELECTPARTLAYEROBJ)
' ElseIf e.ClickedItem.Name = "cmdDeselectPartLayObj" Then
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
' m_Controller.ExecuteCommand(CMD.DESELECTPARTLAYEROBJ)
' ElseIf e.ClickedItem.Name = "cmdSetName" Then
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
' m_Controller.ExecuteCommand(CMD.SETNAME)
' ElseIf e.ClickedItem.Name = "cmdSetInfo" Then
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
' m_Controller.ExecuteCommand(CMD.SETINFO)
' ElseIf e.ClickedItem.Name = "cmdRelocatePartLayObj" Then
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
' m_Controller.ExecuteCommand(CMD.RELOCATEPARTLAYEROBJ)
' ElseIf e.ClickedItem.Name = "cmdCopyPartLayObj" Then
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
' m_Controller.ExecuteCommand(CMD.COPYPARTLAYEROBJ)
' ElseIf e.ClickedItem.Name = "cmdDeletePartLayObj" Then
' m_Controller.SetLastInteger(m_nObjTreeMenuId)
' m_Controller.ExecuteCommand(CMD.DELETE)
' ElseIf e.ClickedItem.Name = "cmdSavePartLay" Then
' ContextMenuTreeView1.Close()
' Dim sDir As String = String.Empty
' GetPrivateProfileString(S_GENERAL, K_LASTNGEOBJDIR, "", sDir, m_sIniFile)
' Dim nType As NGE = GetPrivateProfileInt(S_GEOMDB, K_SAVETYPE, NGE.CMPTEXT, m_sIniFile)
' m_Controller.SaveObject(m_nObjTreeMenuId, sDir, nType)
' End If
'End Sub
#End Region ' Methods
End Class
End Namespace
@@ -1,4 +1,4 @@
<UserControl x:Class="MachiningTreeExpanderView"
<UserControl x:Class="MachiningTreeExpanderV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
@@ -1,4 +1,4 @@
Public Class MachiningTreeExpanderView
Public Class MachiningTreeExpanderV
' Evento necessario per impedire che venga creata la lavorazione quando si fa doppio click sulla ScrollBar
Private Sub MachiningsTreeView_MouseDoubleClick(sender As Object, e As System.Windows.Input.MouseButtonEventArgs)
@@ -9,7 +9,7 @@
' e.Handled = True
'End If
' recupero il viewmodel associato a questa view in cui è presente la funzione che l'evento deve lanciare
Dim MachiningTreeExpanderViewModel As EgtCAM5.MachiningTreeExpanderViewModel = DirectCast(Me.DataContext, EgtCAM5.MachiningTreeExpanderViewModel)
Dim MachiningTreeExpanderViewModel As MachiningTreeExpanderVM = DirectCast(Me.DataContext, MachiningTreeExpanderVM)
' recupero il treeviewitem clickato(sorgente dell'evento)
Dim ClickedTreeViewItem As TreeViewItem = DirectCast(sender, TreeViewItem)
' ne recupero il VM da passare alla funzione
@@ -0,0 +1,209 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Public Class MachiningTreeExpanderVM
Inherits ViewModelBase
#Region "FIELDS & PROPERTIES"
Private m_CodeCommand As Boolean = False
Private m_IsEnabled As Boolean
Public Property IsEnabled As Boolean
Get
Return m_IsEnabled
End Get
Set(value As Boolean)
If value <> m_IsEnabled Then
m_IsEnabled = value
If Not value And Not m_CodeCommand Then
Application.Msn.NotifyColleagues(Application.CANCELOPERATIONCOMMAND)
End If
m_CodeCommand = False
OnPropertyChanged("IsEnabled")
End If
End Set
End Property
' Lista delle lavorazioni
Private m_MachiningsList As New ObservableCollection(Of FamilyMachiningTreeViewExpanderItem)
Public Property MachiningsList As ObservableCollection(Of FamilyMachiningTreeViewExpanderItem)
Get
Return m_MachiningsList
End Get
Set(value As ObservableCollection(Of FamilyMachiningTreeViewExpanderItem))
m_MachiningsList = value
End Set
End Property
' Operazione correntemente selezionata, che permette di aggiungere al posto giusto quella nuova
Private m_nSelectedOperationId As Integer = -1
Public ReadOnly Property MachListHdr As String
Get
Return EgtMsg(5412) ' Nuove Lavorazioni
End Get
End Property
' Definizione comandi
Private m_cmdTreeViewDoubleClick As ICommand
Private m_cmdCancelNew As ICommand
#End Region
#Region "CONSTRUCTOR"
Sub New()
' Per caricare l'albero la prima volta che viene aperto
IsEnabled = False
LoadSelectedMachineMachinings()
Application.Msn.Register(Application.UPDATEOPERATIONMACHININGLIST, Sub()
m_MachiningsList.Clear()
LoadSelectedMachineMachinings()
End Sub)
Application.Msn.Register(Application.MACHININGTREEVIEWEXPANDERISENABLED, Sub(bValue As Boolean)
m_CodeCommand = True
IsEnabled = bValue
End Sub)
Application.Msn.Register(Application.SELECTEDOPERATION, Sub(SelectedOperation As OperationListBoxItem)
m_nSelectedOperationId = SelectedOperation.Id
End Sub)
End Sub
#End Region
#Region "COMMANDS"
#Region "TreeViewDoubleClickCommand"
''' <summary>
''' Returns a command that do TreeViewDoubleClick.
''' </summary>
Public ReadOnly Property TreeViewDoubleClickCommand As ICommand
Get
If m_cmdTreeViewDoubleClick Is Nothing Then
m_cmdTreeViewDoubleClick = New RelayCommand(AddressOf TreeViewDoubleClick)
End If
Return m_cmdTreeViewDoubleClick
End Get
End Property
''' <summary>
''' Execute the TreeViewDoubleClick. This method is invoked by the TreeViewDoubleClickCommand.
''' </summary>
Public Sub TreeViewDoubleClick(ByVal param As Object)
If TypeOf param Is MachiningTreeViewExpanderItem Then
Dim Machining As MachiningTreeViewExpanderItem = DirectCast(param, MachiningTreeViewExpanderItem)
' Creo nuova lavorazione(operazione) con la lavorazione selezionata
Dim MachiningId As Integer = EgtAddMachining(MachiningTypeToString(Machining.Type) & "_1", Machining.Name)
' Se è abilitata l'opzione
If Not OptionModule.m_bNewMachiningIsLastOne Then
' Sposto la lavorazione aggiunta subito dopo quella appena selezionata
EgtRelocate(MachiningId, m_nSelectedOperationId, GDB_POS.AFTER)
End If
' Recupero geometria correntemente selezionata e la metto in un vettore
Dim SelectedEntities As New List(Of Integer)
Dim EntityId As Integer = EgtGetFirstSelectedObj()
While EntityId <> GDB_ID.NULL
SelectedEntities.Add(EntityId)
EntityId = EgtGetNextSelectedObj()
End While
' Imposto l'operazione appena creata come corrente
EgtSetCurrMachining(MachiningId)
If SelectedEntities.Count = 1 AndAlso EgtGetType(SelectedEntities(0)) = GDB_TY.SRF_MESH Then
Dim nF As Integer = EgtSurfTmFacetFromTria(SelectedEntities(0), IniFile.m_LastSubEntityId)
If nF < 0 Then nF = 0
Dim SubEntityArray As Integer() = {nF}
EgtSetMachiningGeometry(SelectedEntities.ToArray, SubEntityArray)
Else
' Imposto il vettore come geometria di lavorazione
EgtSetMachiningGeometry(SelectedEntities.ToArray)
End If
' Calcolo la lavorazione con la nuova geometria
EgtApplyMachining(True)
EgtDraw()
' Ricarico la lista operazioni per avere quella nuova
Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, -1)
' disabilito la modalità nuova lavorazione
Application.Msn.NotifyColleagues(Application.NEWMACHININGMODEISACTIVE, New NewMachOpParam(False, MachiningId))
End If
End Sub
Private Function MachiningTypeToString(Type As Integer) As String
Select Case Type
Case MCH_MY.DRILLING
Return EgtMsg(MSG_MACHININGSDBPAGE + 1)
Case MCH_MY.SAWING
Return EgtMsg(MSG_MACHININGSDBPAGE + 2)
Case MCH_MY.MILLING
Return EgtMsg(MSG_MACHININGSDBPAGE + 3)
Case MCH_MY.POCKETING
Return EgtMsg(MSG_MACHININGSDBPAGE + 4)
Case MCH_MY.MORTISING
Return EgtMsg(MSG_MACHININGSDBPAGE + 5)
Case MCH_MY.SAWROUGHING
Return EgtMsg(MSG_MACHININGSDBPAGE + 6)
Case MCH_MY.SAWFINISHING
Return EgtMsg(MSG_MACHININGSDBPAGE + 7)
Case Else
Return "Mach"
End Select
End Function
#End Region ' TreeViewDoubleClickCommand
#Region "CancelNewCommand"
''' <summary>
''' Returns a command that do TreeViewDoubleClick.
''' </summary>
Public ReadOnly Property CancelNewCommand As ICommand
Get
If m_cmdCancelNew Is Nothing Then
m_cmdCancelNew = New RelayCommand(AddressOf CancelNew)
End If
Return m_cmdCancelNew
End Get
End Property
''' <summary>
''' Execute the TreeViewDoubleClick. This method is invoked by the TreeViewDoubleClickCommand.
''' </summary>
Public Sub CancelNew(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.CANCELOPERATIONCOMMAND)
End Sub
#End Region ' CancelNewCommand
#End Region ' Commands
#Region "METHODS"
''' <summary>
''' Method that search the machines in the correct folder and add to the MachinesList those valid.
''' </summary>
Private Sub LoadSelectedMachineMachinings()
Dim ActiveMachiningsTypes() As MachiningsType = MachineModel.ReadActiveMachiningsFamilies()
For Each MachiningsType In ActiveMachiningsTypes
Dim FamilyTreeView As New FamilyMachiningTreeViewExpanderItem(MachiningsType.TypeName, MachiningsType.TypeId)
MachiningsList.Add(FamilyTreeView)
Dim MachiningName As String = String.Empty
Dim MachiningToolName As String = String.Empty
EgtMdbGetFirstMachining(MachiningsType.TypeId, MachiningName)
While Not String.IsNullOrEmpty(MachiningName)
EgtMdbSetCurrMachining(MachiningName)
EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, MachiningToolName)
FamilyTreeView.Items.Add(New MachiningTreeViewExpanderItem(MachiningName, MachiningsType.TypeId, MachiningToolName))
EgtMdbGetNextMachining(MachiningsType.TypeId, MachiningName)
End While
Next
' Se esiste almeno una famiglia di lavorazioni, la seleziono
If MachiningsList.Count > 0 Then
MachiningsList(0).IsSelected = True
MachiningsList(0).NotifyPropertyChanged("IsSelected")
End If
End Sub
#End Region
End Class
@@ -1,213 +0,0 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Namespace EgtCAM5
Public Class MachiningTreeExpanderViewModel
Inherits ViewModelBase
#Region "FIELDS & PROPERTIES"
Private m_CodeCommand As Boolean = False
Private m_IsEnabled As Boolean
Public Property IsEnabled As Boolean
Get
Return m_IsEnabled
End Get
Set(value As Boolean)
If value <> m_IsEnabled Then
m_IsEnabled = value
If Not value And Not m_CodeCommand Then
Application.Msn.NotifyColleagues(Application.CANCELOPERATIONCOMMAND)
End If
m_CodeCommand = False
OnPropertyChanged("IsEnabled")
End If
End Set
End Property
' Lista delle lavorazioni
Private m_MachiningsList As New ObservableCollection(Of FamilyMachiningTreeViewExpanderItem)
Public Property MachiningsList As ObservableCollection(Of FamilyMachiningTreeViewExpanderItem)
Get
Return m_MachiningsList
End Get
Set(value As ObservableCollection(Of FamilyMachiningTreeViewExpanderItem))
m_MachiningsList = value
End Set
End Property
' Operazione correntemente selezionata, che permette di aggiungere al posto giusto quella nuova
Private m_nSelectedOperationId As Integer = -1
Public ReadOnly Property MachListHdr As String
Get
Return EgtMsg(5412) ' Nuove Lavorazioni
End Get
End Property
' Definizione comandi
Private m_cmdTreeViewDoubleClick As ICommand
Private m_cmdCancelNew As ICommand
#End Region
#Region "CONSTRUCTOR"
Sub New()
' Per caricare l'albero la prima volta che viene aperto
IsEnabled = False
LoadSelectedMachineMachinings()
Application.Msn.Register(Application.UPDATEOPERATIONMACHININGLIST, Sub()
m_MachiningsList.Clear()
LoadSelectedMachineMachinings()
End Sub)
Application.Msn.Register(Application.MACHININGTREEVIEWEXPANDERISENABLED, Sub(bValue As Boolean)
m_CodeCommand = True
IsEnabled = bValue
End Sub)
Application.Msn.Register(Application.SELECTEDOPERATION, Sub(SelectedOperation As OperationListBoxItem)
m_nSelectedOperationId = SelectedOperation.Id
End Sub)
End Sub
#End Region
#Region "COMMANDS"
#Region "TreeViewDoubleClickCommand"
''' <summary>
''' Returns a command that do TreeViewDoubleClick.
''' </summary>
Public ReadOnly Property TreeViewDoubleClickCommand As ICommand
Get
If m_cmdTreeViewDoubleClick Is Nothing Then
m_cmdTreeViewDoubleClick = New RelayCommand(AddressOf TreeViewDoubleClick)
End If
Return m_cmdTreeViewDoubleClick
End Get
End Property
''' <summary>
''' Execute the TreeViewDoubleClick. This method is invoked by the TreeViewDoubleClickCommand.
''' </summary>
Public Sub TreeViewDoubleClick(ByVal param As Object)
If TypeOf param Is MachiningTreeViewExpanderItem Then
Dim Machining As MachiningTreeViewExpanderItem = DirectCast(param, MachiningTreeViewExpanderItem)
' Creo nuova lavorazione(operazione) con la lavorazione selezionata
Dim MachiningId As Integer = EgtAddMachining(MachiningTypeToString(Machining.Type) & "_1", Machining.Name)
' Se è abilitata l'opzione
If Not OptionModule.m_bNewMachiningIsLastOne Then
' Sposto la lavorazione aggiunta subito dopo quella appena selezionata
EgtRelocate(MachiningId, m_nSelectedOperationId, GDB_POS.AFTER)
End If
' Recupero geometria correntemente selezionata e la metto in un vettore
Dim SelectedEntities As New List(Of Integer)
Dim EntityId As Integer = EgtGetFirstSelectedObj()
While EntityId <> GDB_ID.NULL
SelectedEntities.Add(EntityId)
EntityId = EgtGetNextSelectedObj()
End While
' Imposto l'operazione appena creata come corrente
EgtSetCurrMachining(MachiningId)
If SelectedEntities.Count = 1 AndAlso EgtGetType(SelectedEntities(0)) = GDB_TY.SRF_MESH Then
Dim nF As Integer = EgtSurfTmFacetFromTria(SelectedEntities(0), IniFile.m_LastSubEntityId)
If nF < 0 Then nF = 0
Dim SubEntityArray As Integer() = {nF}
EgtSetMachiningGeometry(SelectedEntities.ToArray, SubEntityArray)
Else
' Imposto il vettore come geometria di lavorazione
EgtSetMachiningGeometry(SelectedEntities.ToArray)
End If
' Calcolo la lavorazione con la nuova geometria
EgtApplyMachining(True)
EgtDraw()
' Ricarico la lista operazioni per avere quella nuova
Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, -1)
' disabilito la modalità nuova lavorazione
Application.Msn.NotifyColleagues(Application.NEWMACHININGMODEISACTIVE, New NewMachOpParam(False, MachiningId))
End If
End Sub
Private Function MachiningTypeToString(Type As Integer) As String
Select Case Type
Case MCH_MY.DRILLING
Return EgtMsg(MSG_MACHININGSDBPAGE + 1)
Case MCH_MY.SAWING
Return EgtMsg(MSG_MACHININGSDBPAGE + 2)
Case MCH_MY.MILLING
Return EgtMsg(MSG_MACHININGSDBPAGE + 3)
Case MCH_MY.POCKETING
Return EgtMsg(MSG_MACHININGSDBPAGE + 4)
Case MCH_MY.MORTISING
Return EgtMsg(MSG_MACHININGSDBPAGE + 5)
Case MCH_MY.SAWROUGHING
Return EgtMsg(MSG_MACHININGSDBPAGE + 6)
Case MCH_MY.SAWFINISHING
Return EgtMsg(MSG_MACHININGSDBPAGE + 7)
Case Else
Return "Mach"
End Select
End Function
#End Region ' TreeViewDoubleClickCommand
#Region "CancelNewCommand"
''' <summary>
''' Returns a command that do TreeViewDoubleClick.
''' </summary>
Public ReadOnly Property CancelNewCommand As ICommand
Get
If m_cmdCancelNew Is Nothing Then
m_cmdCancelNew = New RelayCommand(AddressOf CancelNew)
End If
Return m_cmdCancelNew
End Get
End Property
''' <summary>
''' Execute the TreeViewDoubleClick. This method is invoked by the TreeViewDoubleClickCommand.
''' </summary>
Public Sub CancelNew(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.CANCELOPERATIONCOMMAND)
End Sub
#End Region ' CancelNewCommand
#End Region ' Commands
#Region "METHODS"
''' <summary>
''' Method that search the machines in the correct folder and add to the MachinesList those valid.
''' </summary>
Private Sub LoadSelectedMachineMachinings()
Dim ActiveMachiningsTypes() As MachiningsType = MachineModel.ReadActiveMachiningsFamilies()
For Each MachiningsType In ActiveMachiningsTypes
Dim FamilyTreeView As New FamilyMachiningTreeViewExpanderItem(MachiningsType.TypeName, MachiningsType.TypeId)
MachiningsList.Add(FamilyTreeView)
Dim MachiningName As String = String.Empty
Dim MachiningToolName As String = String.Empty
EgtMdbGetFirstMachining(MachiningsType.TypeId, MachiningName)
While Not String.IsNullOrEmpty(MachiningName)
EgtMdbSetCurrMachining(MachiningName)
EgtMdbGetCurrMachiningParam(MCH_MP.TOOL, MachiningToolName)
FamilyTreeView.Items.Add(New MachiningTreeViewExpanderItem(MachiningName, MachiningsType.TypeId, MachiningToolName))
EgtMdbGetNextMachining(MachiningsType.TypeId, MachiningName)
End While
Next
' Se esiste almeno una famiglia di lavorazioni, la seleziono
If MachiningsList.Count > 0 Then
MachiningsList(0).IsSelected = True
MachiningsList(0).NotifyPropertyChanged("IsSelected")
End If
End Sub
#End Region
End Class
End Namespace
@@ -1,4 +1,4 @@
<UserControl x:Class="DispositionParameterExpanderView"
<UserControl x:Class="DispositionParameterExpanderV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
@@ -0,0 +1,3 @@
Public Class DispositionParameterExpanderV
End Class
@@ -0,0 +1,460 @@
Imports EgtUILib
Public Class DispositionParameterExpanderVM
Inherits ViewModelBase
Public Enum ObjectType As Integer
RAWPART = 1
PART = 2
FIXTURE = 3
End Enum
Private m_ActiveObject As ObjectType
Public Property ActiveObject As ObjectType
Get
Return m_ActiveObject
End Get
Set(value As ObjectType)
If value <> m_ActiveObject Then
Select Case value
Case ObjectType.RAWPART
RawPartIsExpanded = True
Case ObjectType.PART
PartIsExpanded = True
Case ObjectType.FIXTURE
FixtureIsExpanded = True
End Select
m_ActiveObject = value
End If
m_ActiveObject = value
End Set
End Property
Friend m_Id As Integer
Public ReadOnly Property Id As Integer
Get
Return m_Id
End Get
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_RawPartIsExpanded As Boolean
Public Property RawPartIsExpanded As Boolean
Get
Return m_RawPartIsExpanded
End Get
Set(value As Boolean)
If value <> m_RawPartIsExpanded Then
If value Then
' Chiudo Part e Fixture
PartIsExpanded = False
FixtureIsExpanded = False
' verifico se è attiva l'opzione muovi con ventose
If m_MoveWithFixture Then
' Abilito la selezione dei RawPart con ventose
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPARTWITHFIXTURE)
Else
' Abilito la selezione dei RawPart
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPART)
End If
If m_MoveIsChecked Then
m_RawRefGroupVisibility = Visibility.Visible
OnPropertyChanged("RawRefGroupVisibility")
End If
Else
' Nascondo i bottoni per impostare la posizione di riferimento del grezzo
m_RawRefGroupVisibility = Visibility.Collapsed
OnPropertyChanged("RawRefGroupVisibility")
' smarco la prima entità selezionata
EgtResetMark(EgtGetFirstSelectedObj)
EgtDeselectAll()
EgtDraw()
End If
m_RawPartIsExpanded = value
ActiveObject = ObjectType.RAWPART
OnPropertyChanged("RawPartIsExpanded")
End If
End Set
End Property
Private m_PartIsExpanded As Boolean
Public Property PartIsExpanded As Boolean
Get
Return m_PartIsExpanded
End Get
Set(value As Boolean)
If value <> m_PartIsExpanded Then
If value Then
' Chiudo RawPart e Fixture
RawPartIsExpanded = False
FixtureIsExpanded = False
Else
' smarco la prima entità selezionata
EgtResetMark(EgtGetFirstSelectedObj)
EgtDeselectAll()
EgtDraw()
End If
m_PartIsExpanded = value
ActiveObject = ObjectType.PART
OnPropertyChanged("PartIsExpanded")
End If
End Set
End Property
Private m_FixtureIsExpanded As Boolean
Public Property FixtureIsExpanded As Boolean
Get
Return m_FixtureIsExpanded
End Get
Set(value As Boolean)
If value <> m_FixtureIsExpanded Then
If value Then
' Chiudo RawPart e Part
RawPartIsExpanded = False
PartIsExpanded = False
' Abilito la selezione delle Fixture
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.FIXTURE)
m_ExpandFixtureFunction()
Else
' smarco la prima entità selezionata
EgtResetMark(EgtGetFirstSelectedObj)
' deseleziono tutto ed aggiorno la visualizzazione
EgtDeselectAll()
EgtDraw()
End If
m_FixtureIsExpanded = value
ActiveObject = ObjectType.FIXTURE
OnPropertyChanged("FixtureIsExpanded")
End If
End Set
End Property
Private m_MoveIsChecked As Boolean
Public Property MoveIsChecked As Boolean
Get
Return m_MoveIsChecked
End Get
Set(value As Boolean)
If value <> m_MoveIsChecked Then
Application.Msn.NotifyColleagues(Application.SETMOVEINDISPOSITION, value)
InputValue = String.Empty
OnPropertyChanged("InputValue")
If value Then
If m_RawPartIsExpanded Then
m_RawRefGroupVisibility = Visibility.Visible
OnPropertyChanged("RawRefGroupVisibility")
Else
m_RawRefGroupVisibility = Visibility.Collapsed
OnPropertyChanged("RawRefGroupVisibility")
End If
m_InputMsg = "Move to:"
Else
m_RawRefGroupVisibility = Visibility.Collapsed
OnPropertyChanged("RawRefGroupVisibility")
m_InputMsg = "Rotate of:"
End If
OnPropertyChanged("InputMsg")
m_MoveIsChecked = value
End If
End Set
End Property
Private m_MoveWithFixture As Boolean = False
Public Property MoveWithFixture As Boolean
Get
Return m_MoveWithFixture
End Get
Set(value As Boolean)
If value <> m_MoveWithFixture Then
If value Then
' Abilito la selezione di RawPart con autoselezione delle sue ventose
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPARTWITHFIXTURE)
' Seleziono le ventose associate ad uno dei grezzi selezionati
' ciclo sui grezzi selezionati
Dim nSelRawPartId As Integer = EgtGetFirstSelectedObj()
While nSelRawPartId <> GDB_ID.NULL
' seleziono i sottopezzi del grezzo
DispositionUtility.SelectRawPartFixture(nSelRawPartId)
nSelRawPartId = EgtGetNextSelectedObj()
End While
Else
' Abilito la selezione di RawPart
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPART)
' ciclo sui grezzi selezionati
Dim nSelRawPartId As Integer = EgtGetFirstSelectedObj()
While nSelRawPartId <> GDB_ID.NULL
' deseleziono i sottopezzi del grezzo
DispositionUtility.DeselectRawPartFixture(nSelRawPartId)
nSelRawPartId = EgtGetNextSelectedObj()
End While
End If
EgtDraw()
m_MoveWithFixture = value
OnPropertyChanged("MoveWithFixture")
End If
End Set
End Property
Private m_InputValue As String
Public Property InputValue As String
Get
Return m_InputValue
End Get
Set(value As String)
If Not String.IsNullOrEmpty(m_InputErrorMsg) Then
m_InputErrorMsg = String.Empty
OnPropertyChanged("InputErrorMsg")
End If
m_InputValue = value
End Set
End Property
Private m_BLIsChecked As Boolean = True
Public ReadOnly Property BLIsChecked As Boolean
Get
Return m_BLIsChecked
End Get
End Property
Private m_RawRefPosition As MCH_CR = MCH_CR.BL
Private m_RawRefGroupVisibility As Visibility
Public ReadOnly Property RawRefGroupVisibility As Visibility
Get
Return m_RawRefGroupVisibility
End Get
End Property
' Actions
Private m_ExpandFixtureFunction As Action
Private m_FixtureParameters As FixtureParametersV
Public ReadOnly Property FixtureParameters As ContentControl
Get
If IsNothing(m_FixtureParameters) Then
m_FixtureParameters = New FixtureParametersV
m_FixtureParameters.DataContext = New FixtureParametersVM(m_ExpandFixtureFunction)
End If
Return m_FixtureParameters
End Get
End Property
Private m_RawPartOptions As RawPartOptionV
Public ReadOnly Property RawPartOptions As ContentControl
Get
If IsNothing(m_RawPartOptions) Then
m_RawPartOptions = New RawPartOptionV
m_RawPartOptions.DataContext = New RawPartOptionVM
End If
Return m_RawPartOptions
End Get
End Property
#Region "Messages"
Private m_InputMsg As String
Public ReadOnly Property InputMsg As String
Get
Return m_InputMsg
End Get
End Property
Private m_InputErrorMsg As String
Public ReadOnly Property InputErrorMsg As String
Get
Return m_InputErrorMsg
End Get
End Property
Public ReadOnly Property OkMsg As String
Get
Return EgtMsg(MSG_DISPOSITION + 1)
End Get
End Property
#End Region ' Messages
' Definizione comandi
Private m_cmdDone As ICommand
Private m_cmdCheckedRawRef As ICommand
#Region "CONSTRUCTOR"
Sub New(ByRef OpenDispositionFunction As Action(Of Boolean))
OpenDispositionFunction = AddressOf OpenDispositionParameters
MoveIsChecked = True
m_BLIsChecked = True
OnPropertyChanged("BLIsChecked")
m_RawRefPosition = MCH_CR.BL
End Sub
#End Region
#Region "METHODS"
Public Sub OpenDispositionParameters(bFirst As Boolean)
If bFirst Then
ActiveObject = ObjectType.RAWPART
Else
ActiveObject = ObjectType.FIXTURE
End If
Select Case m_ActiveObject
Case ObjectType.RAWPART
' Abilito la selezione delle Fixture
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPART)
Case ObjectType.FIXTURE
' Abilito la selezione delle Fixture
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.FIXTURE)
End Select
m_MoveWithFixture = False
OnPropertyChanged("MoveWithFixture")
End Sub
#End Region ' METHODS
#Region "COMMANDS"
#Region "DoneCommand"
''' <summary>
''' Returns a command that do Done.
''' </summary>
Public ReadOnly Property DoneCommand As ICommand
Get
If m_cmdDone Is Nothing Then
m_cmdDone = New RelayCommand(AddressOf Done)
End If
Return m_cmdDone
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the DoneCommand.
''' </summary>
Public Sub Done(ByVal param As Object)
' Verifico la validità del punto in Input
If Not String.IsNullOrEmpty(m_InputValue) Then
' se movimento di traslazione
If m_MoveIsChecked Then
Dim InputPoint As New Point3d(0, 0, 0)
Dim Values() As String = m_InputValue.Split(","c)
If Values.Count = 2 Then
StringToLen(Values(0), InputPoint.x)
StringToLen(Values(1), InputPoint.y)
Else
m_InputErrorMsg = "Il valore non è una cordinata XY"
OnPropertyChanged("InputErrorMsg")
Return
End If
' Vettore di movimento
Dim vtMove As Vector3d
' lo imposto a seconda del tipo del primo elemento selezionato
Dim nFirstSelectedId As Integer = EgtGetFirstSelectedObj()
' se è un grezzo
If EgtVerifyRawPartCurrPhase(nFirstSelectedId) Then
' imposto il riferimento della tavola
Dim ptTableRef As Point3d
EgtGetTableRef(1, ptTableRef)
' calcolo il punto del grezzo da posizionar nelle coordinate di input
Dim ptRawRefPoint As Point3d = DispositionUtility.GetRawPartRefPoint(nFirstSelectedId, m_RawRefPosition)
' creo un punto con le coordinate di input espresse rispetto alla tavola
Dim TableRefInputPoint As New Point3d(InputPoint)
TableRefInputPoint.LocToLoc(EgtGetGridFrame(), New Frame3d(ptTableRef))
' calcolo il vettore di spostamento del grezzo
vtMove = TableRefInputPoint - ptRawRefPoint
' se è una ventosa
ElseIf EgtVerifyFixture(nFirstSelectedId) Then
Dim SelObjFrame3d As New Frame3d(Frame3d.GLOB)
EgtGetGroupGlobFrame(nFirstSelectedId, SelObjFrame3d)
SelObjFrame3d.ToLoc(EgtGetGridFrame())
Dim FixturePoint As New Point3d(SelObjFrame3d.Orig)
' Ricavo il vettore di movimento (tengo solo XY)
vtMove = InputPoint - FixturePoint
vtMove.z = 0
End If
' Muovo tutti gli oggetti selezionati
DispositionUtility.MoveRawPartPartAndFixture(GDB_ID.SEL, vtMove)
' se è un grezzo
If EgtVerifyRawPartCurrPhase(nFirstSelectedId) Then
Dim ptRawRefPoint As Point3d = DispositionUtility.GetRawPartRefPoint(nFirstSelectedId, m_RawRefPosition)
' verifico se lo spostamento effettuato differisce da quello richiesto
Dim vtRemainingMove As Vector3d = InputPoint - ptRawRefPoint
' se differisce
If Not vtRemainingMove.IsSmall() Then
' eseguo lo spostamento rimanente sull'asse x
DispositionUtility.MoveRawPartPartAndFixture(GDB_ID.SEL, New Vector3d(vtRemainingMove.x, 0, 0))
' eseguo lo spostamento rimanente sull'asse y
DispositionUtility.MoveRawPartPartAndFixture(GDB_ID.SEL, New Vector3d(0, vtRemainingMove.y, 0))
End If
End If
' se rotazione
Else
Dim InputAngle As Double = 0
If Not StringToDouble(m_InputValue, InputAngle) Then
m_InputErrorMsg = "Il valore non è un angolo valido"
OnPropertyChanged("InputErrorMsg")
Return
End If
Dim nSelId As Integer = EgtGetFirstSelectedObj()
While nSelId <> GDB_ID.NULL
Select Case m_ActiveObject
Case ObjectType.RAWPART
If Not EgtRotateRawPart(nSelId, Vector3d.Z_AX, InputAngle) Then
m_InputErrorMsg = "Impossibile ruotare il grezzo."
OnPropertyChanged("InputErrorMsg")
End If
Case ObjectType.PART
'EgtMove...
Case ObjectType.FIXTURE
If Not EgtRotateFixture(nSelId, InputAngle) Then
m_InputErrorMsg = "Impossibile ruotare la ventosa"
OnPropertyChanged("InputErrorMsg")
End If
End Select
nSelId = EgtGetNextSelectedObj()
End While
End If
EgtDraw()
End If
End Sub
#End Region ' DoneCommand
#Region "CheckedRawRefCommand"
''' <summary>
''' Returns a command that do Done.
''' </summary>
Public ReadOnly Property CheckedRawRefCommand As ICommand
Get
If m_cmdCheckedRawRef Is Nothing Then
m_cmdCheckedRawRef = New RelayCommand(AddressOf CheckedRawRef)
End If
Return m_cmdCheckedRawRef
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the DoneCommand.
''' </summary>
Public Sub CheckedRawRef(ByVal param As Object)
Dim nRawRef As MCH_CR = DirectCast(param, MCH_CR)
m_RawRefPosition = nRawRef
End Sub
#End Region ' CheckedRawRefCommand
#End Region
End Class
@@ -1,3 +0,0 @@
Public Class DispositionParameterExpanderView
End Class
@@ -1,464 +0,0 @@
Imports EgtUILib
Namespace EgtCAM5
Public Class DispositionParameterExpanderViewModel
Inherits ViewModelBase
Public Enum ObjectType As Integer
RAWPART = 1
PART = 2
FIXTURE = 3
End Enum
Private m_ActiveObject As ObjectType
Public Property ActiveObject As ObjectType
Get
Return m_ActiveObject
End Get
Set(value As ObjectType)
If value <> m_ActiveObject Then
Select Case value
Case ObjectType.RAWPART
RawPartIsExpanded = True
Case ObjectType.PART
PartIsExpanded = True
Case ObjectType.FIXTURE
FixtureIsExpanded = True
End Select
m_ActiveObject = value
End If
m_ActiveObject = value
End Set
End Property
Friend m_Id As Integer
Public ReadOnly Property Id As Integer
Get
Return m_Id
End Get
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_RawPartIsExpanded As Boolean
Public Property RawPartIsExpanded As Boolean
Get
Return m_RawPartIsExpanded
End Get
Set(value As Boolean)
If value <> m_RawPartIsExpanded Then
If value Then
' Chiudo Part e Fixture
PartIsExpanded = False
FixtureIsExpanded = False
' verifico se è attiva l'opzione muovi con ventose
If m_MoveWithFixture Then
' Abilito la selezione dei RawPart con ventose
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPARTWITHFIXTURE)
Else
' Abilito la selezione dei RawPart
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPART)
End If
If m_MoveIsChecked Then
m_RawRefGroupVisibility = Visibility.Visible
OnPropertyChanged("RawRefGroupVisibility")
End If
Else
' Nascondo i bottoni per impostare la posizione di riferimento del grezzo
m_RawRefGroupVisibility = Visibility.Collapsed
OnPropertyChanged("RawRefGroupVisibility")
' smarco la prima entità selezionata
EgtResetMark(EgtGetFirstSelectedObj)
EgtDeselectAll()
EgtDraw()
End If
m_RawPartIsExpanded = value
ActiveObject = ObjectType.RAWPART
OnPropertyChanged("RawPartIsExpanded")
End If
End Set
End Property
Private m_PartIsExpanded As Boolean
Public Property PartIsExpanded As Boolean
Get
Return m_PartIsExpanded
End Get
Set(value As Boolean)
If value <> m_PartIsExpanded Then
If value Then
' Chiudo RawPart e Fixture
RawPartIsExpanded = False
FixtureIsExpanded = False
Else
' smarco la prima entità selezionata
EgtResetMark(EgtGetFirstSelectedObj)
EgtDeselectAll()
EgtDraw()
End If
m_PartIsExpanded = value
ActiveObject = ObjectType.PART
OnPropertyChanged("PartIsExpanded")
End If
End Set
End Property
Private m_FixtureIsExpanded As Boolean
Public Property FixtureIsExpanded As Boolean
Get
Return m_FixtureIsExpanded
End Get
Set(value As Boolean)
If value <> m_FixtureIsExpanded Then
If value Then
' Chiudo RawPart e Part
RawPartIsExpanded = False
PartIsExpanded = False
' Abilito la selezione delle Fixture
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.FIXTURE)
m_ExpandFixtureFunction()
Else
' smarco la prima entità selezionata
EgtResetMark(EgtGetFirstSelectedObj)
' deseleziono tutto ed aggiorno la visualizzazione
EgtDeselectAll()
EgtDraw()
End If
m_FixtureIsExpanded = value
ActiveObject = ObjectType.FIXTURE
OnPropertyChanged("FixtureIsExpanded")
End If
End Set
End Property
Private m_MoveIsChecked As Boolean
Public Property MoveIsChecked As Boolean
Get
Return m_MoveIsChecked
End Get
Set(value As Boolean)
If value <> m_MoveIsChecked Then
Application.Msn.NotifyColleagues(Application.SETMOVEINDISPOSITION, value)
InputValue = String.Empty
OnPropertyChanged("InputValue")
If value Then
If m_RawPartIsExpanded Then
m_RawRefGroupVisibility = Visibility.Visible
OnPropertyChanged("RawRefGroupVisibility")
Else
m_RawRefGroupVisibility = Visibility.Collapsed
OnPropertyChanged("RawRefGroupVisibility")
End If
m_InputMsg = "Move to:"
Else
m_RawRefGroupVisibility = Visibility.Collapsed
OnPropertyChanged("RawRefGroupVisibility")
m_InputMsg = "Rotate of:"
End If
OnPropertyChanged("InputMsg")
m_MoveIsChecked = value
End If
End Set
End Property
Private m_MoveWithFixture As Boolean = False
Public Property MoveWithFixture As Boolean
Get
Return m_MoveWithFixture
End Get
Set(value As Boolean)
If value <> m_MoveWithFixture Then
If value Then
' Abilito la selezione di RawPart con autoselezione delle sue ventose
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPARTWITHFIXTURE)
' Seleziono le ventose associate ad uno dei grezzi selezionati
' ciclo sui grezzi selezionati
Dim nSelRawPartId As Integer = EgtGetFirstSelectedObj()
While nSelRawPartId <> GDB_ID.NULL
' seleziono i sottopezzi del grezzo
DispositionUtility.SelectRawPartFixture(nSelRawPartId)
nSelRawPartId = EgtGetNextSelectedObj()
End While
Else
' Abilito la selezione di RawPart
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPART)
' ciclo sui grezzi selezionati
Dim nSelRawPartId As Integer = EgtGetFirstSelectedObj()
While nSelRawPartId <> GDB_ID.NULL
' deseleziono i sottopezzi del grezzo
DispositionUtility.DeselectRawPartFixture(nSelRawPartId)
nSelRawPartId = EgtGetNextSelectedObj()
End While
End If
EgtDraw()
m_MoveWithFixture = value
OnPropertyChanged("MoveWithFixture")
End If
End Set
End Property
Private m_InputValue As String
Public Property InputValue As String
Get
Return m_InputValue
End Get
Set(value As String)
If Not String.IsNullOrEmpty(m_InputErrorMsg) Then
m_InputErrorMsg = String.Empty
OnPropertyChanged("InputErrorMsg")
End If
m_InputValue = value
End Set
End Property
Private m_BLIsChecked As Boolean = True
Public ReadOnly Property BLIsChecked As Boolean
Get
Return m_BLIsChecked
End Get
End Property
Private m_RawRefPosition As MCH_CR = MCH_CR.BL
Private m_RawRefGroupVisibility As Visibility
Public ReadOnly Property RawRefGroupVisibility As Visibility
Get
Return m_RawRefGroupVisibility
End Get
End Property
' Actions
Private m_ExpandFixtureFunction As Action
Private m_FixtureParameters As FixtureParametersView
Public ReadOnly Property FixtureParameters As ContentControl
Get
If IsNothing(m_FixtureParameters) Then
m_FixtureParameters = New FixtureParametersView
m_FixtureParameters.DataContext = New FixtureParametersViewModel(m_ExpandFixtureFunction)
End If
Return m_FixtureParameters
End Get
End Property
Private m_RawPartOptions As RawPartOptionView
Public ReadOnly Property RawPartOptions As ContentControl
Get
If IsNothing(m_RawPartOptions) Then
m_RawPartOptions = New RawPartOptionView
m_RawPartOptions.DataContext = New RawPartOptionViewModel
End If
Return m_RawPartOptions
End Get
End Property
#Region "Messages"
Private m_InputMsg As String
Public ReadOnly Property InputMsg As String
Get
Return m_InputMsg
End Get
End Property
Private m_InputErrorMsg As String
Public ReadOnly Property InputErrorMsg As String
Get
Return m_InputErrorMsg
End Get
End Property
Public ReadOnly Property OkMsg As String
Get
Return EgtMsg(MSG_DISPOSITION + 1)
End Get
End Property
#End Region ' Messages
' Definizione comandi
Private m_cmdDone As ICommand
Private m_cmdCheckedRawRef As ICommand
#Region "CONSTRUCTOR"
Sub New(ByRef OpenDispositionFunction As Action(Of Boolean))
OpenDispositionFunction = AddressOf OpenDispositionParameters
MoveIsChecked = True
m_BLIsChecked = True
OnPropertyChanged("BLIsChecked")
m_RawRefPosition = MCH_CR.BL
End Sub
#End Region
#Region "METHODS"
Public Sub OpenDispositionParameters(bFirst As Boolean)
If bFirst Then
ActiveObject = ObjectType.RAWPART
Else
ActiveObject = ObjectType.FIXTURE
End If
Select Case m_ActiveObject
Case ObjectType.RAWPART
' Abilito la selezione delle Fixture
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPART)
Case ObjectType.FIXTURE
' Abilito la selezione delle Fixture
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.FIXTURE)
End Select
m_MoveWithFixture = False
OnPropertyChanged("MoveWithFixture")
End Sub
#End Region ' METHODS
#Region "COMMANDS"
#Region "DoneCommand"
''' <summary>
''' Returns a command that do Done.
''' </summary>
Public ReadOnly Property DoneCommand As ICommand
Get
If m_cmdDone Is Nothing Then
m_cmdDone = New RelayCommand(AddressOf Done)
End If
Return m_cmdDone
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the DoneCommand.
''' </summary>
Public Sub Done(ByVal param As Object)
' Verifico la validità del punto in Input
If Not String.IsNullOrEmpty(m_InputValue) Then
' se movimento di traslazione
If m_MoveIsChecked Then
Dim InputPoint As New Point3d(0, 0, 0)
Dim Values() As String = m_InputValue.Split(","c)
If Values.Count = 2 Then
StringToLen(Values(0), InputPoint.x)
StringToLen(Values(1), InputPoint.y)
Else
m_InputErrorMsg = "Il valore non è una cordinata XY"
OnPropertyChanged("InputErrorMsg")
Return
End If
' Vettore di movimento
Dim vtMove As Vector3d
' lo imposto a seconda del tipo del primo elemento selezionato
Dim nFirstSelectedId As Integer = EgtGetFirstSelectedObj()
' se è un grezzo
If EgtVerifyRawPartCurrPhase(nFirstSelectedId) Then
' imposto il riferimento della tavola
Dim ptTableRef As Point3d
EgtGetTableRef(1, ptTableRef)
' calcolo il punto del grezzo da posizionar nelle coordinate di input
Dim ptRawRefPoint As Point3d = DispositionUtility.GetRawPartRefPoint(nFirstSelectedId, m_RawRefPosition)
' creo un punto con le coordinate di input espresse rispetto alla tavola
Dim TableRefInputPoint As New Point3d(InputPoint)
TableRefInputPoint.LocToLoc(EgtGetGridFrame(), New Frame3d(ptTableRef))
' calcolo il vettore di spostamento del grezzo
vtMove = TableRefInputPoint - ptRawRefPoint
' se è una ventosa
ElseIf EgtVerifyFixture(nFirstSelectedId) Then
Dim SelObjFrame3d As New Frame3d(Frame3d.GLOB)
EgtGetGroupGlobFrame(nFirstSelectedId, SelObjFrame3d)
SelObjFrame3d.ToLoc(EgtGetGridFrame())
Dim FixturePoint As New Point3d(SelObjFrame3d.Orig)
' Ricavo il vettore di movimento (tengo solo XY)
vtMove = InputPoint - FixturePoint
vtMove.z = 0
End If
' Muovo tutti gli oggetti selezionati
DispositionUtility.MoveRawPartPartAndFixture(GDB_ID.SEL, vtMove)
' se è un grezzo
If EgtVerifyRawPartCurrPhase(nFirstSelectedId) Then
Dim ptRawRefPoint As Point3d = DispositionUtility.GetRawPartRefPoint(nFirstSelectedId, m_RawRefPosition)
' verifico se lo spostamento effettuato differisce da quello richiesto
Dim vtRemainingMove As Vector3d = InputPoint - ptRawRefPoint
' se differisce
If Not vtRemainingMove.IsSmall() Then
' eseguo lo spostamento rimanente sull'asse x
DispositionUtility.MoveRawPartPartAndFixture(GDB_ID.SEL, New Vector3d(vtRemainingMove.x, 0, 0))
' eseguo lo spostamento rimanente sull'asse y
DispositionUtility.MoveRawPartPartAndFixture(GDB_ID.SEL, New Vector3d(0, vtRemainingMove.y, 0))
End If
End If
' se rotazione
Else
Dim InputAngle As Double = 0
If Not StringToDouble(m_InputValue, InputAngle) Then
m_InputErrorMsg = "Il valore non è un angolo valido"
OnPropertyChanged("InputErrorMsg")
Return
End If
Dim nSelId As Integer = EgtGetFirstSelectedObj()
While nSelId <> GDB_ID.NULL
Select Case m_ActiveObject
Case ObjectType.RAWPART
If Not EgtRotateRawPart(nSelId, Vector3d.Z_AX, InputAngle) Then
m_InputErrorMsg = "Impossibile ruotare il grezzo."
OnPropertyChanged("InputErrorMsg")
End If
Case ObjectType.PART
'EgtMove...
Case ObjectType.FIXTURE
If Not EgtRotateFixture(nSelId, InputAngle) Then
m_InputErrorMsg = "Impossibile ruotare la ventosa"
OnPropertyChanged("InputErrorMsg")
End If
End Select
nSelId = EgtGetNextSelectedObj()
End While
End If
EgtDraw()
End If
End Sub
#End Region ' DoneCommand
#Region "CheckedRawRefCommand"
''' <summary>
''' Returns a command that do Done.
''' </summary>
Public ReadOnly Property CheckedRawRefCommand As ICommand
Get
If m_cmdCheckedRawRef Is Nothing Then
m_cmdCheckedRawRef = New RelayCommand(AddressOf CheckedRawRef)
End If
Return m_cmdCheckedRawRef
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the DoneCommand.
''' </summary>
Public Sub CheckedRawRef(ByVal param As Object)
Dim nRawRef As MCH_CR = DirectCast(param, MCH_CR)
m_RawRefPosition = nRawRef
End Sub
#End Region ' CheckedRawRefCommand
#End Region
End Class
End Namespace
@@ -1,4 +1,4 @@
<UserControl x:Class="FixtureParametersView"
<UserControl x:Class="FixtureParametersV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgtCAM5="clr-namespace:EgtCAM5">
@@ -0,0 +1,3 @@
Public Class FixtureParametersV
End Class
@@ -0,0 +1,406 @@
Imports System.ComponentModel
Imports System.Collections.ObjectModel
Imports EgtUILib
Public Class FixtureParametersVM
Inherits ViewModelBase
Private m_FixtureTypeList As ObservableCollection(Of FixtureListItem)
Public ReadOnly Property FixtureTypeList As ObservableCollection(Of FixtureListItem)
Get
If IsNothing(m_FixtureTypeList) Then
m_FixtureTypeList = New ObservableCollection(Of FixtureListItem)(FixtureType.ReadFixtureTypeFromMachIni())
End If
Return m_FixtureTypeList
End Get
End Property
Private m_SelectedFixtureType As FixtureListItem
Public Property SelectedFixtureType As FixtureListItem
Get
Return m_SelectedFixtureType
End Get
Set(value As FixtureListItem)
m_SelectedFixtureType = value
End Set
End Property
#Region "Messages"
Private m_FixtureErrorMsg As String
Public ReadOnly Property FixtureErrorMsg As String
Get
Return m_FixtureErrorMsg
End Get
End Property
Public ReadOnly Property OkMsg As String
Get
Return EgtMsg(MSG_DISPOSITION + 1)
End Get
End Property
#End Region ' Messages
Sub New(ByRef ExpandFixtureFunction As Action)
ExpandFixtureFunction = AddressOf UpdateFixtureCount
' seleziono secondo elemento se presente perchè primo è categoria
SelectedFixtureType = Nothing
End Sub
Private Sub UpdateFixtureCount()
' resetto tutto
For Index = 0 To m_FixtureTypeList.Count - 1
If TypeOf m_FixtureTypeList(Index) Is FixtureType Then
Dim CurrFixtureType As FixtureType = DirectCast(m_FixtureTypeList(Index), FixtureType)
CurrFixtureType.UsedNumber = 0
End If
Next
' calcolo i sottopezzi utilizzati in questa fase
Dim nUsedFixtureId As Integer = EgtGetFirstFixture()
While nUsedFixtureId <> GDB_ID.NULL
Dim sUsedFixtureName As String = String.Empty
For Index = 0 To m_FixtureTypeList.Count - 1
EgtGetName(nUsedFixtureId, sUsedFixtureName)
If sUsedFixtureName = m_FixtureTypeList(Index).Name Then
Dim CurrFixtureType As FixtureType = DirectCast(m_FixtureTypeList(Index), FixtureType)
CurrFixtureType.UsedNumber += 1
Exit For
End If
Next
nUsedFixtureId = EgtGetNextFixture(nUsedFixtureId)
End While
End Sub
' Definizione comandi
Private m_cmdAdd As ICommand
Private m_cmdRemove As ICommand
#Region "COMMANDS"
#Region "AddCommand"
''' <summary>
''' Returns a command that do Done.
''' </summary>
Public ReadOnly Property AddCommand As ICommand
Get
If m_cmdAdd Is Nothing Then
m_cmdAdd = New RelayCommand(AddressOf Add)
End If
Return m_cmdAdd
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the DoneCommand.
''' </summary>
Public Sub Add(ByVal param As Object)
' resetto il messaggio di errore
m_FixtureErrorMsg = String.Empty
' verifico se è stato selezionato un sottopezzo nella lista
Dim SelectedFixture As FixtureType
If TypeOf param Is FixtureType Then
SelectedFixture = DirectCast(param, FixtureType)
Else
Return
End If
' recupero area della tavola
Dim ptTableMin As Point3d
Dim ptTableMax As Point3d
EgtGetTableArea(1, ptTableMin, ptTableMax)
' calcolo il centro della tavola
Dim ptTableMid As New Point3d((ptTableMax.x - ptTableMin.x) / 2, (ptTableMax.y - ptTableMin.y) / 2, (ptTableMax.z - ptTableMin.z) / 2)
' posiziono il nuovo sottopezzo al centro della tavola
Dim nAddedFixtureId As Integer = EgtAddFixture(SelectedFixture.Name, ptTableMid, 0, 0)
' verifico se è in una posizione valida
If Not DispositionUtility.VerifyFixturePosition(nAddedFixtureId, New Vector3d) Then
' creo un gruppo temporaneo
Dim nTempGroupId As Integer = EgtCreateGroup(GDB_ID.ROOT)
EgtSetLevel(nTempGroupId, GDB_LV.USER)
EgtSetMode(nTempGroupId, GDB_MD.STD)
' calcolo ingombro sottopezzo aggiunto
Dim bboxAddedFixture As New BBox3d
EgtGetBBoxGlob(nAddedFixtureId, GDB_BB.STANDARD, bboxAddedFixture)
' calcolo bbox tavolo
Dim bboxTableArea As New BBox3d(ptTableMin, ptTableMax)
bboxTableArea.Expand(-bboxAddedFixture.DimX / 2, -bboxAddedFixture.DimY / 2, 0)
' creo superficie delle misure della tavola
Dim nTableFrId As Integer = EgtCreateSurfFrRectangle(nTempGroupId, bboxTableArea.Min, bboxTableArea.Max)
' ciclo su tutti i pezzi di questa fase
Dim nFixtureId As Integer = EgtGetFirstFixture()
While nFixtureId <> GDB_ID.NULL
' creo il bbox del sottopezzo
Dim bboxFixture As New BBox3d
EgtGetBBoxGlob(nFixtureId, GDB_BB.STANDARD, bboxFixture)
' faccio offset del bbox del sottopezzo per includere metà del sottopezzo da aggiungere
bboxFixture.Expand(bboxAddedFixture.DimX / 2, bboxAddedFixture.DimY / 2, 0)
' lo porto all'altezza della tavola
Dim ptMinFixtureFr As New Point3d(bboxFixture.Min)
Dim ptMaxFixtureFr As New Point3d(bboxFixture.Max)
ptMinFixtureFr.z = ptTableMin.z
ptMaxFixtureFr.z = ptTableMin.z
' creo la regione occupata dal bbox del sottopezzo
Dim nFixtureFrId As Integer = EgtCreateSurfFrRectangle(nTempGroupId, ptMinFixtureFr, ptMaxFixtureFr)
' sottraggo la regione del sottopezzo da quella della tavola
Dim x = EgtSurfFrSubtract(nTableFrId, nFixtureFrId)
nFixtureId = EgtGetNextFixture(nFixtureId)
End While
' creo gruppo con i bordi della regione di tavola avanzata
Dim TableFrBorderGroupId As Integer = EgtCreateGroup(nTempGroupId)
Dim nTableFrBorderCount As Integer = 0
Dim nChunk As Integer = EgtSurfFrChunkCount(nTableFrId)
For Index = 0 To nChunk - 1
EgtExtractSurfFrChunkLoops(nTableFrId, Index, TableFrBorderGroupId, nTableFrBorderCount)
Next
' verifico se c'è almeno un bordo
If nTableFrBorderCount = 0 Then
m_FixtureErrorMsg = "Impossibile posizionare la ventosa sulla tavola"
OnPropertyChanged("FixtureErrorMsg")
Return
End If
' converto il punto medio della tavola in coordinate globali
Dim PtTableRef As Point3d
EgtGetTableRef(1, PtTableRef)
Dim frTableRef As New Frame3d(PtTableRef)
ptTableMid.ToGlob(frTableRef)
' ciclo sui bordi per trovare il punto più vicino
Dim dMinDist As Double = (bboxTableArea.Max - bboxTableArea.Min).SqLenXY
Dim ptMinAbs As Point3d
Dim BorderId As Integer = EgtGetFirstInGroup(TableFrBorderGroupId)
While BorderId <> GDB_ID.NULL
Dim dDist As Double = 0
Dim ptMinRel As Point3d
Dim nSide As Integer = 0
EgtGetMinDistPntSidePointCurve(ptTableMid, BorderId, Vector3d.Z_AX, dDist, ptMinRel, nSide)
If dDist < dMinDist Then
dMinDist = dDist
ptMinAbs = ptMinRel
End If
BorderId = EgtGetNext(BorderId)
End While
' sposto il sottopezzo nel punto trovato
Dim vtFixtureMove As Vector3d = ptMinAbs - ptTableMid
vtFixtureMove.z = 0
EgtMoveFixture(nAddedFixtureId, vtFixtureMove)
' cancello il gruppo temporaneo
EgtErase(nTempGroupId)
End If
' sottraggo la ventosa aggiunta dal conto di quelle disponibili
SelectedFixture.UsedNumber += 1
EgtDraw()
OnPropertyChanged("FixtureErrorMsg")
End Sub
#End Region ' AddCommand
#Region "RemoveCommand"
''' <summary>
''' Returns a command that do Done.
''' </summary>
Public ReadOnly Property RemoveCommand As ICommand
Get
If m_cmdRemove Is Nothing Then
m_cmdRemove = New RelayCommand(AddressOf Remove)
End If
Return m_cmdRemove
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the DoneCommand.
''' </summary>
Public Sub Remove()
Dim SelectedFixtureId As Integer = EgtGetFirstSelectedObj()
While SelectedFixtureId <> GDB_ID.NULL
Dim NextSelectedId As Integer = EgtGetNextSelectedObj()
If EgtVerifyFixture(SelectedFixtureId) Then
EgtRemoveFixture(SelectedFixtureId)
For Index = 0 To FixtureTypeList.Count - 1
Dim SelFixtureName As String = String.Empty
EgtGetName(SelectedFixtureId, SelFixtureName)
If SelFixtureName = FixtureTypeList(Index).Name Then
Dim CurrFixtureType As FixtureType = DirectCast(FixtureTypeList(Index), FixtureType)
CurrFixtureType.UsedNumber -= 1
End If
Next
End If
SelectedFixtureId = NextSelectedId
End While
EgtDraw()
End Sub
#End Region ' RemoveCommand
#End Region
End Class
Public Class FixtureType
Inherits FixtureListItem
Private m_TotalNumber As Integer
Private m_UsedNumber As Integer
Private m_IsEnabled As Boolean = True
Private m_IsSelected As Boolean = False
Public Property TotalNumber As Integer
Get
Return m_TotalNumber
End Get
Set(value As Integer)
If value <> m_TotalNumber Then
m_TotalNumber = value
NotifyPropertyChanged("UsedTotalRatio")
End If
End Set
End Property
Public Property UsedNumber As Integer
Get
Return m_UsedNumber
End Get
Set(value As Integer)
If value <> m_UsedNumber Then
m_UsedNumber = value
NotifyPropertyChanged("UsedTotalRatio")
If UsedNumber >= TotalNumber Then
m_IsEnabled = False
m_IsSelected = False
NotifyPropertyChanged("IsSelected")
Else
m_IsEnabled = True
End If
NotifyPropertyChanged("IsEnabled")
End If
End Set
End Property
Public ReadOnly Property UsedTotalRatio As String
Get
Return (TotalNumber - UsedNumber).ToString & " / " & TotalNumber.ToString
End Get
End Property
Public ReadOnly Property IsEnabled As Boolean
Get
Return m_IsEnabled
End Get
End Property
Public Property IsSelected As Boolean
Get
Return m_IsSelected
End Get
Set(value As Boolean)
m_IsSelected = value
End Set
End Property
Sub New(sName As String, sCat As DispositionUtility.FIX_TYPE, nTot As Integer)
MyBase.New(sName, sCat)
TotalNumber = nTot
m_IsEnabled = True
End Sub
Public Shared Function ReadFixtureTypeFromMachIni() As List(Of FixtureListItem)
' creo la lista locale
Dim FixtureTypeList As New List(Of FixtureListItem)
' aggiungo le ventose se presenti
Dim sName As String = String.Empty
Dim nTot As Integer = 0
Dim bFirst As Boolean = True
Dim nIndex As Integer = 1
While GetPrivateProfileFixture(S_FIXTURES, System.Globalization.CultureInfo.InvariantCulture.TextInfo.ToTitleCase(FIX_VAC) & nIndex, sName, nTot)
If bFirst Then
FixtureTypeList.Add(New FixtureListItem(FIX_VAC, DispositionUtility.FIX_TYPE.VACUUM))
bFirst = False
End If
FixtureTypeList.Add(New FixtureType(sName, DispositionUtility.FIX_TYPE.VACUUM, nTot))
nIndex += 1
End While
' aggiungo i riferimenti se presenti
bFirst = True
nIndex = 1
While GetPrivateProfileFixture(S_FIXTURES, FIX_REF & nIndex, sName, nTot)
If bFirst Then
FixtureTypeList.Add(New FixtureListItem(FIX_REF, DispositionUtility.FIX_TYPE.REFERENCE))
bFirst = False
End If
FixtureTypeList.Add(New FixtureType(sName, DispositionUtility.FIX_TYPE.REFERENCE, nTot))
nIndex += 1
End While
' aggiungo le morse se presenti
bFirst = True
nIndex = 1
While GetPrivateProfileFixture(S_FIXTURES, FIX_VIS & nIndex, sName, nTot)
If bFirst Then
FixtureTypeList.Add(New FixtureListItem(FIX_VIS, DispositionUtility.FIX_TYPE.VISE))
bFirst = False
End If
FixtureTypeList.Add(New FixtureType(sName, DispositionUtility.FIX_TYPE.VISE, nTot))
nIndex += 1
End While
Return FixtureTypeList
End Function
End Class
Public Class FixtureListItem
Implements INotifyPropertyChanged
Private m_Name As String
Private m_Cathegory As DispositionUtility.FIX_TYPE
Private m_Focusable As Boolean
Public Property Name As String
Get
Return m_Name
End Get
Set(value As String)
m_Name = value
End Set
End Property
Public Property Cathegory As DispositionUtility.FIX_TYPE
Get
Return m_Cathegory
End Get
Set(value As DispositionUtility.FIX_TYPE)
m_Cathegory = value
End Set
End Property
Public ReadOnly Property Focusable As Boolean
Get
Return m_Focusable
End Get
End Property
Public ReadOnly Property CathegoryName As String
Get
Select Case Cathegory
Case DispositionUtility.FIX_TYPE.VACUUM
Return "Vacuum"
Case DispositionUtility.FIX_TYPE.REFERENCE
Return "Reference"
Case DispositionUtility.FIX_TYPE.VISE
Return "Vise"
Case Else
Return String.Empty
End Select
End Get
End Property
Sub New(sName As String, Cathegory As DispositionUtility.FIX_TYPE)
Me.Name = sName
Me.Cathegory = Cathegory
If TypeOf Me Is FixtureType Then
m_Focusable = True
Else
m_Focusable = False
End If
End Sub
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Public Sub NotifyPropertyChanged(propName As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
End Sub
End Class
@@ -1,3 +0,0 @@
Public Class FixtureParametersView
End Class
@@ -1,410 +0,0 @@
Imports System.ComponentModel
Imports System.Collections.ObjectModel
Imports EgtUILib
Namespace EgtCAM5
Public Class FixtureParametersViewModel
Inherits ViewModelBase
Private m_FixtureTypeList As ObservableCollection(Of FixtureListItem)
Public ReadOnly Property FixtureTypeList As ObservableCollection(Of FixtureListItem)
Get
If IsNothing(m_FixtureTypeList) Then
m_FixtureTypeList = New ObservableCollection(Of FixtureListItem)(FixtureType.ReadFixtureTypeFromMachIni())
End If
Return m_FixtureTypeList
End Get
End Property
Private m_SelectedFixtureType As FixtureListItem
Public Property SelectedFixtureType As FixtureListItem
Get
Return m_SelectedFixtureType
End Get
Set(value As FixtureListItem)
m_SelectedFixtureType = value
End Set
End Property
#Region "Messages"
Private m_FixtureErrorMsg As String
Public ReadOnly Property FixtureErrorMsg As String
Get
Return m_FixtureErrorMsg
End Get
End Property
Public ReadOnly Property OkMsg As String
Get
Return EgtMsg(MSG_DISPOSITION + 1)
End Get
End Property
#End Region ' Messages
Sub New(ByRef ExpandFixtureFunction As Action)
ExpandFixtureFunction = AddressOf UpdateFixtureCount
' seleziono secondo elemento se presente perchè primo è categoria
SelectedFixtureType = Nothing
End Sub
Private Sub UpdateFixtureCount()
' resetto tutto
For Index = 0 To m_FixtureTypeList.Count - 1
If TypeOf m_FixtureTypeList(Index) Is FixtureType Then
Dim CurrFixtureType As FixtureType = DirectCast(m_FixtureTypeList(Index), FixtureType)
CurrFixtureType.UsedNumber = 0
End If
Next
' calcolo i sottopezzi utilizzati in questa fase
Dim nUsedFixtureId As Integer = EgtGetFirstFixture()
While nUsedFixtureId <> GDB_ID.NULL
Dim sUsedFixtureName As String = String.Empty
For Index = 0 To m_FixtureTypeList.Count - 1
EgtGetName(nUsedFixtureId, sUsedFixtureName)
If sUsedFixtureName = m_FixtureTypeList(Index).Name Then
Dim CurrFixtureType As FixtureType = DirectCast(m_FixtureTypeList(Index), FixtureType)
CurrFixtureType.UsedNumber += 1
Exit For
End If
Next
nUsedFixtureId = EgtGetNextFixture(nUsedFixtureId)
End While
End Sub
' Definizione comandi
Private m_cmdAdd As ICommand
Private m_cmdRemove As ICommand
#Region "COMMANDS"
#Region "AddCommand"
''' <summary>
''' Returns a command that do Done.
''' </summary>
Public ReadOnly Property AddCommand As ICommand
Get
If m_cmdAdd Is Nothing Then
m_cmdAdd = New RelayCommand(AddressOf Add)
End If
Return m_cmdAdd
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the DoneCommand.
''' </summary>
Public Sub Add(ByVal param As Object)
' resetto il messaggio di errore
m_FixtureErrorMsg = String.Empty
' verifico se è stato selezionato un sottopezzo nella lista
Dim SelectedFixture As FixtureType
If TypeOf param Is FixtureType Then
SelectedFixture = DirectCast(param, FixtureType)
Else
Return
End If
' recupero area della tavola
Dim ptTableMin As Point3d
Dim ptTableMax As Point3d
EgtGetTableArea(1, ptTableMin, ptTableMax)
' calcolo il centro della tavola
Dim ptTableMid As New Point3d((ptTableMax.x - ptTableMin.x) / 2, (ptTableMax.y - ptTableMin.y) / 2, (ptTableMax.z - ptTableMin.z) / 2)
' posiziono il nuovo sottopezzo al centro della tavola
Dim nAddedFixtureId As Integer = EgtAddFixture(SelectedFixture.Name, ptTableMid, 0, 0)
' verifico se è in una posizione valida
If Not DispositionUtility.VerifyFixturePosition(nAddedFixtureId, New Vector3d) Then
' creo un gruppo temporaneo
Dim nTempGroupId As Integer = EgtCreateGroup(GDB_ID.ROOT)
EgtSetLevel(nTempGroupId, GDB_LV.USER)
EgtSetMode(nTempGroupId, GDB_MD.STD)
' calcolo ingombro sottopezzo aggiunto
Dim bboxAddedFixture As New BBox3d
EgtGetBBoxGlob(nAddedFixtureId, GDB_BB.STANDARD, bboxAddedFixture)
' calcolo bbox tavolo
Dim bboxTableArea As New BBox3d(ptTableMin, ptTableMax)
bboxTableArea.Expand(-bboxAddedFixture.DimX / 2, -bboxAddedFixture.DimY / 2, 0)
' creo superficie delle misure della tavola
Dim nTableFrId As Integer = EgtCreateSurfFrRectangle(nTempGroupId, bboxTableArea.Min, bboxTableArea.Max)
' ciclo su tutti i pezzi di questa fase
Dim nFixtureId As Integer = EgtGetFirstFixture()
While nFixtureId <> GDB_ID.NULL
' creo il bbox del sottopezzo
Dim bboxFixture As New BBox3d
EgtGetBBoxGlob(nFixtureId, GDB_BB.STANDARD, bboxFixture)
' faccio offset del bbox del sottopezzo per includere metà del sottopezzo da aggiungere
bboxFixture.Expand(bboxAddedFixture.DimX / 2, bboxAddedFixture.DimY / 2, 0)
' lo porto all'altezza della tavola
Dim ptMinFixtureFr As New Point3d(bboxFixture.Min)
Dim ptMaxFixtureFr As New Point3d(bboxFixture.Max)
ptMinFixtureFr.z = ptTableMin.z
ptMaxFixtureFr.z = ptTableMin.z
' creo la regione occupata dal bbox del sottopezzo
Dim nFixtureFrId As Integer = EgtCreateSurfFrRectangle(nTempGroupId, ptMinFixtureFr, ptMaxFixtureFr)
' sottraggo la regione del sottopezzo da quella della tavola
Dim x = EgtSurfFrSubtract(nTableFrId, nFixtureFrId)
nFixtureId = EgtGetNextFixture(nFixtureId)
End While
' creo gruppo con i bordi della regione di tavola avanzata
Dim TableFrBorderGroupId As Integer = EgtCreateGroup(nTempGroupId)
Dim nTableFrBorderCount As Integer = 0
Dim nChunk As Integer=EgtSurfFrChunkCount(nTableFrId)
For Index = 0 To nChunk - 1
EgtExtractSurfFrChunkLoops(nTableFrId, Index, TableFrBorderGroupId, nTableFrBorderCount)
Next
' verifico se c'è almeno un bordo
If nTableFrBorderCount = 0 Then
m_FixtureErrorMsg = "Impossibile posizionare la ventosa sulla tavola"
OnPropertyChanged("FixtureErrorMsg")
Return
End If
' converto il punto medio della tavola in coordinate globali
Dim PtTableRef As Point3d
EgtGetTableRef(1, PtTableRef)
Dim frTableRef As New Frame3d(PtTableRef)
ptTableMid.ToGlob(frTableRef)
' ciclo sui bordi per trovare il punto più vicino
Dim dMinDist As Double = (bboxTableArea.Max - bboxTableArea.Min).SqLenXY
Dim ptMinAbs As Point3d
Dim BorderId As Integer = EgtGetFirstInGroup(TableFrBorderGroupId)
While BorderId <> GDB_ID.NULL
Dim dDist As Double = 0
Dim ptMinRel As Point3d
Dim nSide As Integer = 0
EgtGetMinDistPntSidePointCurve(ptTableMid, BorderId, Vector3d.Z_AX, dDist, ptMinRel, nSide)
If dDist < dMinDist Then
dMinDist = dDist
ptMinAbs = ptMinRel
End If
BorderId = EgtGetNext(BorderId)
End While
' sposto il sottopezzo nel punto trovato
Dim vtFixtureMove As Vector3d = ptMinAbs - ptTableMid
vtFixtureMove.z = 0
EgtMoveFixture(nAddedFixtureId, vtFixtureMove)
' cancello il gruppo temporaneo
EgtErase(nTempGroupId)
End If
' sottraggo la ventosa aggiunta dal conto di quelle disponibili
SelectedFixture.UsedNumber += 1
EgtDraw()
OnPropertyChanged("FixtureErrorMsg")
End Sub
#End Region ' AddCommand
#Region "RemoveCommand"
''' <summary>
''' Returns a command that do Done.
''' </summary>
Public ReadOnly Property RemoveCommand As ICommand
Get
If m_cmdRemove Is Nothing Then
m_cmdRemove = New RelayCommand(AddressOf Remove)
End If
Return m_cmdRemove
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the DoneCommand.
''' </summary>
Public Sub Remove()
Dim SelectedFixtureId As Integer = EgtGetFirstSelectedObj()
While SelectedFixtureId <> GDB_ID.NULL
Dim NextSelectedId As Integer = EgtGetNextSelectedObj()
If EgtVerifyFixture(SelectedFixtureId) Then
EgtRemoveFixture(SelectedFixtureId)
For Index = 0 To FixtureTypeList.Count - 1
Dim SelFixtureName As String = String.Empty
EgtGetName(SelectedFixtureId, SelFixtureName)
If SelFixtureName = FixtureTypeList(Index).Name Then
Dim CurrFixtureType As FixtureType = DirectCast(FixtureTypeList(Index), FixtureType)
CurrFixtureType.UsedNumber -= 1
End If
Next
End If
SelectedFixtureId = NextSelectedId
End While
EgtDraw()
End Sub
#End Region ' RemoveCommand
#End Region
End Class
End Namespace
Public Class FixtureType
Inherits FixtureListItem
Private m_TotalNumber As Integer
Private m_UsedNumber As Integer
Private m_IsEnabled As Boolean = True
Private m_IsSelected As Boolean = False
Public Property TotalNumber As Integer
Get
Return m_TotalNumber
End Get
Set(value As Integer)
If value <> m_TotalNumber Then
m_TotalNumber = value
NotifyPropertyChanged("UsedTotalRatio")
End If
End Set
End Property
Public Property UsedNumber As Integer
Get
Return m_UsedNumber
End Get
Set(value As Integer)
If value <> m_UsedNumber Then
m_UsedNumber = value
NotifyPropertyChanged("UsedTotalRatio")
If UsedNumber >= TotalNumber Then
m_IsEnabled = False
m_IsSelected = False
NotifyPropertyChanged("IsSelected")
Else
m_IsEnabled = True
End If
NotifyPropertyChanged("IsEnabled")
End If
End Set
End Property
Public ReadOnly Property UsedTotalRatio As String
Get
Return (TotalNumber - UsedNumber).ToString & " / " & TotalNumber.ToString
End Get
End Property
Public ReadOnly Property IsEnabled As Boolean
Get
Return m_IsEnabled
End Get
End Property
Public Property IsSelected As Boolean
Get
Return m_IsSelected
End Get
Set(value As Boolean)
m_IsSelected = value
End Set
End Property
Sub New(sName As String, sCat As DispositionUtility.FIX_TYPE, nTot As Integer)
MyBase.New(sName, sCat)
TotalNumber = nTot
m_IsEnabled = True
End Sub
Public Shared Function ReadFixtureTypeFromMachIni() As List(Of FixtureListItem)
' creo la lista locale
Dim FixtureTypeList As New List(Of FixtureListItem)
' aggiungo le ventose se presenti
Dim sName As String = String.Empty
Dim nTot As Integer = 0
Dim bFirst As Boolean = True
Dim nIndex As Integer = 1
While GetPrivateProfileFixture(S_FIXTURES, System.Globalization.CultureInfo.InvariantCulture.TextInfo.ToTitleCase(FIX_VAC) & nIndex, sName, nTot)
If bFirst Then
FixtureTypeList.Add(New FixtureListItem(FIX_VAC, DispositionUtility.FIX_TYPE.VACUUM))
bFirst = False
End If
FixtureTypeList.Add(New FixtureType(sName, DispositionUtility.FIX_TYPE.VACUUM, nTot))
nIndex += 1
End While
' aggiungo i riferimenti se presenti
bFirst = True
nIndex = 1
While GetPrivateProfileFixture(S_FIXTURES, FIX_REF & nIndex, sName, nTot)
If bFirst Then
FixtureTypeList.Add(New FixtureListItem(FIX_REF, DispositionUtility.FIX_TYPE.REFERENCE))
bFirst = False
End If
FixtureTypeList.Add(New FixtureType(sName, DispositionUtility.FIX_TYPE.REFERENCE, nTot))
nIndex += 1
End While
' aggiungo le morse se presenti
bFirst = True
nIndex = 1
While GetPrivateProfileFixture(S_FIXTURES, FIX_VIS & nIndex, sName, nTot)
If bFirst Then
FixtureTypeList.Add(New FixtureListItem(FIX_VIS, DispositionUtility.FIX_TYPE.VISE))
bFirst = False
End If
FixtureTypeList.Add(New FixtureType(sName, DispositionUtility.FIX_TYPE.VISE, nTot))
nIndex += 1
End While
Return FixtureTypeList
End Function
End Class
Public Class FixtureListItem
Implements INotifyPropertyChanged
Private m_Name As String
Private m_Cathegory As DispositionUtility.FIX_TYPE
Private m_Focusable As Boolean
Public Property Name As String
Get
Return m_Name
End Get
Set(value As String)
m_Name = value
End Set
End Property
Public Property Cathegory As DispositionUtility.FIX_TYPE
Get
Return m_Cathegory
End Get
Set(value As DispositionUtility.FIX_TYPE)
m_Cathegory = value
End Set
End Property
Public ReadOnly Property Focusable As Boolean
Get
Return m_Focusable
End Get
End Property
Public ReadOnly Property CathegoryName As String
Get
Select Case Cathegory
Case DispositionUtility.FIX_TYPE.VACUUM
Return "Vacuum"
Case DispositionUtility.FIX_TYPE.REFERENCE
Return "Reference"
Case DispositionUtility.FIX_TYPE.VISE
Return "Vise"
Case Else
Return String.Empty
End Select
End Get
End Property
Sub New(sName As String, Cathegory As DispositionUtility.FIX_TYPE)
Me.Name = sName
Me.Cathegory = Cathegory
If TypeOf Me Is FixtureType Then
m_Focusable = True
Else
m_Focusable = False
End If
End Sub
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Public Sub NotifyPropertyChanged(propName As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
End Sub
End Class
@@ -1,4 +1,4 @@
<UserControl x:Class="RawPartOptionView"
<UserControl x:Class="RawPartOptionV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
@@ -0,0 +1,3 @@
Public Class RawPartOptionV
End Class
@@ -0,0 +1,125 @@
Imports EgtUILib
Public Class RawPartOptionVM
Inherits ViewModelBase
Private m_MoveWithFixture As Boolean = False
Public Property MoveWithFixture As Boolean
Get
Return m_MoveWithFixture
End Get
Set(value As Boolean)
If value <> m_MoveWithFixture Then
If value Then
' Abilito la selezione di RawPart con autoselezione delle sue ventose
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPARTWITHFIXTURE)
' Seleziono le ventose associate ad uno dei grezzi selezionati
' ciclo sui grezzi selezionati
Dim nSelRawPartId As Integer = EgtGetFirstSelectedObj()
While nSelRawPartId <> GDB_ID.NULL
' seleziono i sottopezzi del grezzo
DispositionUtility.SelectRawPartFixture(nSelRawPartId)
nSelRawPartId = EgtGetNextSelectedObj()
End While
Else
' Abilito la selezione di RawPart
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPART)
' ciclo sui grezzi selezionati
Dim nSelRawPartId As Integer = EgtGetFirstSelectedObj()
While nSelRawPartId <> GDB_ID.NULL
' deseleziono i sottopezzi del grezzo
DispositionUtility.DeselectRawPartFixture(nSelRawPartId)
nSelRawPartId = EgtGetNextSelectedObj()
End While
End If
EgtDraw()
m_MoveWithFixture = value
OnPropertyChanged("MoveWithFixture")
End If
End Set
End Property
Private m_bRawPartParamVisibility As Visibility
Public ReadOnly Property RawPartParamVisibility As Visibility
Get
Return m_bRawPartParamVisibility
End Get
End Property
#Region "Messages"
Public ReadOnly Property NewMsg As String
Get
Return EgtMsg(MSG_DISPOSITION + 3)
End Get
End Property
Public ReadOnly Property RemoveMsg As String
Get
Return EgtMsg(MSG_DISPOSITION + 4)
End Get
End Property
Public ReadOnly Property LenghtMsg As String
Get
Return EgtMsg(MSG_DISPOSITION + 5)
End Get
End Property
Public ReadOnly Property WidthMsg As String
Get
Return EgtMsg(MSG_DISPOSITION + 6)
End Get
End Property
Public ReadOnly Property HeightMsg As String
Get
Return EgtMsg(MSG_DISPOSITION + 7)
End Get
End Property
Public ReadOnly Property PositionMsg As String
Get
Return EgtMsg(MSG_DISPOSITION + 8)
End Get
End Property
#End Region ' Messages
' Definizione comandi
Private m_cmdNewRawPart As ICommand
Private m_cmdRemoveRawPart As ICommand
Sub New()
If EgtGetFirstSelectedObj() <> GDB_ID.NULL Then
m_bRawPartParamVisibility = Visibility.Visible
Else
m_bRawPartParamVisibility = Visibility.Collapsed
End If
End Sub
#Region "COMMANDS"
#Region "NewRawPartCommand"
''' <summary>
''' Returns a command that do Done.
''' </summary>
Public ReadOnly Property NewRawPartCommand As ICommand
Get
If m_cmdNewRawPart Is Nothing Then
m_cmdNewRawPart = New RelayCommand(AddressOf NewRawPart)
End If
Return m_cmdNewRawPart
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the DoneCommand.
''' </summary>
Public Sub NewRawPart()
DispositionUtility.ShowParts()
m_bRawPartParamVisibility = Visibility.Visible
OnPropertyChanged("RawPartParamVisibility")
End Sub
#End Region ' NewRawPartCommand
#End Region ' Commands
End Class
@@ -1,3 +0,0 @@
Public Class RawPartOptionView
End Class
@@ -1,129 +0,0 @@
Imports EgtUILib
Namespace EgtCAM5
Public Class RawPartOptionViewModel
Inherits ViewModelBase
Private m_MoveWithFixture As Boolean = False
Public Property MoveWithFixture As Boolean
Get
Return m_MoveWithFixture
End Get
Set(value As Boolean)
If value <> m_MoveWithFixture Then
If value Then
' Abilito la selezione di RawPart con autoselezione delle sue ventose
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPARTWITHFIXTURE)
' Seleziono le ventose associate ad uno dei grezzi selezionati
' ciclo sui grezzi selezionati
Dim nSelRawPartId As Integer = EgtGetFirstSelectedObj()
While nSelRawPartId <> GDB_ID.NULL
' seleziono i sottopezzi del grezzo
DispositionUtility.SelectRawPartFixture(nSelRawPartId)
nSelRawPartId = EgtGetNextSelectedObj()
End While
Else
' Abilito la selezione di RawPart
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPART)
' ciclo sui grezzi selezionati
Dim nSelRawPartId As Integer = EgtGetFirstSelectedObj()
While nSelRawPartId <> GDB_ID.NULL
' deseleziono i sottopezzi del grezzo
DispositionUtility.DeselectRawPartFixture(nSelRawPartId)
nSelRawPartId = EgtGetNextSelectedObj()
End While
End If
EgtDraw()
m_MoveWithFixture = value
OnPropertyChanged("MoveWithFixture")
End If
End Set
End Property
Private m_bRawPartParamVisibility As Visibility
Public ReadOnly Property RawPartParamVisibility As Visibility
Get
Return m_bRawPartParamVisibility
End Get
End Property
#Region "Messages"
Public ReadOnly Property NewMsg As String
Get
Return EgtMsg(MSG_DISPOSITION + 3)
End Get
End Property
Public ReadOnly Property RemoveMsg As String
Get
Return EgtMsg(MSG_DISPOSITION + 4)
End Get
End Property
Public ReadOnly Property LenghtMsg As String
Get
Return EgtMsg(MSG_DISPOSITION + 5)
End Get
End Property
Public ReadOnly Property WidthMsg As String
Get
Return EgtMsg(MSG_DISPOSITION + 6)
End Get
End Property
Public ReadOnly Property HeightMsg As String
Get
Return EgtMsg(MSG_DISPOSITION + 7)
End Get
End Property
Public ReadOnly Property PositionMsg As String
Get
Return EgtMsg(MSG_DISPOSITION + 8)
End Get
End Property
#End Region ' Messages
' Definizione comandi
Private m_cmdNewRawPart As ICommand
Private m_cmdRemoveRawPart As ICommand
Sub New()
If EgtGetFirstSelectedObj() <> GDB_ID.NULL Then
m_bRawPartParamVisibility = Visibility.Visible
Else
m_bRawPartParamVisibility = Visibility.Collapsed
End If
End Sub
#Region "COMMANDS"
#Region "NewRawPartCommand"
''' <summary>
''' Returns a command that do Done.
''' </summary>
Public ReadOnly Property NewRawPartCommand As ICommand
Get
If m_cmdNewRawPart Is Nothing Then
m_cmdNewRawPart = New RelayCommand(AddressOf NewRawPart)
End If
Return m_cmdNewRawPart
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the DoneCommand.
''' </summary>
Public Sub NewRawPart()
DispositionUtility.ShowParts()
m_bRawPartParamVisibility = Visibility.Visible
OnPropertyChanged("RawPartParamVisibility")
End Sub
#End Region ' NewRawPartCommand
#End Region ' Commands
End Class
End Namespace
@@ -1,4 +1,4 @@
<UserControl x:Class="MachiningParameterExpanderView"
<UserControl x:Class="MachiningParameterExpanderV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
@@ -1,7 +1,7 @@
Imports EgtWPFLib5
Imports EgtWPFLib5.EgtFloating
Public Class MachiningParameterExpanderView
Public Class MachiningParameterExpanderV
Private EgtFloatingTray As EgtFloatingTray
Private EgtFloatingPanel As EgtFloatingPanel
@@ -1,4 +1,4 @@
<UserControl x:Class="OperationExpanderView"
<UserControl x:Class="OperationExpanderV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
@@ -1,7 +1,7 @@
Imports EgtWPFLib5
Imports EgtWPFLib5.EgtFloating
Public Class OperationExpanderView
Public Class OperationExpanderV
Private EgtFloatingTray As EgtFloatingTray
Private OptionPanelView As UserControl
@@ -0,0 +1,853 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Public Class OperationExpanderVM
Inherits ViewModelBase
' Modalità di aggiunta attiva/disattiva
Private m_NewMachining As Boolean = False
Private Sub StartNewMachining()
m_NewMachining = True
' Smarco la geometria eventualmente marcata
If Not IsNothing(m_LastMarkedOperationId) Then EgtResetMark(EgtGetFirstNameInGroup(m_LastMarkedOperationId, MCH_MGR_CL))
' Deseleziono eventuali geometrie selezionate
EgtDeselectAll()
EgtDraw()
' Blocco la lista operazioni
IsEnabledOperationList = False
' Abilito la selezione delle geometrie da lavorare
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.MACHINING)
' Abilito la selezione di curve e superfici
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.PARTCURVESANDSURFACES)
' Abilito ed apro l'expander con l'albero delle lavorazioni
Application.Msn.NotifyColleagues(Application.MACHININGTREEVIEWEXPANDERISENABLED, True)
End Sub
Private Sub EndNewMachining(SelOpId As Integer)
' Deseleziono eventuali geometrie selezionate
EgtDeselectAll()
EgtDraw()
' Sblocco la lista operazioni
IsEnabledOperationList = True
' Disabilito e chiudo l'expander con l'albero delle lavorazioni
Application.Msn.NotifyColleagues(Application.MACHININGTREEVIEWEXPANDERISENABLED, False)
' Disabilito la selezione
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.NULL)
' Disabilito la selezione di curve e superfici del pezzo
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.NULL)
' Apro i parametri della lavorazione aggiunta
If SelOpId <> GDB_ID.NULL Then
For Index = 0 To OperationList.Count - 1
If OperationList(Index).Id = SelOpId Then
SelectedOperation = OperationList(Index)
End If
Next
End If
ParametersIsExpanded = True
m_NewMachining = False
End Sub
Private m_NewPositioning As Boolean = False
' Ultima lavorazione evidenziata
Private m_LastMarkedOperationId As Integer = GDB_ID.NULL
'Expander aperto tra quelli presenti nel MachiningOptionPanel
Private m_CurrExpandedExpander As MachiningOptionPanelExpander = MachiningOptionPanelExpander.OPERATIONLIST
Friend Enum MachiningOptionPanelExpander
OPERATIONLIST
OPERATIONPARAMETERS
SIMULATION
End Enum
Private m_OperViewIsEnabled As Boolean = True
Public Property OperViewIsEnabled As Boolean
Get
Return m_OperViewIsEnabled
End Get
Set(value As Boolean)
m_OperViewIsEnabled = value
OnPropertyChanged("OperViewIsEnabled")
End Set
End Property
Private m_ListIsExpanded As Boolean
Public Property ListIsExpanded As Boolean
Get
Return m_ListIsExpanded
End Get
Set(value As Boolean)
If value <> m_ListIsExpanded Then
m_ListIsExpanded = value
If value Then
If m_CurrExpandedExpander = MachiningOptionPanelExpander.OPERATIONPARAMETERS Then
ParametersIsExpanded = False
ElseIf m_CurrExpandedExpander = MachiningOptionPanelExpander.SIMULATION Then
Application.Msn.NotifyColleagues(Application.SIMULATIONEXPANDER_SET_ISEXPANDED, False)
End If
m_CurrExpandedExpander = MachiningOptionPanelExpander.OPERATIONLIST
End If
OnPropertyChanged("ListIsExpanded")
End If
End Set
End Property
Private m_ParametersIsExpanded As Boolean
Public Property ParametersIsExpanded As Boolean
Get
Return m_ParametersIsExpanded
End Get
Set(value As Boolean)
If value <> m_ParametersIsExpanded Then
m_ParametersIsExpanded = value
If value Then
If m_CurrExpandedExpander = MachiningOptionPanelExpander.OPERATIONLIST Then
ListIsExpanded = False
ElseIf m_CurrExpandedExpander = MachiningOptionPanelExpander.SIMULATION Then
m_CurrExpandedExpander = MachiningOptionPanelExpander.OPERATIONPARAMETERS
Application.Msn.NotifyColleagues(Application.SIMULATIONEXPANDER_SET_ISEXPANDED, False)
End If
m_CurrExpandedExpander = MachiningOptionPanelExpander.OPERATIONPARAMETERS
If IsValidDispositionType(SelectedOperation.m_Type) Then
ParametersExpanderName = m_SelectedOperation.Name
' Abilito la selezione di tutti i tipi di geometria
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.ALL)
' Verifico se c'è un grezzo nella disposizione corrente
Dim bFirstRaw As Boolean = True
Dim nRawPartId As Integer = EgtGetFirstRawPart()
While nRawPartId <> GDB_ID.NULL
If EgtVerifyRawPartCurrPhase(nRawPartId) Then
bFirstRaw = False
Exit While
End If
nRawPartId = EgtGetNextRawPart(nRawPartId)
End While
' Lancio funzione che inizializza la disposizione
m_OpenDispositionFunction(bFirstRaw)
' Nascondo tutte le lavorazioni
Dim nOpId As Integer = EgtGetFirstOperation()
While nOpId <> GDB_ID.NULL
If IsValidMachiningType(EgtGetOperationType(nOpId)) Then
EgtSetOperationStatus(nOpId, False)
End If
nOpId = EgtGetNextOperation(nOpId)
End While
EgtDraw()
ElseIf IsValidMachiningType(SelectedOperation.m_Type) Then
' Leggo il tipo di operazione per impostare il tipo di selezione
EgtSetCurrMachining(SelectedOperation.m_Id)
Dim sOpMach As String = String.Empty
EgtGetMachiningParam(MCH_MP.NAME, sOpMach)
ParametersExpanderName = m_SelectedOperation.Name & " (" & sOpMach & ")"
Dim OperationType As Integer = -1
EgtGetMachiningParam(MCH_MP.TYPE, OperationType)
' Abilito la selezione delle lavorazioni
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.MACHINING)
' Abilito la selezione dei giusti tipi di geometria
Select Case OperationType
Case MCH_OY.SAWING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomSawing)
Case MCH_OY.DRILLING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomDrilling)
Case MCH_OY.MILLING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomMilling)
Case MCH_OY.POCKETING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomPocketing)
Case MCH_OY.MORTISING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomMortising)
Case MCH_OY.SAWROUGHING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomSawRoughing)
Case MCH_OY.SAWFINISHING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomSawFinishing)
Case MCH_OY.GENMACHINING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomGenMachining)
Case MCH_OY.CHISELING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomChiseling)
End Select
' Imposto visualizzazione utensile
DirectCast(m_MachiningParameterExpander.DataContext, MachiningParameterExpanderVM).ViewTool = True
End If
Else
If m_CurrExpandedExpander = MachiningOptionPanelExpander.OPERATIONLIST Then
ListIsExpanded = True
End If
If SelectedOperation.m_Type = MCH_OY.DISP Then
' Visualizzo tutte le lavorazioni della fase corrente
Dim nCurrPhase = EgtGetCurrPhase()
Dim nOpId As Integer = EgtGetFirstOperation()
While nOpId <> GDB_ID.NULL
If IsValidMachiningType(EgtGetOperationType(nOpId)) Then
EgtSetOperationStatus(nOpId, (EgtGetOperationPhase(nOpId) = nCurrPhase))
End If
nOpId = EgtGetNextOperation(nOpId)
End While
EgtDraw()
Else
' Nascondo visualizzazione utensile
DirectCast(m_MachiningParameterExpander.DataContext, MachiningParameterExpanderVM).ViewTool = False
End If
ParametersExpanderName = String.Empty
' Disabilito la selezione delle lavorazioni
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.NULL)
' Resetto il tipo di selezione
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.NULL)
End If
OnPropertyChanged("ParametersIsExpanded")
End If
Application.Msn.NotifyColleagues(Application.EMITTITLE)
End Set
End Property
Private m_ParametersExpanderName As String
Public Property ParametersExpanderName As String
Get
If String.IsNullOrEmpty(m_ParametersExpanderName) Then
Return EgtMsg(MSG_OPERATION + 2)
Else
Return m_ParametersExpanderName
End If
End Get
Set(value As String)
If value <> m_ParametersExpanderName Then
m_ParametersExpanderName = value
End If
OnPropertyChanged("ParametersExpanderName")
End Set
End Property
Private m_IsEnabledOperationList As Boolean = True
Public Property IsEnabledOperationList As Boolean
Get
Return m_IsEnabledOperationList
End Get
Set(value As Boolean)
If value <> m_IsEnabledOperationList Then
m_IsEnabledOperationList = value
OnPropertyChanged("IsEnabledOperationList")
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)
If Not IsNothing(value) Then
' Verifico se c'è l'operazione precedente
If m_LastMarkedOperationId <> GDB_ID.NULL Then
' La de-evidenzio
Dim bEnabModif As Boolean = EgtGetEnableModified()
EgtDisableModified()
EgtResetMark(EgtGetFirstNameInGroup(m_LastMarkedOperationId, MCH_MGR_CL))
If bEnabModif Then EgtEnableModified()
' Ne deseleziono la geometria
EgtDeselectAll()
End If
' Imposto la fase di lavorazione corrente
EgtSetCurrPhase(EgtGetOperationPhase(value.Id))
' Verifico se l'operazione è una disposizione
If EgtGetOperationType(value.Id) = MCH_OY.DISP Then
'' Abilito la selezione delle Fixture
'Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.FIXTURE)
'' Abilito la selezione di tutti i tipi di geometria
'Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.ALL)
' L'operazione è una lavorazione
Else
'' Disabilito la selezione di qualunque cosa
'Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.NULL)
' Imposto come corrente la lavorazione(operazione) selezionata
EgtSetCurrMachining(value.Id)
' Evidenzio la lavorazione(operazione) selezionata
'EgtSetMark(value.Id)
Dim bEnabModif As Boolean = EgtGetEnableModified()
EgtDisableModified()
EgtSetMark(EgtGetFirstNameInGroup(value.Id, MCH_MGR_CL))
If bEnabModif Then EgtEnableModified()
' Seleziono la geometria della lavorazione
Dim CountIndex = 0
Dim EntityIndex As Integer = 0
Dim SubEntityIndex As Integer = 0 ' Nell'interfaccia non si usa ma devo comunque definirla perchè la funzione la restituisce obbligatoriamente
While EgtGetMachiningGeometry(CountIndex, EntityIndex, SubEntityIndex)
EgtSelectObj(EntityIndex)
IniFile.m_LastSubEntityId = SubEntityIndex
CountIndex += 1
End While
' La salvo come ultima operazione selezionata
m_LastMarkedOperationId = value.Id
End If
m_SelectedOperation = value
' Notifico al contentcontrol OperationParameter di aggiornarsi
OnPropertyChanged("OperationParameters")
' Notifico l'operazione selezionata all'expander con l'albero delle lavorazioni aggiungibili
Application.Msn.NotifyColleagues(Application.SELECTEDOPERATION, value)
' Aggiorno visualizzazione
EgtDraw()
End If
'OnPropertyChanged("ToolExpanderHeader")
OnPropertyChanged("SelectedOperation")
End Set
End Property
' Actions
Private m_UpdateParamValues As Action
Private m_OpenDispositionFunction As Action(Of Boolean)
Private m_MachiningParameterExpander As MachiningParameterExpanderV
Private m_DispositionParameterExpander As DispositionParameterExpanderV
Public ReadOnly Property OperationParameters As ContentControl
Get
If m_SelectedOperation.m_Type = MCH_OY.DISP Then
If IsNothing(m_DispositionParameterExpander) Then
m_DispositionParameterExpander = New DispositionParameterExpanderV
m_DispositionParameterExpander.DataContext = New DispositionParameterExpanderVM(m_OpenDispositionFunction)
End If
Return m_DispositionParameterExpander
Else
If IsNothing(m_MachiningParameterExpander) Then
m_MachiningParameterExpander = New MachiningParameterExpanderV
m_MachiningParameterExpander.DataContext = New MachiningParameterExpanderVM(m_UpdateParamValues)
End If
m_UpdateParamValues()
Return m_MachiningParameterExpander
End If
End Get
End Property
#Region "Messages"
Public ReadOnly Property OperationListHeader As String
Get
Return EgtMsg(MSG_OPERATION + 1)
End Get
End Property
Public ReadOnly Property NewMachiningBtnContent As String
Get
Return EgtMsg(MSG_OPERATION + 4)
End Get
End Property
Public ReadOnly Property NewPositioningBtnContent As String
Get
Return EgtMsg(MSG_OPERATION + 5)
End Get
End Property
Public ReadOnly Property CancelOperationBtnContent As String
Get
Return EgtMsg(MSG_OPERATION + 6)
End Get
End Property
Public ReadOnly Property MoveUpMsg As String
Get
Return EgtMsg(MSG_OPERATION + 8)
End Get
End Property
Public ReadOnly Property MoveDownMsg As String
Get
Return EgtMsg(MSG_OPERATION + 9)
End Get
End Property
Public ReadOnly Property UpdateMsg As String
Get
Return EgtMsg(MSG_OPERATION + 10)
End Get
End Property
Public ReadOnly Property SetUpMsg As String
Get
Return EgtMsg(MSG_SETUP + 1)
End Get
End Property
#End Region ' Messages
' Definizione comandi
Private m_cmdNewMachining As ICommand
Private m_cmdNewPositioning As ICommand
Private m_cmdCancelOperation As ICommand
Private m_cmdOperationListDoubleClick As ICommand
Private m_cmdMoveUp As ICommand
Private m_cmdMoveDown As ICommand
Private m_cmdUpdate As ICommand
Private m_cmdSetUp As ICommand
Sub New()
Me.ListIsExpanded = True
Application.Msn.Register(Application.LOADOPERATIONLIST, Sub(nSelectedOperation As Integer)
LoadOperationList()
SelectOperation(nSelectedOperation)
ListIsExpanded = True
End Sub)
Application.Msn.Register(Application.REMOVEMARKFROMLASTOPERATION, Sub()
EgtResetMark(EgtGetFirstNameInGroup(m_LastMarkedOperationId, MCH_MGR_CL))
End Sub)
Application.Msn.Register(Application.NEWMACHININGMODEISACTIVE, Sub(Params As NewMachOpParam)
If Params.bActive Then
StartNewMachining()
Else
EndNewMachining(Params.SelMachOpId)
End If
End Sub)
Application.Msn.Register(Application.OPERATIONVIEWEXPANDERISENABLED, Sub(bEnable As Boolean)
OperViewIsEnabled = bEnable
End Sub)
Application.Msn.Register(Application.SIMULATIONEXPANDER_GET_ISEXPANDED, Sub(bValue As Boolean)
If m_CurrExpandedExpander = MachiningOptionPanelExpander.SIMULATION Then
ListIsExpanded = True
End If
If bValue Then
If m_NewMachining Then EndNewMachining(GDB_ID.NULL)
ListIsExpanded = False
ParametersIsExpanded = False
m_CurrExpandedExpander = MachiningOptionPanelExpander.SIMULATION
Else
' Deseleziono e riseleziono la lavorazione corrente per fargli riselezionare la geometria
' di lavorazione che è stata deselezionata dalla simulazione
Dim CurrSelectedOperation As OperationListBoxItem
CurrSelectedOperation = SelectedOperation
SelectedOperation = Nothing
SelectedOperation = CurrSelectedOperation
End If
End Sub)
Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub()
' Annullo creazione nuova lavorazione
If m_NewMachining Then EndNewMachining(GDB_ID.NULL)
' Disabilito visualizzazione utensile
If Not IsNothing(m_MachiningParameterExpander) Then
DirectCast(m_MachiningParameterExpander.DataContext, MachiningParameterExpanderVM).ViewTool = False
End If
End Sub)
Application.Msn.Register(Application.CANCELOPERATIONCOMMAND, Sub()
CancelOperation(String.Empty)
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 NewMachiningCmd)
End If
Return m_cmdNewMachining
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub NewMachiningCmd(ByVal param As Object)
StartNewMachining()
End Sub
#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)
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)
' Recupero grezzi e bloccaggi dell'ultima fase
Dim nLastPhase As Integer = EgtGetPhaseCount()
EgtSetCurrPhase(nLastPhase)
Dim vRawId As New List(Of Integer)
Dim nRawId As Integer = EgtGetFirstRawPart()
While nRawId <> GDB_ID.NULL
If EgtVerifyRawPartPhase(nRawId, nLastPhase) Then
vRawId.Add(nRawId)
End If
nRawId = EgtGetNextRawPart(nRawId)
End While
Dim vFxtId As New List(Of Integer)
Dim nFxtId As Integer = EgtGetFirstFixture()
While nFxtId <> GDB_ID.NULL
vFxtId.Add(nFxtId)
nFxtId = EgtGetNextFixture(nFxtId)
End While
' Aggiungo la nuova fase
Dim nPhase As Integer = EgtAddPhase()
Dim nDispId As Integer = EgtGetPhaseDisposition(nPhase)
' Confermo grezzi e bloccaggi sopra salvati
For Each nId As Integer In vRawId
EgtKeepRawPart(nId, nLastPhase)
Next
For Each nId As Integer In vFxtId
EgtKeepFixture(nId, nLastPhase)
Next
' Ricarico la lista delle operazioni
Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, nDispId)
End Sub
#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)
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)
' Se viene premuto il tasto Esc
If DirectCast(param, String) = "Escape" Then
If m_NewMachining Then
EndNewMachining(GDB_ID.NULL)
ListIsExpanded = True
End If
Return
End If
' Se sto inserendo una nuova lavorazione
If m_NewMachining Then
EndNewMachining(GDB_ID.NULL)
ListIsExpanded = True
' altrimenti sto cancellandone una vecchia
Else
If Not IsNothing(SelectedOperation) Then
' Salvo indice operazione precedente a selezionata
Dim nPrevOperId As Integer = EgtGetPrevOperation(SelectedOperation.Id)
If SelectedOperation.Type = MCH_OY.DISP Then
' Posso cancellare solo l'ultima disposizione
If EgtGetOperationPhase(SelectedOperation.Id) = EgtGetPhaseCount() Then
EgtRemoveLastPhase()
Else
Return
End If
Else
' Smarco e deseleziono la geometria selezionata
EgtResetMark(EgtGetFirstNameInGroup(m_LastMarkedOperationId, MCH_MGR_CL))
EgtDeselectAll()
EgtDraw()
' Rimuovo l'operazione selezionata
EgtRemoveOperation(SelectedOperation.Id)
End If
' Ricarico la lista delle operazioni
Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, nPrevOperId)
End If
Application.Msn.NotifyColleagues(Application.EMITTITLE)
End If
End Sub
#End Region ' CancelOperationCommand
#Region "OperationListDoubleClickCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property OperationListDoubleClickCommand As ICommand
Get
If m_cmdOperationListDoubleClick Is Nothing Then
m_cmdOperationListDoubleClick = New RelayCommand(AddressOf OperationListDoubleClick)
End If
Return m_cmdOperationListDoubleClick
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub OperationListDoubleClick()
If EgtGetOperationMode(SelectedOperation.Id) Then
ParametersIsExpanded = True
End If
End Sub
#End Region ' OperationListDoubleClickCommand
#Region "MoveUpCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property MoveUpCommand As ICommand
Get
If m_cmdMoveUp Is Nothing Then
m_cmdMoveUp = New RelayCommand(AddressOf MoveUp)
End If
Return m_cmdMoveUp
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub MoveUp()
If Not IsNothing(SelectedOperation) Then
' Verifico se l'entità selezionata è una lavorazione o una disposizione,
' se è una disposizione esco perchè non si possono spostare
If SelectedOperation.Type = MCH_OY.DISP Then Return
' Trovo indice dell'entità selezionata
Dim SelectedIndex As Integer = OperationList.IndexOf(SelectedOperation)
' Posso spostare solo se la precedente non è una disposizione (per non cambiare fase)
If OperationList(SelectedIndex - 1).Type = MCH_OY.DISP Then Return
' Recupero Id entità selezionata e precedente a quella selezionata
Dim SelectedId As Integer = OperationList(SelectedIndex).Id
Dim PreviousId As Integer = OperationList(SelectedIndex - 1).Id
' Sposto l'operazione selezionata nell'ambiente Egt
If EgtRelocate(SelectedId, PreviousId, GDB_POS.BEFORE) Then
' Sposto l'operazione selezionata nella grafica
OperationList.Move(SelectedIndex, SelectedIndex - 1)
' Ricalcolo la lavorazione selezionata e la precedente
EgtSetCurrMachining(PreviousId)
EgtApplyMachining(False)
EgtSetCurrMachining(SelectedId)
EgtApplyMachining(False)
EgtDraw()
End If
Application.Msn.NotifyColleagues(Application.EMITTITLE)
End If
End Sub
#End Region ' MoveUpCommand
#Region "MoveDownCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property MoveDownCommand As ICommand
Get
If m_cmdMoveDown Is Nothing Then
m_cmdMoveDown = New RelayCommand(AddressOf MoveDown)
End If
Return m_cmdMoveDown
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub MoveDown()
If Not IsNothing(SelectedOperation) Then
' Verifico se l'entità selezionata è una lavorazione o una disposizione,
' se è una disposizione esco perchè non si possono spostare
If SelectedOperation.Type = MCH_OY.DISP Then Return
' Trovo indice dell'entità selezionata
Dim SelectedIndex As Integer = OperationList.IndexOf(SelectedOperation)
' Verifico che l'indice sia < della lunghezza della lista delle operazioni,altrimenti è già ultima e quindi non la posso spostare
If SelectedIndex > OperationList.Count - 2 Then Return
' Posso spostare solo se la successiva non è una disposizione (per non cambiare fase)
If OperationList(SelectedIndex + 1).Type = MCH_OY.DISP Then Return
' Recupero Id entitàselezionata e successiva a quella selezionata
Dim SelectedId As Integer = OperationList(SelectedIndex).Id
Dim PostId As Integer = OperationList(SelectedIndex + 1).Id
' Sposto l'operazione selezionata nell'ambiente Egt
If EgtRelocate(SelectedId, PostId, GDB_POS.AFTER) Then
' Sposto l'operazione selezionata nella grafica
OperationList.Move(SelectedIndex, SelectedIndex + 1)
' Ricalcolo la lavorazione selezionata e la successiva
EgtSetCurrMachining(SelectedId)
EgtApplyMachining(False)
EgtSetCurrMachining(PostId)
EgtApplyMachining(False)
EgtDraw()
End If
Application.Msn.NotifyColleagues(Application.EMITTITLE)
End If
End Sub
#End Region ' MoveDownCommand
#Region "UpdateCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property UpdateCommand As ICommand
Get
If m_cmdUpdate Is Nothing Then
m_cmdUpdate = New RelayCommand(AddressOf Update)
End If
Return m_cmdUpdate
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Update()
' Cursore di attesa
Application.Current.MainWindow.ForceCursor = True
Application.Current.MainWindow.Cursor = Cursors.Wait
' Eseguo ricalcolo
Dim bRecalc As Boolean = ((Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift)
Dim sErr As String = String.Empty
Dim bOk As Boolean = EgtApplyAllMachinings(bRecalc, False, sErr)
EgtSetModified()
' Aggiorno visualizzazione e ritorno a cursore standard
EgtDraw()
Application.Current.MainWindow.ForceCursor = False
Application.Current.MainWindow.Cursor = Cursors.Arrow
' In caso di errori, li segnalo
If Not bOk Then
If Not String.IsNullOrEmpty(sErr) Then
MessageBox.Show(sErr, EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Exclamation)
Else
MessageBox.Show(EgtMsg(MSG_SIMULATION + 6), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Error)
End If
Else
Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, EgtMsg(MSG_OPERATION + 11))
End If
Application.Msn.NotifyColleagues(Application.EMITTITLE)
End Sub
#End Region ' UpdateCommand
#Region "SetUpCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property SetUpCommand As ICommand
Get
If m_cmdSetUp Is Nothing Then
m_cmdSetUp = New RelayCommand(AddressOf SetUp)
End If
Return m_cmdSetUp
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub SetUp()
' verifico che il file di configurazione attrezzaggio (lua) della macchina esista
If Not File.Exists(IniFile.m_sCurrMachScriptsDirPath & "\" & SETUP_LUA) Then
EgtOutLog("SetUp error: SetUp configuration file doesn't exist ")
MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 7), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
' carico Lua che contiene le funzioni per ottenere le posizioni valide dell'utensile selezionato,
' e testa e uscita dell'utensile attrezzato
EgtLuaExecFile(IniFile.m_sCurrMachScriptsDirPath & "\" & SETUP_LUA)
' verifico che le teste riportate in configurazione esistano
Dim Index As Integer = 1
Dim nErr As Integer = 0
While nErr = 0
Dim sHead As String = String.Empty
nErr = 999
EgtLuaSetGlobIntVar("STU.INDEX", Index)
EgtLuaCallFunction("STU.GetTcPosHeadGroupFromPos")
' Leggo variabili
EgtLuaGetGlobStringVar("STU.HEAD", sHead)
EgtLuaGetGlobIntVar("STU.ERR", nErr)
If nErr = 0 Then
If EgtGetHeadExitCount(sHead) = 0 Then
MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 8), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
End If
Index += 1
End While
' creo ed apro finestra SetUp
Dim SetUpWindow As New SetUpWindowV
SetUpWindow.Height = 614
SetUpWindow.Width = 1024
SetUpWindow.DataContext = New SetUpWindowVM
SetUpWindow.Owner = Application.Current.MainWindow
SetUpWindow.ShowDialog()
Application.Msn.NotifyColleagues(Application.EMITTITLE)
End Sub
#End Region ' SetUpCommand
#End Region ' Commands
#Region "METHODS"
Private Sub LoadOperationList()
OperationList.Clear()
Dim Id As Integer
Dim OpStatus As Boolean = True
Dim OpName As String = String.Empty
Dim OpType As Integer = 0
Dim OpTool As String = String.Empty
Dim OpMach As String = String.Empty
Id = EgtGetFirstOperation()
While Id <> GDB_ID.NULL
EgtGetOperationName(Id, OpName)
OpType = EgtGetOperationType(Id)
If IsValidMachiningType(OpType) Then
EgtSetCurrMachining(Id)
OpStatus = EgtGetOperationMode(Id)
EgtGetMachiningParam(MCH_MP.TOOL, OpTool)
EgtGetMachiningParam(MCH_MP.NAME, OpMach)
OperationList.Add(New MachiningOpListBoxItem(Id, OpStatus, OpName, OpType, OpTool, OpMach))
ElseIf IsValidDispositionType(OpType) Then
OpStatus = True
OpTool = String.Empty
OpMach = String.Empty
OperationList.Add(New DispositionOpListBoxItem(Id, OpName, OpType))
End If
Id = EgtGetNextOperation(Id)
End While
End Sub
Private Sub SelectOperation(nSelectedOperation As Integer)
If nSelectedOperation < 0 Then
SelectedOperation = OperationList(0)
Else
Dim OperationFound = False
For Each Operation In OperationList
If Operation.Id = nSelectedOperation Then
OperationFound = True
SelectedOperation = Operation
Exit For
End If
Next
If Not OperationFound Then
SelectedOperation = OperationList(0)
End If
End If
End Sub
#End Region ' Methods
End Class
@@ -1,857 +0,0 @@
Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Namespace EgtCAM5
Public Class OperationExpanderViewModel
Inherits ViewModelBase
' Modalità di aggiunta attiva/disattiva
Private m_NewMachining As Boolean = False
Private Sub StartNewMachining()
m_NewMachining = True
' Smarco la geometria eventualmente marcata
If Not IsNothing(m_LastMarkedOperationId) Then EgtResetMark(EgtGetFirstNameInGroup(m_LastMarkedOperationId, MCH_MGR_CL))
' Deseleziono eventuali geometrie selezionate
EgtDeselectAll()
EgtDraw()
' Blocco la lista operazioni
IsEnabledOperationList = False
' Abilito la selezione delle geometrie da lavorare
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.MACHINING)
' Abilito la selezione di curve e superfici
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.PARTCURVESANDSURFACES)
' Abilito ed apro l'expander con l'albero delle lavorazioni
Application.Msn.NotifyColleagues(Application.MACHININGTREEVIEWEXPANDERISENABLED, True)
End Sub
Private Sub EndNewMachining(SelOpId As Integer)
' Deseleziono eventuali geometrie selezionate
EgtDeselectAll()
EgtDraw()
' Sblocco la lista operazioni
IsEnabledOperationList = True
' Disabilito e chiudo l'expander con l'albero delle lavorazioni
Application.Msn.NotifyColleagues(Application.MACHININGTREEVIEWEXPANDERISENABLED, False)
' Disabilito la selezione
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.NULL)
' Disabilito la selezione di curve e superfici del pezzo
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.NULL)
' Apro i parametri della lavorazione aggiunta
If SelOpId <> GDB_ID.NULL Then
For Index = 0 To OperationList.Count - 1
If OperationList(Index).Id = SelOpId Then
SelectedOperation = OperationList(Index)
End If
Next
End If
ParametersIsExpanded = True
m_NewMachining = False
End Sub
Private m_NewPositioning As Boolean = False
' Ultima lavorazione evidenziata
Private m_LastMarkedOperationId As Integer = GDB_ID.NULL
'Expander aperto tra quelli presenti nel MachiningOptionPanel
Private m_CurrExpandedExpander As MachiningOptionPanelExpander = MachiningOptionPanelExpander.OPERATIONLIST
Friend Enum MachiningOptionPanelExpander
OPERATIONLIST
OPERATIONPARAMETERS
SIMULATION
End Enum
Private m_OperViewIsEnabled As Boolean = True
Public Property OperViewIsEnabled As Boolean
Get
Return m_OperViewIsEnabled
End Get
Set(value As Boolean)
m_OperViewIsEnabled = value
OnPropertyChanged("OperViewIsEnabled")
End Set
End Property
Private m_ListIsExpanded As Boolean
Public Property ListIsExpanded As Boolean
Get
Return m_ListIsExpanded
End Get
Set(value As Boolean)
If value <> m_ListIsExpanded Then
m_ListIsExpanded = value
If value Then
If m_CurrExpandedExpander = MachiningOptionPanelExpander.OPERATIONPARAMETERS Then
ParametersIsExpanded = False
ElseIf m_CurrExpandedExpander = MachiningOptionPanelExpander.SIMULATION Then
Application.Msn.NotifyColleagues(Application.SIMULATIONEXPANDER_SET_ISEXPANDED, False)
End If
m_CurrExpandedExpander = MachiningOptionPanelExpander.OPERATIONLIST
End If
OnPropertyChanged("ListIsExpanded")
End If
End Set
End Property
Private m_ParametersIsExpanded As Boolean
Public Property ParametersIsExpanded As Boolean
Get
Return m_ParametersIsExpanded
End Get
Set(value As Boolean)
If value <> m_ParametersIsExpanded Then
m_ParametersIsExpanded = value
If value Then
If m_CurrExpandedExpander = MachiningOptionPanelExpander.OPERATIONLIST Then
ListIsExpanded = False
ElseIf m_CurrExpandedExpander = MachiningOptionPanelExpander.SIMULATION Then
m_CurrExpandedExpander = MachiningOptionPanelExpander.OPERATIONPARAMETERS
Application.Msn.NotifyColleagues(Application.SIMULATIONEXPANDER_SET_ISEXPANDED, False)
End If
m_CurrExpandedExpander = MachiningOptionPanelExpander.OPERATIONPARAMETERS
If IsValidDispositionType(SelectedOperation.m_Type) Then
ParametersExpanderName = m_SelectedOperation.Name
' Abilito la selezione di tutti i tipi di geometria
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.ALL)
' Verifico se c'è un grezzo nella disposizione corrente
Dim bFirstRaw As Boolean = True
Dim nRawPartId As Integer = EgtGetFirstRawPart()
While nRawPartId <> GDB_ID.NULL
If EgtVerifyRawPartCurrPhase(nRawPartId) Then
bFirstRaw = False
Exit While
End If
nRawPartId = EgtGetNextRawPart(nRawPartId)
End While
' Lancio funzione che inizializza la disposizione
m_OpenDispositionFunction(bFirstRaw)
' Nascondo tutte le lavorazioni
Dim nOpId As Integer = EgtGetFirstOperation()
While nOpId <> GDB_ID.NULL
If IsValidMachiningType(EgtGetOperationType(nOpId)) Then
EgtSetOperationStatus(nOpId, False)
End If
nOpId = EgtGetNextOperation(nOpId)
End While
EgtDraw()
ElseIf IsValidMachiningType(SelectedOperation.m_Type) Then
' Leggo il tipo di operazione per impostare il tipo di selezione
EgtSetCurrMachining(SelectedOperation.m_Id)
Dim sOpMach As String = String.Empty
EgtGetMachiningParam(MCH_MP.NAME, sOpMach)
ParametersExpanderName = m_SelectedOperation.Name & " (" & sOpMach & ")"
Dim OperationType As Integer = -1
EgtGetMachiningParam(MCH_MP.TYPE, OperationType)
' Abilito la selezione delle lavorazioni
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.MACHINING)
' Abilito la selezione dei giusti tipi di geometria
Select Case OperationType
Case MCH_OY.SAWING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomSawing)
Case MCH_OY.DRILLING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomDrilling)
Case MCH_OY.MILLING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomMilling)
Case MCH_OY.POCKETING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomPocketing)
Case MCH_OY.MORTISING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomMortising)
Case MCH_OY.SAWROUGHING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomSawRoughing)
Case MCH_OY.SAWFINISHING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomSawFinishing)
Case MCH_OY.GENMACHINING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomGenMachining)
Case MCH_OY.CHISELING
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, OptionModule.m_SelGeomChiseling)
End Select
' Imposto visualizzazione utensile
DirectCast(m_MachiningParameterExpander.DataContext, MachiningParameterExpanderViewModel).ViewTool = True
End If
Else
If m_CurrExpandedExpander = MachiningOptionPanelExpander.OPERATIONLIST Then
ListIsExpanded = True
End If
If SelectedOperation.m_Type = MCH_OY.DISP Then
' Visualizzo tutte le lavorazioni della fase corrente
Dim nCurrPhase = EgtGetCurrPhase()
Dim nOpId As Integer = EgtGetFirstOperation()
While nOpId <> GDB_ID.NULL
If IsValidMachiningType(EgtGetOperationType(nOpId)) Then
EgtSetOperationStatus(nOpId, (EgtGetOperationPhase(nOpId) = nCurrPhase))
End If
nOpId = EgtGetNextOperation(nOpId)
End While
EgtDraw()
Else
' Nascondo visualizzazione utensile
DirectCast(m_MachiningParameterExpander.DataContext, MachiningParameterExpanderViewModel).ViewTool = False
End If
ParametersExpanderName = String.Empty
' Disabilito la selezione delle lavorazioni
Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.NULL)
' Resetto il tipo di selezione
Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.NULL)
End If
OnPropertyChanged("ParametersIsExpanded")
End If
Application.Msn.NotifyColleagues(Application.EMITTITLE)
End Set
End Property
Private m_ParametersExpanderName As String
Public Property ParametersExpanderName As String
Get
If String.IsNullOrEmpty(m_ParametersExpanderName) Then
Return EgtMsg(MSG_OPERATION + 2)
Else
Return m_ParametersExpanderName
End If
End Get
Set(value As String)
If value <> m_ParametersExpanderName Then
m_ParametersExpanderName = value
End If
OnPropertyChanged("ParametersExpanderName")
End Set
End Property
Private m_IsEnabledOperationList As Boolean = True
Public Property IsEnabledOperationList As Boolean
Get
Return m_IsEnabledOperationList
End Get
Set(value As Boolean)
If value <> m_IsEnabledOperationList Then
m_IsEnabledOperationList = value
OnPropertyChanged("IsEnabledOperationList")
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)
If Not IsNothing(value) Then
' Verifico se c'è l'operazione precedente
If m_LastMarkedOperationId <> GDB_ID.NULL Then
' La de-evidenzio
Dim bEnabModif As Boolean = EgtGetEnableModified()
EgtDisableModified()
EgtResetMark(EgtGetFirstNameInGroup(m_LastMarkedOperationId, MCH_MGR_CL))
If bEnabModif Then EgtEnableModified()
' Ne deseleziono la geometria
EgtDeselectAll()
End If
' Imposto la fase di lavorazione corrente
EgtSetCurrPhase(EgtGetOperationPhase(value.Id))
' Verifico se l'operazione è una disposizione
If EgtGetOperationType(value.Id) = MCH_OY.DISP Then
'' Abilito la selezione delle Fixture
'Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.FIXTURE)
'' Abilito la selezione di tutti i tipi di geometria
'Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.ALL)
' L'operazione è una lavorazione
Else
'' Disabilito la selezione di qualunque cosa
'Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.NULL)
' Imposto come corrente la lavorazione(operazione) selezionata
EgtSetCurrMachining(value.Id)
' Evidenzio la lavorazione(operazione) selezionata
'EgtSetMark(value.Id)
Dim bEnabModif As Boolean = EgtGetEnableModified()
EgtDisableModified()
EgtSetMark(EgtGetFirstNameInGroup(value.Id, MCH_MGR_CL))
If bEnabModif Then EgtEnableModified()
' Seleziono la geometria della lavorazione
Dim CountIndex = 0
Dim EntityIndex As Integer = 0
Dim SubEntityIndex As Integer = 0 ' Nell'interfaccia non si usa ma devo comunque definirla perchè la funzione la restituisce obbligatoriamente
While EgtGetMachiningGeometry(CountIndex, EntityIndex, SubEntityIndex)
EgtSelectObj(EntityIndex)
IniFile.m_LastSubEntityId = SubEntityIndex
CountIndex += 1
End While
' La salvo come ultima operazione selezionata
m_LastMarkedOperationId = value.Id
End If
m_SelectedOperation = value
' Notifico al contentcontrol OperationParameter di aggiornarsi
OnPropertyChanged("OperationParameters")
' Notifico l'operazione selezionata all'expander con l'albero delle lavorazioni aggiungibili
Application.Msn.NotifyColleagues(Application.SELECTEDOPERATION, value)
' Aggiorno visualizzazione
EgtDraw()
End If
'OnPropertyChanged("ToolExpanderHeader")
OnPropertyChanged("SelectedOperation")
End Set
End Property
' Actions
Private m_UpdateParamValues As Action
Private m_OpenDispositionFunction As Action(Of Boolean)
Private m_MachiningParameterExpander As MachiningParameterExpanderView
Private m_DispositionParameterExpander As DispositionParameterExpanderView
Public ReadOnly Property OperationParameters As ContentControl
Get
If m_SelectedOperation.m_Type = MCH_OY.DISP Then
If IsNothing(m_DispositionParameterExpander) Then
m_DispositionParameterExpander = New DispositionParameterExpanderView
m_DispositionParameterExpander.DataContext = New DispositionParameterExpanderViewModel(m_OpenDispositionFunction)
End If
Return m_DispositionParameterExpander
Else
If IsNothing(m_MachiningParameterExpander) Then
m_MachiningParameterExpander = New MachiningParameterExpanderView
m_MachiningParameterExpander.DataContext = New MachiningParameterExpanderViewModel(m_UpdateParamValues)
End If
m_UpdateParamValues()
Return m_MachiningParameterExpander
End If
End Get
End Property
#Region "Messages"
Public ReadOnly Property OperationListHeader As String
Get
Return EgtMsg(MSG_OPERATION + 1)
End Get
End Property
Public ReadOnly Property NewMachiningBtnContent As String
Get
Return EgtMsg(MSG_OPERATION + 4)
End Get
End Property
Public ReadOnly Property NewPositioningBtnContent As String
Get
Return EgtMsg(MSG_OPERATION + 5)
End Get
End Property
Public ReadOnly Property CancelOperationBtnContent As String
Get
Return EgtMsg(MSG_OPERATION + 6)
End Get
End Property
Public ReadOnly Property MoveUpMsg As String
Get
Return EgtMsg(MSG_OPERATION + 8)
End Get
End Property
Public ReadOnly Property MoveDownMsg As String
Get
Return EgtMsg(MSG_OPERATION + 9)
End Get
End Property
Public ReadOnly Property UpdateMsg As String
Get
Return EgtMsg(MSG_OPERATION + 10)
End Get
End Property
Public ReadOnly Property SetUpMsg As String
Get
Return EgtMsg(MSG_SETUP + 1)
End Get
End Property
#End Region ' Messages
' Definizione comandi
Private m_cmdNewMachining As ICommand
Private m_cmdNewPositioning As ICommand
Private m_cmdCancelOperation As ICommand
Private m_cmdOperationListDoubleClick As ICommand
Private m_cmdMoveUp As ICommand
Private m_cmdMoveDown As ICommand
Private m_cmdUpdate As ICommand
Private m_cmdSetUp As ICommand
Sub New()
Me.ListIsExpanded = True
Application.Msn.Register(Application.LOADOPERATIONLIST, Sub(nSelectedOperation As Integer)
LoadOperationList()
SelectOperation(nSelectedOperation)
ListIsExpanded = True
End Sub)
Application.Msn.Register(Application.REMOVEMARKFROMLASTOPERATION, Sub()
EgtResetMark(EgtGetFirstNameInGroup(m_LastMarkedOperationId, MCH_MGR_CL))
End Sub)
Application.Msn.Register(Application.NEWMACHININGMODEISACTIVE, Sub(Params As NewMachOpParam)
If Params.bActive Then
StartNewMachining()
Else
EndNewMachining(Params.SelMachOpId)
End If
End Sub)
Application.Msn.Register(Application.OPERATIONVIEWEXPANDERISENABLED, Sub(bEnable As Boolean)
OperViewIsEnabled = bEnable
End Sub)
Application.Msn.Register(Application.SIMULATIONEXPANDER_GET_ISEXPANDED, Sub(bValue As Boolean)
If m_CurrExpandedExpander = MachiningOptionPanelExpander.SIMULATION Then
ListIsExpanded = True
End If
If bValue Then
If m_NewMachining Then EndNewMachining(GDB_ID.NULL)
ListIsExpanded = False
ParametersIsExpanded = False
m_CurrExpandedExpander = MachiningOptionPanelExpander.SIMULATION
Else
' Deseleziono e riseleziono la lavorazione corrente per fargli riselezionare la geometria
' di lavorazione che è stata deselezionata dalla simulazione
Dim CurrSelectedOperation As OperationListBoxItem
CurrSelectedOperation = SelectedOperation
SelectedOperation = Nothing
SelectedOperation = CurrSelectedOperation
End If
End Sub)
Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub()
' Annullo creazione nuova lavorazione
If m_NewMachining Then EndNewMachining(GDB_ID.NULL)
' Disabilito visualizzazione utensile
If Not IsNothing(m_MachiningParameterExpander) Then
DirectCast(m_MachiningParameterExpander.DataContext, MachiningParameterExpanderViewModel).ViewTool = False
End If
End Sub)
Application.Msn.Register(Application.CANCELOPERATIONCOMMAND, Sub()
CancelOperation(String.Empty)
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 NewMachiningCmd)
End If
Return m_cmdNewMachining
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub NewMachiningCmd(ByVal param As Object)
StartNewMachining()
End Sub
#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)
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)
' Recupero grezzi e bloccaggi dell'ultima fase
Dim nLastPhase As Integer = EgtGetPhaseCount()
EgtSetCurrPhase(nLastPhase)
Dim vRawId As New List(Of Integer)
Dim nRawId As Integer = EgtGetFirstRawPart()
While nRawId <> GDB_ID.NULL
If EgtVerifyRawPartPhase(nRawId, nLastPhase) Then
vRawId.Add(nRawId)
End If
nRawId = EgtGetNextRawPart(nRawId)
End While
Dim vFxtId As New List(Of Integer)
Dim nFxtId As Integer = EgtGetFirstFixture()
While nFxtId <> GDB_ID.NULL
vFxtId.Add(nFxtId)
nFxtId = EgtGetNextFixture(nFxtId)
End While
' Aggiungo la nuova fase
Dim nPhase As Integer = EgtAddPhase()
Dim nDispId As Integer = EgtGetPhaseDisposition(nPhase)
' Confermo grezzi e bloccaggi sopra salvati
For Each nId As Integer In vRawId
EgtKeepRawPart(nId, nLastPhase)
Next
For Each nId As Integer In vFxtId
EgtKeepFixture(nId, nLastPhase)
Next
' Ricarico la lista delle operazioni
Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, nDispId)
End Sub
#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)
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)
' Se viene premuto il tasto Esc
If DirectCast(param, String) = "Escape" Then
If m_NewMachining Then
EndNewMachining(GDB_ID.NULL)
ListIsExpanded = True
End If
Return
End If
' Se sto inserendo una nuova lavorazione
If m_NewMachining Then
EndNewMachining(GDB_ID.NULL)
ListIsExpanded = True
' altrimenti sto cancellandone una vecchia
Else
If Not IsNothing(SelectedOperation) Then
' Salvo indice operazione precedente a selezionata
Dim nPrevOperId As Integer = EgtGetPrevOperation(SelectedOperation.Id)
If SelectedOperation.Type = MCH_OY.DISP Then
' Posso cancellare solo l'ultima disposizione
If EgtGetOperationPhase(SelectedOperation.Id) = EgtGetPhaseCount() Then
EgtRemoveLastPhase()
Else
Return
End If
Else
' Smarco e deseleziono la geometria selezionata
EgtResetMark(EgtGetFirstNameInGroup(m_LastMarkedOperationId, MCH_MGR_CL))
EgtDeselectAll()
EgtDraw()
' Rimuovo l'operazione selezionata
EgtRemoveOperation(SelectedOperation.Id)
End If
' Ricarico la lista delle operazioni
Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, nPrevOperId)
End If
Application.Msn.NotifyColleagues(Application.EMITTITLE)
End If
End Sub
#End Region ' CancelOperationCommand
#Region "OperationListDoubleClickCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property OperationListDoubleClickCommand As ICommand
Get
If m_cmdOperationListDoubleClick Is Nothing Then
m_cmdOperationListDoubleClick = New RelayCommand(AddressOf OperationListDoubleClick)
End If
Return m_cmdOperationListDoubleClick
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub OperationListDoubleClick()
If EgtGetOperationMode(SelectedOperation.Id) Then
ParametersIsExpanded = True
End If
End Sub
#End Region ' OperationListDoubleClickCommand
#Region "MoveUpCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property MoveUpCommand As ICommand
Get
If m_cmdMoveUp Is Nothing Then
m_cmdMoveUp = New RelayCommand(AddressOf MoveUp)
End If
Return m_cmdMoveUp
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub MoveUp()
If Not IsNothing(SelectedOperation) Then
' Verifico se l'entità selezionata è una lavorazione o una disposizione,
' se è una disposizione esco perchè non si possono spostare
If SelectedOperation.Type = MCH_OY.DISP Then Return
' Trovo indice dell'entità selezionata
Dim SelectedIndex As Integer = OperationList.IndexOf(SelectedOperation)
' Posso spostare solo se la precedente non è una disposizione (per non cambiare fase)
If OperationList(SelectedIndex - 1).Type = MCH_OY.DISP Then Return
' Recupero Id entità selezionata e precedente a quella selezionata
Dim SelectedId As Integer = OperationList(SelectedIndex).Id
Dim PreviousId As Integer = OperationList(SelectedIndex - 1).Id
' Sposto l'operazione selezionata nell'ambiente Egt
If EgtRelocate(SelectedId, PreviousId, GDB_POS.BEFORE) Then
' Sposto l'operazione selezionata nella grafica
OperationList.Move(SelectedIndex, SelectedIndex - 1)
' Ricalcolo la lavorazione selezionata e la precedente
EgtSetCurrMachining(PreviousId)
EgtApplyMachining(False)
EgtSetCurrMachining(SelectedId)
EgtApplyMachining(False)
EgtDraw()
End If
Application.Msn.NotifyColleagues(Application.EMITTITLE)
End If
End Sub
#End Region ' MoveUpCommand
#Region "MoveDownCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property MoveDownCommand As ICommand
Get
If m_cmdMoveDown Is Nothing Then
m_cmdMoveDown = New RelayCommand(AddressOf MoveDown)
End If
Return m_cmdMoveDown
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub MoveDown()
If Not IsNothing(SelectedOperation) Then
' Verifico se l'entità selezionata è una lavorazione o una disposizione,
' se è una disposizione esco perchè non si possono spostare
If SelectedOperation.Type = MCH_OY.DISP Then Return
' Trovo indice dell'entità selezionata
Dim SelectedIndex As Integer = OperationList.IndexOf(SelectedOperation)
' Verifico che l'indice sia < della lunghezza della lista delle operazioni,altrimenti è già ultima e quindi non la posso spostare
If SelectedIndex > OperationList.Count - 2 Then Return
' Posso spostare solo se la successiva non è una disposizione (per non cambiare fase)
If OperationList(SelectedIndex + 1).Type = MCH_OY.DISP Then Return
' Recupero Id entitàselezionata e successiva a quella selezionata
Dim SelectedId As Integer = OperationList(SelectedIndex).Id
Dim PostId As Integer = OperationList(SelectedIndex + 1).Id
' Sposto l'operazione selezionata nell'ambiente Egt
If EgtRelocate(SelectedId, PostId, GDB_POS.AFTER) Then
' Sposto l'operazione selezionata nella grafica
OperationList.Move(SelectedIndex, SelectedIndex + 1)
' Ricalcolo la lavorazione selezionata e la successiva
EgtSetCurrMachining(SelectedId)
EgtApplyMachining(False)
EgtSetCurrMachining(PostId)
EgtApplyMachining(False)
EgtDraw()
End If
Application.Msn.NotifyColleagues(Application.EMITTITLE)
End If
End Sub
#End Region ' MoveDownCommand
#Region "UpdateCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property UpdateCommand As ICommand
Get
If m_cmdUpdate Is Nothing Then
m_cmdUpdate = New RelayCommand(AddressOf Update)
End If
Return m_cmdUpdate
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Update()
' Cursore di attesa
Application.Current.MainWindow.ForceCursor = True
Application.Current.MainWindow.Cursor = Cursors.Wait
' Eseguo ricalcolo
Dim bRecalc As Boolean = ((Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift)
Dim sErr As String = String.Empty
Dim bOk As Boolean = EgtApplyAllMachinings(bRecalc, False, sErr)
EgtSetModified()
' Aggiorno visualizzazione e ritorno a cursore standard
EgtDraw()
Application.Current.MainWindow.ForceCursor = False
Application.Current.MainWindow.Cursor = Cursors.Arrow
' In caso di errori, li segnalo
If Not bOk Then
If Not String.IsNullOrEmpty(sErr) Then
MessageBox.Show(sErr, EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Exclamation)
Else
MessageBox.Show(EgtMsg(MSG_SIMULATION + 6), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Error)
End If
Else
Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, EgtMsg(MSG_OPERATION + 11))
End If
Application.Msn.NotifyColleagues(Application.EMITTITLE)
End Sub
#End Region ' UpdateCommand
#Region "SetUpCommand"
''' <summary>
''' Returns a command that do Point.
''' </summary>
Public ReadOnly Property SetUpCommand As ICommand
Get
If m_cmdSetUp Is Nothing Then
m_cmdSetUp = New RelayCommand(AddressOf SetUp)
End If
Return m_cmdSetUp
End Get
End Property
''' <summary>
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub SetUp()
' verifico che il file di configurazione attrezzaggio (lua) della macchina esista
If Not File.Exists(IniFile.m_sCurrMachScriptsDirPath & "\" & SETUP_LUA) Then
EgtOutLog("SetUp error: SetUp configuration file doesn't exist ")
MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 7), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
' carico Lua che contiene le funzioni per ottenere le posizioni valide dell'utensile selezionato,
' e testa e uscita dell'utensile attrezzato
EgtLuaExecFile(IniFile.m_sCurrMachScriptsDirPath & "\" & SETUP_LUA)
' verifico che le teste riportate in configurazione esistano
Dim Index As Integer = 1
Dim nErr As Integer = 0
While nErr = 0
Dim sHead As String = String.Empty
nErr = 999
EgtLuaSetGlobIntVar("STU.INDEX", Index)
EgtLuaCallFunction("STU.GetTcPosHeadGroupFromPos")
' Leggo variabili
EgtLuaGetGlobStringVar("STU.HEAD", sHead)
EgtLuaGetGlobIntVar("STU.ERR", nErr)
If nErr = 0 Then
If EgtGetHeadExitCount(sHead) = 0 Then
MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 8), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Return
End If
End If
Index += 1
End While
' creo ed apro finestra SetUp
Dim SetUpWindow As New SetUpWindowV
SetUpWindow.Height = 614
SetUpWindow.Width = 1024
SetUpWindow.DataContext = New SetUpWindowVM
SetUpWindow.Owner = Application.Current.MainWindow
SetUpWindow.ShowDialog()
Application.Msn.NotifyColleagues(Application.EMITTITLE)
End Sub
#End Region ' SetUpCommand
#End Region ' Commands
#Region "METHODS"
Private Sub LoadOperationList()
OperationList.Clear()
Dim Id As Integer
Dim OpStatus As Boolean = True
Dim OpName As String = String.Empty
Dim OpType As Integer = 0
Dim OpTool As String = String.Empty
Dim OpMach As String = String.Empty
Id = EgtGetFirstOperation()
While Id <> GDB_ID.NULL
EgtGetOperationName(Id, OpName)
OpType = EgtGetOperationType(Id)
If IsValidMachiningType(OpType) Then
EgtSetCurrMachining(Id)
OpStatus = EgtGetOperationMode(Id)
EgtGetMachiningParam(MCH_MP.TOOL, OpTool)
EgtGetMachiningParam(MCH_MP.NAME, OpMach)
OperationList.Add(New MachiningOpListBoxItem(Id, OpStatus, OpName, OpType, OpTool, OpMach))
ElseIf IsValidDispositionType(OpType) Then
OpStatus = True
OpTool = String.Empty
OpMach = String.Empty
OperationList.Add(New DispositionOpListBoxItem(Id, OpName, OpType))
End If
Id = EgtGetNextOperation(Id)
End While
End Sub
Private Sub SelectOperation(nSelectedOperation As Integer)
If nSelectedOperation < 0 Then
SelectedOperation = OperationList(0)
Else
Dim OperationFound = False
For Each Operation In OperationList
If Operation.Id = nSelectedOperation Then
OperationFound = True
SelectedOperation = Operation
Exit For
End If
Next
If Not OperationFound Then
SelectedOperation = OperationList(0)
End If
End If
End Sub
#End Region ' Methods
End Class
End Namespace
@@ -1,4 +1,4 @@
<UserControl x:Class="SimulationExpanderView"
<UserControl x:Class="SimulationExpanderV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
@@ -1,3 +1,3 @@
Public Class SimulationExpanderView
Public Class SimulationExpanderV
End Class
File diff suppressed because it is too large Load Diff
+79 -83
View File
@@ -1,96 +1,92 @@
Imports EgtUILib
Namespace EgtCAM5
Public Class OptionPanelVM
Inherits ViewModelBase
Public Class OptionPanelVM
Inherits ViewModelBase
Private m_DrawIsChecked As Boolean = True
Private m_DrawIsChecked As Boolean = True
Private m_MachiningIsChecked As Boolean = False
Private m_MachiningIsChecked As Boolean = False
' 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
Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, -1)
Return m_OperationExpander
' GRAPHICAL ELEMENTS
Private m_OperationExpander As OperationExpanderV
Private m_ManageLayerExpander As ManageLayerExpanderV
Public ReadOnly Property ManageLayerExpander As ContentControl
Get
If m_DrawIsChecked Then
If IsNothing(m_ManageLayerExpander) Then
m_ManageLayerExpander = New ManageLayerExpanderV
m_ManageLayerExpander.DataContext = New ManageLayerExpanderVM
End If
End Get
End Property
Private m_MachiningsTreeExpander As MachiningTreeExpanderView
Private m_InfoExpander As InfoExpanderView
Public ReadOnly Property InfoExpander As ContentControl
Get
If m_DrawIsChecked Then
If IsNothing(m_InfoExpander) Then
m_InfoExpander = New InfoExpanderView
m_InfoExpander.DataContext = New InfoExpanderViewModel
End If
Return m_InfoExpander
Else
If IsNothing(m_MachiningsTreeExpander) Then
m_MachiningsTreeExpander = New MachiningTreeExpanderView
m_MachiningsTreeExpander.DataContext = New MachiningTreeExpanderViewModel
End If
Return m_MachiningsTreeExpander
Return m_ManageLayerExpander
Else
If IsNothing(m_OperationExpander) Then
m_OperationExpander = New OperationExpanderV
m_OperationExpander.DataContext = New OperationExpanderVM
End If
End Get
End Property
Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, -1)
Return m_OperationExpander
End If
End Get
End Property
Private m_SimulationExpander As SimulationExpanderView
Private m_InputExpander As InputExpanderView
Public ReadOnly Property InputExpander As ContentControl
Get
If m_DrawIsChecked Then
If IsNothing(m_InputExpander) Then
m_InputExpander = New InputExpanderView
m_InputExpander.DataContext = New InputExpanderViewModel
End If
Return m_InputExpander
Else
If IsNothing(m_SimulationExpander) Then
m_SimulationExpander = New SimulationExpanderView
m_SimulationExpander.DataContext = New SimulationExpanderViewModel
End If
Return m_SimulationExpander
Private m_MachiningsTreeExpander As MachiningTreeExpanderV
Private m_InfoExpander As InfoExpanderV
Public ReadOnly Property InfoExpander As ContentControl
Get
If m_DrawIsChecked Then
If IsNothing(m_InfoExpander) Then
m_InfoExpander = New InfoExpanderV
m_InfoExpander.DataContext = New InfoExpanderVM
End If
End Get
End Property
Return m_InfoExpander
Else
If IsNothing(m_MachiningsTreeExpander) Then
m_MachiningsTreeExpander = New MachiningTreeExpanderV
m_MachiningsTreeExpander.DataContext = New MachiningTreeExpanderVM
End If
Return m_MachiningsTreeExpander
End If
End Get
End Property
Sub New()
Application.Msn.Register(Application.MACHININGMODE_ISCHECKED, Sub()
m_DrawIsChecked = False
m_MachiningIsChecked = True
EgtZoom(ZM.ALL, False)
OnPropertyChanged("ManageLayerExpander")
OnPropertyChanged("InfoExpander")
OnPropertyChanged("InputExpander")
End Sub)
Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub()
m_DrawIsChecked = True
m_MachiningIsChecked = False
Application.Msn.NotifyColleagues(Application.SIMULATIONEXPANDER_SET_ISEXPANDED, False)
OnPropertyChanged("ManageLayerExpander")
OnPropertyChanged("InfoExpander")
OnPropertyChanged("InputExpander")
End Sub)
Private m_SimulationExpander As SimulationExpanderV
Private m_InputExpander As InputExpanderV
Public ReadOnly Property InputExpander As ContentControl
Get
If m_DrawIsChecked Then
If IsNothing(m_InputExpander) Then
m_InputExpander = New InputExpanderV
m_InputExpander.DataContext = New InputExpanderVM
End If
Return m_InputExpander
Else
If IsNothing(m_SimulationExpander) Then
m_SimulationExpander = New SimulationExpanderV
m_SimulationExpander.DataContext = New SimulationExpanderVM
End If
Return m_SimulationExpander
End If
End Get
End Property
End Sub
Sub New()
Application.Msn.Register(Application.MACHININGMODE_ISCHECKED, Sub()
m_DrawIsChecked = False
m_MachiningIsChecked = True
EgtZoom(ZM.ALL, False)
OnPropertyChanged("ManageLayerExpander")
OnPropertyChanged("InfoExpander")
OnPropertyChanged("InputExpander")
End Sub)
Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub()
m_DrawIsChecked = True
m_MachiningIsChecked = False
Application.Msn.NotifyColleagues(Application.SIMULATIONEXPANDER_SET_ISEXPANDED, False)
OnPropertyChanged("ManageLayerExpander")
OnPropertyChanged("InfoExpander")
OnPropertyChanged("InputExpander")
End Sub)
End Class
End Sub
End Namespace
End Class
+142 -146
View File
@@ -1,139 +1,137 @@
Imports System.Collections.ObjectModel
Imports EgtUILib
Namespace EgtCAM5
Public Class OptionWindowVM
Public Class OptionWindowVM
Public ReadOnly Property LanguageList As ObservableCollection(Of Language)
Get
Return OptionModule.m_LanguageList
End Get
End Property
Public ReadOnly Property LanguageList As ObservableCollection(Of Language)
Get
Return OptionModule.m_LanguageList
End Get
End Property
Private m_GeomTypeList As ObservableCollection(Of SceneSelModeOpt) = New ObservableCollection(Of SceneSelModeOpt)({SceneSelModeOpt.PARTCURVES, SceneSelModeOpt.PARTSURFACES, SceneSelModeOpt.PARTCURVESANDSURFACES})
Public ReadOnly Property GeomTypeList As ObservableCollection(Of SceneSelModeOpt)
Get
Return m_GeomTypeList
End Get
End Property
Private m_GeomTypeList As ObservableCollection(Of SceneSelModeOpt) = New ObservableCollection(Of SceneSelModeOpt)({SceneSelModeOpt.PARTCURVES, SceneSelModeOpt.PARTSURFACES, SceneSelModeOpt.PARTCURVESANDSURFACES})
Public ReadOnly Property GeomTypeList As ObservableCollection(Of SceneSelModeOpt)
Get
Return m_GeomTypeList
End Get
End Property
Public Property SelectedLanguage As Language
Get
Return OptionModule.m_SelectedLanguage
End Get
Set(value As Language)
If value IsNot OptionModule.m_SelectedLanguage Then
OptionModule.m_SelectedLanguage = value
WritePrivateProfileString(S_GENERAL, K_MESSAGES, m_SelectedLanguage.Name)
End If
End Set
End Property
Public Property SelectedLanguage As Language
Get
Return OptionModule.m_SelectedLanguage
End Get
Set(value As Language)
If value IsNot OptionModule.m_SelectedLanguage Then
OptionModule.m_SelectedLanguage = value
WritePrivateProfileString(S_GENERAL, K_MESSAGES, m_SelectedLanguage.Name)
End If
End Set
End Property
Public Property SelectedMillingGeomType As SceneSelModeOpt
Get
Return OptionModule.m_SelGeomMilling
End Get
Set(value As SceneSelModeOpt)
If WritePrivateProfileString(S_MACH, K_SELGEOMMILLING, CInt(value).ToString()) Then
OptionModule.m_SelGeomMilling = value
End If
End Set
End Property
Public Property SelectedDrillingGeomType As SceneSelModeOpt
Get
Return OptionModule.m_SelGeomDrilling
End Get
Set(value As SceneSelModeOpt)
If WritePrivateProfileString(S_MACH, K_SELGEOMDRILLING, CInt(value).ToString()) Then
OptionModule.m_SelGeomDrilling = value
End If
End Set
End Property
Public Property SelectedSawingGeomType As SceneSelModeOpt
Get
Return OptionModule.m_SelGeomSawing
End Get
Set(value As SceneSelModeOpt)
If WritePrivateProfileString(S_MACH, K_SELGEOMSAWING, CInt(value).ToString()) Then
OptionModule.m_SelGeomSawing = value
End If
End Set
End Property
Public Property SelectedMillingGeomType As SceneSelModeOpt
Get
Return OptionModule.m_SelGeomMilling
End Get
Set(value As SceneSelModeOpt)
If WritePrivateProfileString(S_MACH, K_SELGEOMMILLING, CInt(value).ToString()) Then
OptionModule.m_SelGeomMilling = value
End If
End Set
End Property
Public Property SelectedDrillingGeomType As SceneSelModeOpt
Get
Return OptionModule.m_SelGeomDrilling
End Get
Set(value As SceneSelModeOpt)
If WritePrivateProfileString(S_MACH, K_SELGEOMDRILLING, CInt(value).ToString()) Then
OptionModule.m_SelGeomDrilling = value
End If
End Set
End Property
Public Property SelectedSawingGeomType As SceneSelModeOpt
Get
Return OptionModule.m_SelGeomSawing
End Get
Set(value As SceneSelModeOpt)
If WritePrivateProfileString(S_MACH, K_SELGEOMSAWING, CInt(value).ToString()) Then
OptionModule.m_SelGeomSawing = value
End If
End Set
End Property
Public Property NewMachiningIsLastOne As Boolean
Get
Return m_bNewMachiningIsLastOne
End Get
Set(value As Boolean)
m_bNewMachiningIsLastOne = value
WritePrivateProfileString(S_OPTIONS, K_NEWMACHININGISLASTONE, If(value, 1, 0).ToString)
End Set
End Property
Public Property NewMachiningIsLastOne As Boolean
Get
Return m_bNewMachiningIsLastOne
End Get
Set(value As Boolean)
m_bNewMachiningIsLastOne = value
WritePrivateProfileString(S_OPTIONS, K_NEWMACHININGISLASTONE, If(value, 1, 0).ToString)
End Set
End Property
Public Property UseDispositionScript As Boolean
Get
Return m_bUseDispositionScript
End Get
Set(value As Boolean)
m_bUseDispositionScript = value
WritePrivateProfileString(S_OPTIONS, K_USEDISPOSITIONSCRIPT, If(value, 1, 0).ToString)
End Set
End Property
Public Property UseDispositionScript As Boolean
Get
Return m_bUseDispositionScript
End Get
Set(value As Boolean)
m_bUseDispositionScript = value
WritePrivateProfileString(S_OPTIONS, K_USEDISPOSITIONSCRIPT, If(value, 1, 0).ToString)
End Set
End Property
' Definizione comandi
Private m_cmdCloseOptions As ICommand
' Definizione comandi
Private m_cmdCloseOptions As ICommand
#Region "Messages"
Public ReadOnly Property Title As String
Get
Return EgtMsg(MSG_MAINWINDOW + 5)
End Get
End Property
Public ReadOnly Property Title As String
Get
Return EgtMsg(MSG_MAINWINDOW + 5)
End Get
End Property
Public ReadOnly Property CurrentLanguageMsg As String
Get
Return EgtMsg(MSG_OPTIONPAGE + 1)
End Get
End Property
Public ReadOnly Property LanguageAdvertMsg As String
Get
Return EgtMsg(MSG_OPTIONPAGE + 2)
End Get
End Property
Public ReadOnly Property MachiningSelGeomMsg As String
Get
Return EgtMsg(MSG_OPTIONPAGE + 6)
End Get
End Property
Public ReadOnly Property GeomTypeMillingMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 3)
End Get
End Property
Public ReadOnly Property GeomTypeDrillingMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 1)
End Get
End Property
Public ReadOnly Property GeomTypeSawingMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 2)
End Get
End Property
Public ReadOnly Property CurrentLanguageMsg As String
Get
Return EgtMsg(MSG_OPTIONPAGE + 1)
End Get
End Property
Public ReadOnly Property LanguageAdvertMsg As String
Get
Return EgtMsg(MSG_OPTIONPAGE + 2)
End Get
End Property
Public ReadOnly Property MachiningSelGeomMsg As String
Get
Return EgtMsg(MSG_OPTIONPAGE + 6)
End Get
End Property
Public ReadOnly Property GeomTypeMillingMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 3)
End Get
End Property
Public ReadOnly Property GeomTypeDrillingMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 1)
End Get
End Property
Public ReadOnly Property GeomTypeSawingMsg As String
Get
Return EgtMsg(MSG_MACHININGSDBPAGE + 2)
End Get
End Property
Public ReadOnly Property NewMachiningPosMsg As String
Get
Return EgtMsg(MSG_OPTIONPAGE + 7)
End Get
End Property
Public ReadOnly Property NewMachiningPosMsg As String
Get
Return EgtMsg(MSG_OPTIONPAGE + 7)
End Get
End Property
Public ReadOnly Property UseDispositionScriptMsg As String
Get
Return EgtMsg(MSG_OPTIONPAGE + 8)
End Get
End Property
Public ReadOnly Property UseDispositionScriptMsg As String
Get
Return EgtMsg(MSG_OPTIONPAGE + 8)
End Get
End Property
#End Region
@@ -141,38 +139,36 @@ Namespace EgtCAM5
#Region "CloseOptionsCommand"
''' <summary>
''' Returns a command that remove the current selected machining.
''' </summary>
Public ReadOnly Property CloseOptionsCommand() As ICommand
Get
If m_cmdCloseOptions Is Nothing Then
m_cmdCloseOptions = New RelayCommand(AddressOf CloseOptions)
End If
Return m_cmdCloseOptions
End Get
End Property
''' <summary>
''' Returns a command that remove the current selected machining.
''' </summary>
Public ReadOnly Property CloseOptionsCommand() As ICommand
Get
If m_cmdCloseOptions Is Nothing Then
m_cmdCloseOptions = New RelayCommand(AddressOf CloseOptions)
End If
Return m_cmdCloseOptions
End Get
End Property
''' <summary>
''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand.
''' </summary>
Public Sub CloseOptions()
' Chiusura finestra
For Each Window In Application.Current.Windows
If TypeOf Window Is OptionWindowV Then
Dim OptionsWindow As OptionWindowV = DirectCast(Window, OptionWindowV)
OptionsWindow.Close()
End If
Next
End Sub
''' <summary>
''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand.
''' </summary>
Public Sub CloseOptions()
' Chiusura finestra
For Each Window In Application.Current.Windows
If TypeOf Window Is OptionWindowV Then
Dim OptionsWindow As OptionWindowV = DirectCast(Window, OptionWindowV)
OptionsWindow.Close()
End If
Next
End Sub
#End Region ' CloseOptionsCommand
#End Region ' COMMANDS
End Class
End Namespace
End Class
Public Class GeomTypeConverter
Implements IValueConverter
+124 -128
View File
@@ -1,46 +1,44 @@
Imports EgtUILib
Namespace EgtCAM5
Public Class PopUpGridPanelVM
Inherits ViewModelBase
Public Class PopUpGridPanelVM
Inherits ViewModelBase
#Region "FIELDS & PROPERTIES"
' Definizione comandi
Private m_cmdCPlaneView As ICommand
Private m_cmdCPlaneRotate As ICommand
Private m_cmdCPlane3P As ICommand
Private m_cmdCPlanePerpObj As ICommand
Private m_cmdCPlaneObj As ICommand
' Definizione comandi
Private m_cmdCPlaneView As ICommand
Private m_cmdCPlaneRotate As ICommand
Private m_cmdCPlane3P As ICommand
Private m_cmdCPlanePerpObj As ICommand
Private m_cmdCPlaneObj As ICommand
#Region "ToolTip"
Public ReadOnly Property CPlaneViewToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 25)
End Get
End Property
Public ReadOnly Property CPlaneRotateToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 28)
End Get
End Property
Public ReadOnly Property CPlane3PointsToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 29)
End Get
End Property
Public ReadOnly Property CPlanePerpCurveToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 30)
End Get
End Property
Public ReadOnly Property CPlaneObjectToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 31)
End Get
End Property
Public ReadOnly Property CPlaneViewToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 25)
End Get
End Property
Public ReadOnly Property CPlaneRotateToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 28)
End Get
End Property
Public ReadOnly Property CPlane3PointsToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 29)
End Get
End Property
Public ReadOnly Property CPlanePerpCurveToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 30)
End Get
End Property
Public ReadOnly Property CPlaneObjectToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 31)
End Get
End Property
#End Region ' ToolTip
@@ -50,126 +48,124 @@ Namespace EgtCAM5
#Region "CPlaneViewCommand"
''' <summary>
''' Returns a command that do CPlaneView.
''' </summary>
Public ReadOnly Property CPlaneViewCommand As ICommand
Get
If m_cmdCPlaneView Is Nothing Then
m_cmdCPlaneView = New RelayCommand(AddressOf CPlaneView)
End If
Return m_cmdCPlaneView
End Get
End Property
''' <summary>
''' Returns a command that do CPlaneView.
''' </summary>
Public ReadOnly Property CPlaneViewCommand As ICommand
Get
If m_cmdCPlaneView Is Nothing Then
m_cmdCPlaneView = New RelayCommand(AddressOf CPlaneView)
End If
Return m_cmdCPlaneView
End Get
End Property
''' <summary>
''' Execute the CPlaneView. This method is invoked by the CPlaneViewCommand.
''' </summary>
Public Sub CPlaneView(ByVal param As Object)
Map.refProjectVM.GetController.SetLastInteger(Controller.GRID_TYPE.VIEW)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID)
End Sub
''' <summary>
''' Execute the CPlaneView. This method is invoked by the CPlaneViewCommand.
''' </summary>
Public Sub CPlaneView(ByVal param As Object)
Map.refProjectVM.GetController.SetLastInteger(Controller.GRID_TYPE.VIEW)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID)
End Sub
#End Region ' CPlaneViewCommand
#Region "CPlaneRotateCommand"
''' <summary>
''' Returns a command that do CPlaneRotate.
''' </summary>
Public ReadOnly Property CPlaneRotateCommand As ICommand
Get
If m_cmdCPlaneRotate Is Nothing Then
m_cmdCPlaneRotate = New RelayCommand(AddressOf CPlaneRotate)
End If
Return m_cmdCPlaneRotate
End Get
End Property
''' <summary>
''' Execute the CPlaneRotate. This method is invoked by the CPlaneRotateCommand.
''' </summary>
Public Sub CPlaneRotate(ByVal param As Object)
If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID_ROTATE)
Else
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID_ROTATE3D)
''' <summary>
''' Returns a command that do CPlaneRotate.
''' </summary>
Public ReadOnly Property CPlaneRotateCommand As ICommand
Get
If m_cmdCPlaneRotate Is Nothing Then
m_cmdCPlaneRotate = New RelayCommand(AddressOf CPlaneRotate)
End If
End Sub
Return m_cmdCPlaneRotate
End Get
End Property
''' <summary>
''' Execute the CPlaneRotate. This method is invoked by the CPlaneRotateCommand.
''' </summary>
Public Sub CPlaneRotate(ByVal param As Object)
If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID_ROTATE)
Else
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID_ROTATE3D)
End If
End Sub
#End Region ' CPlaneRotateCommand
#Region "CPlane3PCommand"
''' <summary>
''' Returns a command that do CPlane3P.
''' </summary>
Public ReadOnly Property CPlane3PCommand As ICommand
Get
If m_cmdCPlane3P Is Nothing Then
m_cmdCPlane3P = New RelayCommand(AddressOf CPlane3P)
End If
Return m_cmdCPlane3P
End Get
End Property
''' <summary>
''' Returns a command that do CPlane3P.
''' </summary>
Public ReadOnly Property CPlane3PCommand As ICommand
Get
If m_cmdCPlane3P Is Nothing Then
m_cmdCPlane3P = New RelayCommand(AddressOf CPlane3P)
End If
Return m_cmdCPlane3P
End Get
End Property
''' <summary>
''' Execute the CPlane3P. This method is invoked by the CPlane3PCommand.
''' </summary>
Public Sub CPlane3P(ByVal param As Object)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID_3P)
End Sub
''' <summary>
''' Execute the CPlane3P. This method is invoked by the CPlane3PCommand.
''' </summary>
Public Sub CPlane3P(ByVal param As Object)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID_3P)
End Sub
#End Region ' CPlane3PCommand
#Region "CPlanePerpObjCommand"
''' <summary>
''' Returns a command that do CPlanePerpObj.
''' </summary>
Public ReadOnly Property CPlanePerpObjCommand As ICommand
Get
If m_cmdCPlanePerpObj Is Nothing Then
m_cmdCPlanePerpObj = New RelayCommand(AddressOf CPlanePerpObj)
End If
Return m_cmdCPlanePerpObj
End Get
End Property
''' <summary>
''' Returns a command that do CPlanePerpObj.
''' </summary>
Public ReadOnly Property CPlanePerpObjCommand As ICommand
Get
If m_cmdCPlanePerpObj Is Nothing Then
m_cmdCPlanePerpObj = New RelayCommand(AddressOf CPlanePerpObj)
End If
Return m_cmdCPlanePerpObj
End Get
End Property
''' <summary>
''' Execute the CPlanePerpObj. This method is invoked by the CPlanePerpObjCommand.
''' </summary>
Public Sub CPlanePerpObj(ByVal param As Object)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID_PERPCURVE)
End Sub
''' <summary>
''' Execute the CPlanePerpObj. This method is invoked by the CPlanePerpObjCommand.
''' </summary>
Public Sub CPlanePerpObj(ByVal param As Object)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID_PERPCURVE)
End Sub
#End Region ' CPlanePerpObjCommand
#Region "CPlaneObjCommand"
''' <summary>
''' Returns a command that do CPlanepObj.
''' </summary>
Public ReadOnly Property CPlaneObjCommand As ICommand
Get
If m_cmdCPlaneObj Is Nothing Then
m_cmdCPlaneObj = New RelayCommand(AddressOf CPlaneObj)
End If
Return m_cmdCPlaneObj
End Get
End Property
''' <summary>
''' Returns a command that do CPlanepObj.
''' </summary>
Public ReadOnly Property CPlaneObjCommand As ICommand
Get
If m_cmdCPlaneObj Is Nothing Then
m_cmdCPlaneObj = New RelayCommand(AddressOf CPlaneObj)
End If
Return m_cmdCPlaneObj
End Get
End Property
''' <summary>
''' Execute the CPlaneObj. This method is invoked by the CPlaneObjCommand.
''' </summary>
Public Sub CPlaneObj(ByVal param As Object)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID_OBJ)
End Sub
''' <summary>
''' Execute the CPlaneObj. This method is invoked by the CPlaneObjCommand.
''' </summary>
Public Sub CPlaneObj(ByVal param As Object)
Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID_OBJ)
End Sub
#End Region ' CPlaneObjCommand
#End Region ' COMMANDS
End Class
End Namespace
End Class
+142 -146
View File
@@ -1,57 +1,55 @@
Imports EgtUILib
Namespace EgtCAM5
Public Class PopUpViewPanelVM
Inherits ViewModelBase
Public Class PopUpViewPanelVM
Inherits ViewModelBase
#Region "FIELDS & PROPERTIES"
' Definizione comandi
Private m_cmdZoomIn As ICommand
Private m_cmdZoomOut As ICommand
Private m_cmdIsoViewSE As ICommand
Private m_cmdIsoViewNE As ICommand
Private m_cmdIsoViewNW As ICommand
Private m_cmdViewToCPlane As ICommand
' Definizione comandi
Private m_cmdZoomIn As ICommand
Private m_cmdZoomOut As ICommand
Private m_cmdIsoViewSE As ICommand
Private m_cmdIsoViewNE As ICommand
Private m_cmdIsoViewNW As ICommand
Private m_cmdViewToCPlane As ICommand
#Region "ToolTip"
Public ReadOnly Property ZoomInToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 5)
End Get
End Property
Public ReadOnly Property ZoomInToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 5)
End Get
End Property
Public ReadOnly Property ZoomOutToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 6)
End Get
End Property
Public ReadOnly Property ZoomOutToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 6)
End Get
End Property
Public ReadOnly Property LookFromIso_SEToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 13)
End Get
End Property
Public ReadOnly Property LookFromIso_SEToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 13)
End Get
End Property
Public ReadOnly Property LookFromIso_NEToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 14)
End Get
End Property
Public ReadOnly Property LookFromIso_NEToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 14)
End Get
End Property
Public ReadOnly Property LookFromIso_NWToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 15)
End Get
End Property
Public ReadOnly Property LookFromIso_NWToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 15)
End Get
End Property
Public ReadOnly Property ViewToCPlaneToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 32)
End Get
End Property
Public ReadOnly Property ViewToCPlaneToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 32)
End Get
End Property
#End Region ' ToolTip
@@ -61,144 +59,142 @@ Namespace EgtCAM5
#Region "ZoomInCommand"
''' <summary>
''' Returns a command that do ZoomIn.
''' </summary>
Public ReadOnly Property ZoomInCommand As ICommand
Get
If m_cmdZoomIn Is Nothing Then
m_cmdZoomIn = New RelayCommand(AddressOf ZoomIn)
End If
Return m_cmdZoomIn
End Get
End Property
''' <summary>
''' Returns a command that do ZoomIn.
''' </summary>
Public ReadOnly Property ZoomInCommand As ICommand
Get
If m_cmdZoomIn Is Nothing Then
m_cmdZoomIn = New RelayCommand(AddressOf ZoomIn)
End If
Return m_cmdZoomIn
End Get
End Property
''' <summary>
''' Execute the ZoomIn. This method is invoked by the ZoomInCommand.
''' </summary>
Public Sub ZoomIn(ByVal param As Object)
Map.refProjectVM.GetScene.ZoomIn()
End Sub
''' <summary>
''' Execute the ZoomIn. This method is invoked by the ZoomInCommand.
''' </summary>
Public Sub ZoomIn(ByVal param As Object)
Map.refProjectVM.GetScene.ZoomIn()
End Sub
#End Region ' ZoomInCommand
#Region "ZoomOutCommand"
''' <summary>
''' Returns a command that do ZoomOut.
''' </summary>
Public ReadOnly Property ZoomOutCommand As ICommand
Get
If m_cmdZoomOut Is Nothing Then
m_cmdZoomOut = New RelayCommand(AddressOf ZoomOut)
End If
Return m_cmdZoomOut
End Get
End Property
''' <summary>
''' Returns a command that do ZoomOut.
''' </summary>
Public ReadOnly Property ZoomOutCommand As ICommand
Get
If m_cmdZoomOut Is Nothing Then
m_cmdZoomOut = New RelayCommand(AddressOf ZoomOut)
End If
Return m_cmdZoomOut
End Get
End Property
''' <summary>
''' Execute the ZoomOut. This method is invoked by the ZoomOutCommand.
''' </summary>
Public Sub ZoomOut(ByVal param As Object)
Map.refProjectVM.GetScene.ZoomOut()
End Sub
''' <summary>
''' Execute the ZoomOut. This method is invoked by the ZoomOutCommand.
''' </summary>
Public Sub ZoomOut(ByVal param As Object)
Map.refProjectVM.GetScene.ZoomOut()
End Sub
#End Region ' ZoomOutCommand
#Region "IsoViewSECommand"
''' <summary>
''' Returns a command that do IsoViewSE.
''' </summary>
Public ReadOnly Property IsoViewSECommand As ICommand
Get
If m_cmdIsoViewSE Is Nothing Then
m_cmdIsoViewSE = New RelayCommand(AddressOf IsoViewSE)
End If
Return m_cmdIsoViewSE
End Get
End Property
''' <summary>
''' Returns a command that do IsoViewSE.
''' </summary>
Public ReadOnly Property IsoViewSECommand As ICommand
Get
If m_cmdIsoViewSE Is Nothing Then
m_cmdIsoViewSE = New RelayCommand(AddressOf IsoViewSE)
End If
Return m_cmdIsoViewSE
End Get
End Property
''' <summary>
''' Execute the IsoViewSE. This method is invoked by the IsoViewSECommand.
''' </summary>
Public Sub IsoViewSE(ByVal param As Object)
Map.refProjectVM.GetScene.IsoViewSE()
End Sub
''' <summary>
''' Execute the IsoViewSE. This method is invoked by the IsoViewSECommand.
''' </summary>
Public Sub IsoViewSE(ByVal param As Object)
Map.refProjectVM.GetScene.IsoViewSE()
End Sub
#End Region ' IsoViewSECommand
#Region "IsoViewNECommand"
''' <summary>
''' Returns a command that do IsoViewNE.
''' </summary>
Public ReadOnly Property IsoViewNECommand As ICommand
Get
If m_cmdIsoViewNE Is Nothing Then
m_cmdIsoViewNE = New RelayCommand(AddressOf IsoViewNE)
End If
Return m_cmdIsoViewNE
End Get
End Property
''' <summary>
''' Returns a command that do IsoViewNE.
''' </summary>
Public ReadOnly Property IsoViewNECommand As ICommand
Get
If m_cmdIsoViewNE Is Nothing Then
m_cmdIsoViewNE = New RelayCommand(AddressOf IsoViewNE)
End If
Return m_cmdIsoViewNE
End Get
End Property
''' <summary>
''' Execute the IsoViewNE. This method is invoked by the IsoViewNECommand.
''' </summary>
Public Sub IsoViewNE(ByVal param As Object)
Map.refProjectVM.GetScene.IsoViewNE()
End Sub
''' <summary>
''' Execute the IsoViewNE. This method is invoked by the IsoViewNECommand.
''' </summary>
Public Sub IsoViewNE(ByVal param As Object)
Map.refProjectVM.GetScene.IsoViewNE()
End Sub
#End Region ' IsoViewNECommand
#Region "IsoViewNWCommand"
''' <summary>
''' Returns a command that do IsoViewNW.
''' </summary>
Public ReadOnly Property IsoViewNWCommand As ICommand
Get
If m_cmdIsoViewNW Is Nothing Then
m_cmdIsoViewNW = New RelayCommand(AddressOf IsoViewNW)
End If
Return m_cmdIsoViewNW
End Get
End Property
''' <summary>
''' Returns a command that do IsoViewNW.
''' </summary>
Public ReadOnly Property IsoViewNWCommand As ICommand
Get
If m_cmdIsoViewNW Is Nothing Then
m_cmdIsoViewNW = New RelayCommand(AddressOf IsoViewNW)
End If
Return m_cmdIsoViewNW
End Get
End Property
''' <summary>
''' Execute the IsoViewNW. This method is invoked by the IsoViewNWCommand.
''' </summary>
Public Sub IsoViewNW(ByVal param As Object)
Map.refProjectVM.GetScene.IsoViewNW()
End Sub
''' <summary>
''' Execute the IsoViewNW. This method is invoked by the IsoViewNWCommand.
''' </summary>
Public Sub IsoViewNW(ByVal param As Object)
Map.refProjectVM.GetScene.IsoViewNW()
End Sub
#End Region ' IsoViewNWCommand
#Region "ViewToCPlaneCommand"
''' <summary>
''' Returns a command that do GetDist.
''' </summary>
Public ReadOnly Property ViewToCPlaneCommand As ICommand
Get
If m_cmdViewToCPlane Is Nothing Then
m_cmdViewToCPlane = New RelayCommand(AddressOf ViewToCPlane)
End If
Return m_cmdViewToCPlane
End Get
End Property
''' <summary>
''' Returns a command that do GetDist.
''' </summary>
Public ReadOnly Property ViewToCPlaneCommand As ICommand
Get
If m_cmdViewToCPlane Is Nothing Then
m_cmdViewToCPlane = New RelayCommand(AddressOf ViewToCPlane)
End If
Return m_cmdViewToCPlane
End Get
End Property
''' <summary>
''' Execute the GetDist. This method is invoked by the GetDistCommand.
''' </summary>
Public Sub ViewToCPlane(ByVal param As Object)
Map.refProjectVM.GetScene.CPlaneView()
End Sub
''' <summary>
''' Execute the GetDist. This method is invoked by the GetDistCommand.
''' </summary>
Public Sub ViewToCPlane(ByVal param As Object)
Map.refProjectVM.GetScene.CPlaneView()
End Sub
#End Region ' ViewToCPlaneCommand
#End Region ' COMMANDS
End Class
End Namespace
End Class
+1214 -1218
View File
File diff suppressed because it is too large Load Diff
+857 -861
View File
File diff suppressed because it is too large Load Diff
+97 -101
View File
@@ -1,128 +1,124 @@
Imports EgtUILib
Namespace EgtCAM5
Public Class ShowPanelVM
Inherits ViewModelBase
Public Class ShowPanelVM
Inherits ViewModelBase
#Region "FIELDS & PROPERTIES"
' Definizione comandi
Private m_cmdWireframe As ICommand
Private m_cmdHiddenLine As ICommand
Private m_cmdShading As ICommand
Private m_cmdCurveDir As ICommand
' Definizione comandi
Private m_cmdWireframe As ICommand
Private m_cmdHiddenLine As ICommand
Private m_cmdShading As ICommand
Private m_cmdCurveDir As ICommand
#Region "ToolTip"
Public ReadOnly Property RenderingWFToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 1)
End Get
End Property
Public ReadOnly Property RenderingWFToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 1)
End Get
End Property
Public ReadOnly Property RenderingHLToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 2)
End Get
End Property
Public ReadOnly Property RenderingHLToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 2)
End Get
End Property
Public ReadOnly Property RenderingSHToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 3)
End Get
End Property
Public ReadOnly Property CurveDirToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 16)
End Get
End Property
Public ReadOnly Property RenderingSHToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 3)
End Get
End Property
Public ReadOnly Property CurveDirToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 16)
End Get
End Property
#End Region
Private m_WireframeIsChecked As Boolean
Public Property WireframeIsChecked As Boolean
Get
Return m_WireframeIsChecked
End Get
Set(value As Boolean)
If value <> m_WireframeIsChecked Then
m_WireframeIsChecked = value
If value Then
Map.refProjectVM.GetScene.WireFrame()
OnPropertyChanged("WireframeIsChecked")
End If
Private m_WireframeIsChecked As Boolean
Public Property WireframeIsChecked As Boolean
Get
Return m_WireframeIsChecked
End Get
Set(value As Boolean)
If value <> m_WireframeIsChecked Then
m_WireframeIsChecked = value
If value Then
Map.refProjectVM.GetScene.WireFrame()
OnPropertyChanged("WireframeIsChecked")
End If
End Set
End Property
End If
End Set
End Property
Private m_HiddenLineIsChecked As Boolean
Public Property HiddenLineIsChecked As Boolean
Get
Return m_HiddenLineIsChecked
End Get
Set(value As Boolean)
If value <> m_HiddenLineIsChecked Then
m_HiddenLineIsChecked = value
If value Then
Map.refProjectVM.GetScene.HiddenLine()
OnPropertyChanged("HiddenLineIsChecked")
End If
Private m_HiddenLineIsChecked As Boolean
Public Property HiddenLineIsChecked As Boolean
Get
Return m_HiddenLineIsChecked
End Get
Set(value As Boolean)
If value <> m_HiddenLineIsChecked Then
m_HiddenLineIsChecked = value
If value Then
Map.refProjectVM.GetScene.HiddenLine()
OnPropertyChanged("HiddenLineIsChecked")
End If
End Set
End Property
End If
End Set
End Property
Private m_ShadingIsChecked As Boolean
Public Property ShadingIsChecked As Boolean
Get
Return m_ShadingIsChecked
End Get
Set(value As Boolean)
If value <> m_ShadingIsChecked Then
m_ShadingIsChecked = value
If value Then
Map.refProjectVM.GetScene.Shading()
OnPropertyChanged("ShadingIsChecked")
End If
Private m_ShadingIsChecked As Boolean
Public Property ShadingIsChecked As Boolean
Get
Return m_ShadingIsChecked
End Get
Set(value As Boolean)
If value <> m_ShadingIsChecked Then
m_ShadingIsChecked = value
If value Then
Map.refProjectVM.GetScene.Shading()
OnPropertyChanged("ShadingIsChecked")
End If
End Set
End Property
End If
End Set
End Property
Private m_CurveDirIsChecked As Boolean
Public Property CurveDirIsChecked As Boolean
Get
Return m_CurveDirIsChecked
End Get
Set(value As Boolean)
If value <> m_CurveDirIsChecked Then
m_CurveDirIsChecked = value
EgtSetShowCurveDirection(value)
OnPropertyChanged("CurveDirIsChecked")
End If
End Set
End Property
Private m_CurveDirIsChecked As Boolean
Public Property CurveDirIsChecked As Boolean
Get
Return m_CurveDirIsChecked
End Get
Set(value As Boolean)
If value <> m_CurveDirIsChecked Then
m_CurveDirIsChecked = value
EgtSetShowCurveDirection(value)
OnPropertyChanged("CurveDirIsChecked")
End If
End Set
End Property
#End Region ' FIELDS & PROPERTIES
#Region "CONSTRUCTOR"
Sub New()
Application.Msn.Register(Application.SHOWMODESTATE, Sub(nShowModeState As Integer)
If nShowModeState = SM.WIREFRAME Then
WireframeIsChecked = True
ElseIf nShowModeState = SM.HIDDENLINE Then
HiddenLineIsChecked = True
Else
ShadingIsChecked = True
End If
Sub New()
Application.Msn.Register(Application.SHOWMODESTATE, Sub(nShowModeState As Integer)
If nShowModeState = SM.WIREFRAME Then
WireframeIsChecked = True
ElseIf nShowModeState = SM.HIDDENLINE Then
HiddenLineIsChecked = True
Else
ShadingIsChecked = True
End If
End Sub)
Application.Msn.Register(Application.SHOWCURVEDIR, Sub(nShowCurveDir As Integer)
CurveDirIsChecked = (nShowCurveDir <> 0)
End Sub)
End Sub
End Sub)
Application.Msn.Register(Application.SHOWCURVEDIR, Sub(nShowCurveDir As Integer)
CurveDirIsChecked = (nShowCurveDir <> 0)
End Sub)
End Sub
#End Region ' CONSTRUCTOR
End Class
End Namespace
End Class
-1
View File
@@ -3,7 +3,6 @@ Imports System.Collections.ObjectModel
Imports System.IO
Imports EgtUILib
Public Class GunStockWndVM
Implements INotifyPropertyChanged
+19 -23
View File
@@ -1,32 +1,28 @@
Imports System.IO
Imports EgtUILib
Namespace EgtCAM5
Public Class SpecialPanelVM
Public Class SpecialPanelVM
Private m_ButtonList As New List(Of ButtonItem)
Public ReadOnly Property ButtonList As List(Of ButtonItem)
Get
Return m_ButtonList
End Get
End Property
Private m_ButtonList As New List(Of ButtonItem)
Public ReadOnly Property ButtonList As List(Of ButtonItem)
Get
Return m_ButtonList
End Get
End Property
Sub New()
' se attivo, inizializzo i bottoni leggendoli da file ini
If IniFile.IsActiveSpecialPanel Then
Dim BtnIndex As Integer = 1
Dim CurrBtn As ButtonItem = Nothing
While GetPrivateProfileButton(S_SPECIAL, K_BUTTON & BtnIndex, CurrBtn)
m_ButtonList.Add(CurrBtn)
BtnIndex += 1
End While
End If
End Sub
Sub New()
' se attivo, inizializzo i bottoni leggendoli da file ini
If IniFile.IsActiveSpecialPanel Then
Dim BtnIndex As Integer = 1
Dim CurrBtn As ButtonItem = Nothing
While GetPrivateProfileButton(S_SPECIAL, K_BUTTON & BtnIndex, CurrBtn)
m_ButtonList.Add(CurrBtn)
BtnIndex += 1
End While
End If
End Sub
End Class
End Namespace
End Class
Public Class ButtonItem
+467 -471
View File
File diff suppressed because it is too large Load Diff
+49 -53
View File
@@ -1,69 +1,65 @@
Imports EgtUILib
Namespace EgtCAM5
Public Class PrepareInputBoxParam
Friend sTitle As String
Friend sLabel As String
Friend sCheckLabel As String
Friend bShowCombo As Boolean
Friend bShowBtn As Boolean
Public Class PrepareInputBoxParam
Friend sTitle As String
Friend sLabel As String
Friend sCheckLabel As String
Friend bShowCombo As Boolean
Friend bShowBtn As Boolean
Sub New(ByVal sTitle As String, ByVal sLabel As String, ByVal sCheckLabel As String,
ByVal bShowCombo As Boolean, ByVal bShowBtn As Boolean)
Me.sTitle = sTitle
Me.sLabel = sLabel
Me.sCheckLabel = sCheckLabel
Me.bShowCombo = bShowCombo
Me.bShowBtn = bShowBtn
End Sub
Sub New(ByVal sTitle As String, ByVal sLabel As String, ByVal sCheckLabel As String,
ByVal bShowCombo As Boolean, ByVal bShowBtn As Boolean)
Me.sTitle = sTitle
Me.sLabel = sLabel
Me.sCheckLabel = sCheckLabel
Me.bShowCombo = bShowCombo
Me.bShowBtn = bShowBtn
End Sub
End Class
End Class
Public Class AddInputBoxComboParam
Friend sText As String
Friend bSelected As Boolean
Public Class AddInputBoxComboParam
Friend sText As String
Friend bSelected As Boolean
Sub New(ByVal sText As String, ByVal bSelected As Boolean)
Me.sText = sText
Me.bSelected = bSelected
End Sub
Sub New(ByVal sText As String, ByVal bSelected As Boolean)
Me.sText = sText
Me.bSelected = bSelected
End Sub
End Class
End Class
Public Class UpdateStatusGridParam
Friend m_bShowGrid As Boolean
Friend m_bShowGridFrame As Boolean
Public Class UpdateStatusGridParam
Friend m_bShowGrid As Boolean
Friend m_bShowGridFrame As Boolean
Sub New(ByVal bShowGrid As Boolean, bShowGridFrame As Boolean)
Me.m_bShowGrid = bShowGrid
Me.m_bShowGridFrame = bShowGridFrame
End Sub
Sub New(ByVal bShowGrid As Boolean, bShowGridFrame As Boolean)
Me.m_bShowGrid = bShowGrid
Me.m_bShowGridFrame = bShowGridFrame
End Sub
End Class
End Class
Public Class SaveObjectParam
Friend nId As Integer
Friend sDir As String
Friend nType As NGE
Public Class SaveObjectParam
Friend nId As Integer
Friend sDir As String
Friend nType As NGE
Sub New(nId As Integer, sDir As String, nType As NGE)
Me.nId = nId
Me.sDir = sDir
Me.nType = nType
End Sub
Sub New(nId As Integer, sDir As String, nType As NGE)
Me.nId = nId
Me.sDir = sDir
Me.nType = nType
End Sub
End Class
End Class
Public Class NewMachOpParam
Friend bActive As Boolean = False
Friend SelMachOpId As Integer = GDB_ID.NULL
Public Class NewMachOpParam
Friend bActive As Boolean = False
Friend SelMachOpId As Integer = GDB_ID.NULL
Sub New(bActive As Boolean, SelMachOpId As Integer)
Me.bActive = bActive
Me.SelMachOpId = SelMachOpId
End Sub
Sub New(bActive As Boolean, SelMachOpId As Integer)
Me.bActive = bActive
Me.SelMachOpId = SelMachOpId
End Sub
End Class
End Namespace
End Class
+529 -533
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+22 -23
View File
@@ -4,7 +4,6 @@
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:local="clr-namespace:EgtCAM5"
xmlns:EgtCAM5="clr-namespace:EgtCAM5"
xmlns:ViewModel="clr-namespace:EgtCAM5.EgtCAM5"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5">
<!--ViewModel-View association-->
@@ -13,7 +12,7 @@
This template applies a ProjectView to an instance
of the ProjectViewModel class shown in the main window.
-->
<DataTemplate DataType="{x:Type ViewModel:ProjectVM}">
<DataTemplate DataType="{x:Type EgtCAM5:ProjectVM}">
<local:ProjectV />
</DataTemplate>
@@ -21,28 +20,28 @@
Assign a Key to every Panel ViewModel to use
it in xaml file(ProjectView.xaml).
-->
<ViewModel:ViewPanelVM x:Key="ViewPanelViewModel"/>
<ViewModel:PopUpViewPanelVM x:Key="PopUpViewPanelViewModel"/>
<ViewModel:DrawPanelVM x:Key="DrawPanelViewModel"/>
<ViewModel:OptionPanelVM x:Key="OptionPanelViewModel"/>
<ViewModel:TopCommandBarVM x:Key="TopCommandBarViewModel"/>
<ViewModel:DoorPanelVM x:Key="DoorsPanelViewModel"/>
<ViewModel:GunStockPanelVM x:Key="GunStockPanelViewModel"/>
<ViewModel:GridPanelVM x:Key="GridPanelViewModel"/>
<ViewModel:PopUpGridPanelVM x:Key="PopUpGridPanelViewModel"/>
<ViewModel:ShowPanelVM x:Key="ShowPanelViewModel"/>
<ViewModel:InstrumentPanelVM x:Key="InstrumentPanelViewModel"/>
<ViewModel:MachinePanelVM x:Key="DbPanelViewModel"/>
<ViewModel:ExecutePanelVM x:Key="ExecutePanelViewModel"/>
<ViewModel:SpecialPanelVM x:Key="SpecialPanelViewModel"/>
<ViewModel:MachGroupPanelVM x:Key="MachGroupPanelViewModel"/>
<ViewModel:OperationExpanderViewModel x:Key="OperationExpanderViewModel"/>
<EgtCAM5:ViewPanelVM x:Key="ViewPanelViewModel"/>
<EgtCAM5:PopUpViewPanelVM x:Key="PopUpViewPanelViewModel"/>
<EgtCAM5:DrawPanelVM x:Key="DrawPanelViewModel"/>
<EgtCAM5:OptionPanelVM x:Key="OptionPanelViewModel"/>
<EgtCAM5:TopCommandBarVM x:Key="TopCommandBarViewModel"/>
<EgtCAM5:DoorPanelVM x:Key="DoorsPanelViewModel"/>
<EgtCAM5:GunStockPanelVM x:Key="GunStockPanelViewModel"/>
<EgtCAM5:GridPanelVM x:Key="GridPanelViewModel"/>
<EgtCAM5:PopUpGridPanelVM x:Key="PopUpGridPanelViewModel"/>
<EgtCAM5:ShowPanelVM x:Key="ShowPanelViewModel"/>
<EgtCAM5:InstrumentPanelVM x:Key="InstrumentPanelViewModel"/>
<EgtCAM5:MachinePanelVM x:Key="DbPanelViewModel"/>
<EgtCAM5:ExecutePanelVM x:Key="ExecutePanelViewModel"/>
<EgtCAM5:SpecialPanelVM x:Key="SpecialPanelViewModel"/>
<EgtCAM5:MachGroupPanelVM x:Key="MachGroupPanelViewModel"/>
<EgtCAM5:OperationExpanderVM x:Key="OperationExpanderViewModel"/>
<!--
This template applies a StatusBarView to an instance
of the StatusBarViewModel class shown in the main window.
-->
<DataTemplate DataType="{x:Type ViewModel:StatusBarVM}">
<DataTemplate DataType="{x:Type EgtCAM5:StatusBarVM}">
<local:StatusBarV />
</DataTemplate>
@@ -786,22 +785,22 @@
</Style>-->
<Style x:Key="MruScriptItem" TargetType="MenuItem">
<Setter Property="Command" Value="{x:Static ViewModel:ExecutePanelVM.OpenMruScriptCommand}" />
<Setter Property="Command" Value="{x:Static EgtCAM5:ExecutePanelVM.OpenMruScriptCommand}" />
<Setter Property="CommandParameter" Value="{Binding}" />
</Style>
<Style x:Key="MruDoorItem" TargetType="MenuItem">
<Setter Property="Command" Value="{x:Static ViewModel:DoorPanelVM.OpenMruDoorCommand}" />
<Setter Property="Command" Value="{x:Static EgtCAM5:DoorPanelVM.OpenMruDoorCommand}" />
<Setter Property="CommandParameter" Value="{Binding}" />
</Style>
<Style x:Key="MruNewGunStockItem" TargetType="MenuItem">
<Setter Property="Command" Value="{x:Static ViewModel:GunStockPanelVM.OpenMruNewGunStockCommand}" />
<Setter Property="Command" Value="{x:Static EgtCAM5:GunStockPanelVM.OpenMruNewGunStockCommand}" />
<Setter Property="CommandParameter" Value="{Binding}" />
</Style>
<Style x:Key="MruModifyGunStockItem" TargetType="MenuItem">
<Setter Property="Command" Value="{x:Static ViewModel:GunStockPanelVM.OpenMruModifyGunStockCommand}" />
<Setter Property="Command" Value="{x:Static EgtCAM5:GunStockPanelVM.OpenMruModifyGunStockCommand}" />
<Setter Property="CommandParameter" Value="{Binding}" />
</Style>
+12 -12
View File
@@ -2,29 +2,29 @@
#Region "Program ViewModel Map"
Private m_refMainWindowVM As EgtCAM5.MainWindowVM
Private m_refStatusBarVM As EgtCAM5.StatusBarVM
Private m_refTopCommandBarVM As EgtCAM5.TopCommandBarVM
Private m_refProjectVM As EgtCAM5.ProjectVM
Private m_refMainWindowVM As MainWindowVM
Private m_refStatusBarVM As StatusBarVM
Private m_refTopCommandBarVM As TopCommandBarVM
Private m_refProjectVM As ProjectVM
#Region "Get"
Public ReadOnly Property refMainWindowVM As EgtCAM5.MainWindowVM
Public ReadOnly Property refMainWindowVM As MainWindowVM
Get
Return m_refMainWindowVM
End Get
End Property
Public ReadOnly Property refStatusBarVM As EgtCAM5.StatusBarVM
Public ReadOnly Property refStatusBarVM As StatusBarVM
Get
Return m_refStatusBarVM
End Get
End Property
Public ReadOnly Property refTopCommandBarVM As EgtCAM5.TopCommandBarVM
Public ReadOnly Property refTopCommandBarVM As TopCommandBarVM
Get
Return m_refTopCommandBarVM
End Get
End Property
Public ReadOnly Property refProjectVM As EgtCAM5.ProjectVM
Public ReadOnly Property refProjectVM As ProjectVM
Get
Return m_refProjectVM
End Get
@@ -34,15 +34,15 @@
#Region "Set"
Friend Function SetRefStatusBarVM(StatusBarVM As EgtCAM5.StatusBarVM) As Boolean
Friend Function SetRefStatusBarVM(StatusBarVM As StatusBarVM) As Boolean
m_refStatusBarVM = StatusBarVM
Return Not IsNothing(m_refStatusBarVM)
End Function
Friend Function SetRefTopCommandBarVM(TopCommandBarVM As EgtCAM5.TopCommandBarVM) As Boolean
Friend Function SetRefTopCommandBarVM(TopCommandBarVM As TopCommandBarVM) As Boolean
m_refTopCommandBarVM = TopCommandBarVM
Return Not IsNothing(m_refTopCommandBarVM)
End Function
Friend Function SetRefProjectVM(ProjectVM As EgtCAM5.ProjectVM) As Boolean
Friend Function SetRefProjectVM(ProjectVM As ProjectVM) As Boolean
m_refProjectVM = ProjectVM
Return Not IsNothing(m_refProjectVM)
End Function
@@ -51,7 +51,7 @@
#Region "Init"
Friend Function BeginInit(MainWindowVM As EgtCAM5.MainWindowVM) As Boolean
Friend Function BeginInit(MainWindowVM As MainWindowVM) As Boolean
m_refMainWindowVM = MainWindowVM
Return Not IsNothing(m_refMainWindowVM)
End Function
+165 -169
View File
@@ -1,64 +1,62 @@
Imports EgtUILib
Namespace EgtCAM5
Public Class ViewPanelVM
Inherits ViewModelBase
Public Class ViewPanelVM
Inherits ViewModelBase
#Region "FIELDS & PROPERTIES"
' Definizione comandi
Private m_cmdZoomAll As ICommand
Private m_cmdTopView As ICommand
Private m_cmdFrontView As ICommand
Private m_cmdLeftView As ICommand
Private m_cmdBackView As ICommand
Private m_cmdRightView As ICommand
Private m_cmdIsoViewSW As ICommand
' Definizione comandi
Private m_cmdZoomAll As ICommand
Private m_cmdTopView As ICommand
Private m_cmdFrontView As ICommand
Private m_cmdLeftView As ICommand
Private m_cmdBackView As ICommand
Private m_cmdRightView As ICommand
Private m_cmdIsoViewSW As ICommand
#Region "ToolTip"
Public ReadOnly Property ZoomAllToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 4)
End Get
End Property
Public ReadOnly Property ZoomAllToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 4)
End Get
End Property
Public ReadOnly Property LookFromTopToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 7)
End Get
End Property
Public ReadOnly Property LookFromTopToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 7)
End Get
End Property
Public ReadOnly Property LookFromFrontToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 8)
End Get
End Property
Public ReadOnly Property LookFromFrontToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 8)
End Get
End Property
Public ReadOnly Property LookFromLeftToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 9)
End Get
End Property
Public ReadOnly Property LookFromLeftToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 9)
End Get
End Property
Public ReadOnly Property LookFromBackToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 10)
End Get
End Property
Public ReadOnly Property LookFromBackToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 10)
End Get
End Property
Public ReadOnly Property LookFromRightToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 11)
End Get
End Property
Public ReadOnly Property LookFromRightToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 11)
End Get
End Property
Public ReadOnly Property LookFromIso_SWToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 12)
End Get
End Property
Public ReadOnly Property LookFromIso_SWToolTip As String
Get
Return EgtMsg(MSG_GRIDVIEWPANEL + 12)
End Get
End Property
#End Region ' ToolTip
@@ -68,167 +66,165 @@ Namespace EgtCAM5
#Region "ZoomAllCommand"
''' <summary>
''' Returns a command that do ZoomAll.
''' </summary>
Public ReadOnly Property ZoomAllCommand As ICommand
Get
If m_cmdZoomAll Is Nothing Then
m_cmdZoomAll = New RelayCommand(AddressOf ZoomAll)
End If
Return m_cmdZoomAll
End Get
End Property
''' <summary>
''' Returns a command that do ZoomAll.
''' </summary>
Public ReadOnly Property ZoomAllCommand As ICommand
Get
If m_cmdZoomAll Is Nothing Then
m_cmdZoomAll = New RelayCommand(AddressOf ZoomAll)
End If
Return m_cmdZoomAll
End Get
End Property
''' <summary>
''' Execute the ZoomAll. This method is invoked by the ZoomAllCommand.
''' </summary>
Public Sub ZoomAll(ByVal param As Object)
Map.refProjectVM.GetScene.ZoomAll()
End Sub
''' <summary>
''' Execute the ZoomAll. This method is invoked by the ZoomAllCommand.
''' </summary>
Public Sub ZoomAll(ByVal param As Object)
Map.refProjectVM.GetScene.ZoomAll()
End Sub
#End Region ' ZoomAllCommand
#Region "TopViewCommand"
''' <summary>
''' Returns a command that do TopView.
''' </summary>
Public ReadOnly Property TopViewCommand As ICommand
Get
If m_cmdTopView Is Nothing Then
m_cmdTopView = New RelayCommand(AddressOf TopView)
End If
Return m_cmdTopView
End Get
End Property
''' <summary>
''' Returns a command that do TopView.
''' </summary>
Public ReadOnly Property TopViewCommand As ICommand
Get
If m_cmdTopView Is Nothing Then
m_cmdTopView = New RelayCommand(AddressOf TopView)
End If
Return m_cmdTopView
End Get
End Property
''' <summary>
''' Execute the TopView. This method is invoked by the TopViewCommand.
''' </summary>
Public Sub TopView(ByVal param As Object)
Map.refProjectVM.GetScene.TopView()
End Sub
''' <summary>
''' Execute the TopView. This method is invoked by the TopViewCommand.
''' </summary>
Public Sub TopView(ByVal param As Object)
Map.refProjectVM.GetScene.TopView()
End Sub
#End Region ' TopViewCommand
#Region "FrontViewCommand"
''' <summary>
''' Returns a command that do FrontView.
''' </summary>
Public ReadOnly Property FrontViewCommand As ICommand
Get
If m_cmdFrontView Is Nothing Then
m_cmdFrontView = New RelayCommand(AddressOf FrontView)
End If
Return m_cmdFrontView
End Get
End Property
''' <summary>
''' Returns a command that do FrontView.
''' </summary>
Public ReadOnly Property FrontViewCommand As ICommand
Get
If m_cmdFrontView Is Nothing Then
m_cmdFrontView = New RelayCommand(AddressOf FrontView)
End If
Return m_cmdFrontView
End Get
End Property
''' <summary>
''' Execute the FrontView. This method is invoked by the FrontViewCommand.
''' </summary>
Public Sub FrontView(ByVal param As Object)
Map.refProjectVM.GetScene.FrontView()
End Sub
''' <summary>
''' Execute the FrontView. This method is invoked by the FrontViewCommand.
''' </summary>
Public Sub FrontView(ByVal param As Object)
Map.refProjectVM.GetScene.FrontView()
End Sub
#End Region ' FrontViewCommand
#Region "LeftViewCommand"
''' <summary>
''' Returns a command that do LeftView.
''' </summary>
Public ReadOnly Property LeftViewCommand As ICommand
Get
If m_cmdLeftView Is Nothing Then
m_cmdLeftView = New RelayCommand(AddressOf LeftView)
End If
Return m_cmdLeftView
End Get
End Property
''' <summary>
''' Returns a command that do LeftView.
''' </summary>
Public ReadOnly Property LeftViewCommand As ICommand
Get
If m_cmdLeftView Is Nothing Then
m_cmdLeftView = New RelayCommand(AddressOf LeftView)
End If
Return m_cmdLeftView
End Get
End Property
''' <summary>
''' Execute the LeftView. This method is invoked by the LeftViewCommand.
''' </summary>
Public Sub LeftView(ByVal param As Object)
Map.refProjectVM.GetScene.LeftView()
End Sub
''' <summary>
''' Execute the LeftView. This method is invoked by the LeftViewCommand.
''' </summary>
Public Sub LeftView(ByVal param As Object)
Map.refProjectVM.GetScene.LeftView()
End Sub
#End Region ' LeftViewCommand
#Region "BackViewCommand"
''' <summary>
''' Returns a command that do BackView.
''' </summary>
Public ReadOnly Property BackViewCommand As ICommand
Get
If m_cmdBackView Is Nothing Then
m_cmdBackView = New RelayCommand(AddressOf BackView)
End If
Return m_cmdBackView
End Get
End Property
''' <summary>
''' Returns a command that do BackView.
''' </summary>
Public ReadOnly Property BackViewCommand As ICommand
Get
If m_cmdBackView Is Nothing Then
m_cmdBackView = New RelayCommand(AddressOf BackView)
End If
Return m_cmdBackView
End Get
End Property
''' <summary>
''' Execute the BackView. This method is invoked by the BackViewCommand.
''' </summary>
Public Sub BackView(ByVal param As Object)
Map.refProjectVM.GetScene.BackView()
End Sub
''' <summary>
''' Execute the BackView. This method is invoked by the BackViewCommand.
''' </summary>
Public Sub BackView(ByVal param As Object)
Map.refProjectVM.GetScene.BackView()
End Sub
#End Region ' BackViewCommand
#Region "RightViewCommand"
''' <summary>
''' Returns a command that do RightView.
''' </summary>
Public ReadOnly Property RightViewCommand As ICommand
Get
If m_cmdRightView Is Nothing Then
m_cmdRightView = New RelayCommand(AddressOf RightView)
End If
Return m_cmdRightView
End Get
End Property
''' <summary>
''' Returns a command that do RightView.
''' </summary>
Public ReadOnly Property RightViewCommand As ICommand
Get
If m_cmdRightView Is Nothing Then
m_cmdRightView = New RelayCommand(AddressOf RightView)
End If
Return m_cmdRightView
End Get
End Property
''' <summary>
''' Execute the RightView. This method is invoked by the RightViewCommand.
''' </summary>
Public Sub RightView(ByVal param As Object)
Map.refProjectVM.GetScene.RightView()
End Sub
''' <summary>
''' Execute the RightView. This method is invoked by the RightViewCommand.
''' </summary>
Public Sub RightView(ByVal param As Object)
Map.refProjectVM.GetScene.RightView()
End Sub
#End Region ' RightViewCommand
#Region "IsoViewSWCommand"
''' <summary>
''' Returns a command that do IsoViewSW.
''' </summary>
Public ReadOnly Property IsoViewSWCommand As ICommand
Get
If m_cmdIsoViewSW Is Nothing Then
m_cmdIsoViewSW = New RelayCommand(AddressOf IsoViewSW)
End If
Return m_cmdIsoViewSW
End Get
End Property
''' <summary>
''' Returns a command that do IsoViewSW.
''' </summary>
Public ReadOnly Property IsoViewSWCommand As ICommand
Get
If m_cmdIsoViewSW Is Nothing Then
m_cmdIsoViewSW = New RelayCommand(AddressOf IsoViewSW)
End If
Return m_cmdIsoViewSW
End Get
End Property
''' <summary>
''' Execute the IsoViewSW. This method is invoked by the IsoViewSWCommand.
''' </summary>
Public Sub IsoViewSW(ByVal param As Object)
Map.refProjectVM.GetScene.IsoViewSW()
End Sub
''' <summary>
''' Execute the IsoViewSW. This method is invoked by the IsoViewSWCommand.
''' </summary>
Public Sub IsoViewSW(ByVal param As Object)
Map.refProjectVM.GetScene.IsoViewSW()
End Sub
#End Region ' IsoViewSWCommand
#End Region ' COMMANDS
End Class
End Namespace
End Class