diff --git a/Application.xaml.vb b/Application.xaml.vb index 391b60c..e17fbd5 100644 --- a/Application.xaml.vb +++ b/Application.xaml.vb @@ -1,5 +1,4 @@ Imports EgtWPFLib5 -Imports EgtCAM5.EgtCAM5 Imports EgtUILib Class Application diff --git a/Base/BaseWindow/BaseWindowView.xaml b/Base/BaseWindow/BaseWindowView.xaml deleted file mode 100644 index 25e21a7..0000000 --- a/Base/BaseWindow/BaseWindowView.xaml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - diff --git a/Base/BaseWindow/BaseWindowView.xaml.vb b/Base/BaseWindow/BaseWindowView.xaml.vb deleted file mode 100644 index 4ab0694..0000000 --- a/Base/BaseWindow/BaseWindowView.xaml.vb +++ /dev/null @@ -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 - diff --git a/Base/TabViewModel.vb b/Base/TabViewModel.vb index cc267f5..9d8426a 100644 --- a/Base/TabViewModel.vb +++ b/Base/TabViewModel.vb @@ -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 \ No newline at end of file +End Class \ No newline at end of file diff --git a/Base/ViewModelBase.vb b/Base/ViewModelBase.vb index a50c88b..c889ad4 100644 --- a/Base/ViewModelBase.vb +++ b/Base/ViewModelBase.vb @@ -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" - ''' - ''' 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. - ''' - 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 + ''' + ''' 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. + ''' + 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" - ''' - ''' 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. - ''' - _ - 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 + ''' + ''' 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. + ''' + _ + 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 - ''' - ''' 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. - ''' - 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 + ''' + ''' 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. + ''' + 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" - ''' - ''' Raised when a property on this object has a new value. - ''' - Public Event PropertyChanged(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs) Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged + ''' + ''' Raised when a property on this object has a new value. + ''' + Public Event PropertyChanged(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs) Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged - ''' - ''' Raises this object's PropertyChanged event. - ''' - ''' The property that has a new value. - 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 + ''' + ''' Raises this object's PropertyChanged event. + ''' + ''' The property that has a new value. + 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 \ No newline at end of file +End Class \ No newline at end of file diff --git a/Command/Command.vb b/Command/Command.vb index 9fe3775..564246d 100644 --- a/Command/Command.vb +++ b/Command/Command.vb @@ -65,4 +65,5 @@ Public Class Command End Sub #End Region ' ICommand Members + End Class \ No newline at end of file diff --git a/Command/RelayCommand.vb b/Command/RelayCommand.vb index f000571..8347848 100644 --- a/Command/RelayCommand.vb +++ b/Command/RelayCommand.vb @@ -1,71 +1,68 @@ -Namespace EgtCAM5 - - ''' - ''' 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'. - ''' - Public Class RelayCommand - Implements ICommand +''' +''' 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'. +''' +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" - ''' - ''' Creates a new command that can always execute. - ''' - ''' The execution logic. - Public Sub New(ByVal execute As Action(Of Object)) - Me.New(execute, Nothing) - End Sub + ''' + ''' Creates a new command that can always execute. + ''' + ''' The execution logic. + Public Sub New(ByVal execute As Action(Of Object)) + Me.New(execute, Nothing) + End Sub - ''' - ''' Creates a new command. - ''' - ''' The execution logic. - ''' The execution status logic. - 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 + ''' + ''' Creates a new command. + ''' + ''' The execution logic. + ''' The execution status logic. + 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" - _ - Public Function CanExecute(ByVal parameter As Object) As Boolean Implements ICommand.CanExecute - Return If(_canExecute Is Nothing, True, _canExecute(parameter)) - End Function + _ + 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 \ No newline at end of file +End Class \ No newline at end of file diff --git a/DoorsPanel/DoorPanelVM.vb b/DoorsPanel/DoorPanelVM.vb index 4e09dd0..abdb91a 100644 --- a/DoorsPanel/DoorPanelVM.vb +++ b/DoorsPanel/DoorPanelVM.vb @@ -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" - ''' - ''' Returns a command that do Import. - ''' - 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 + ''' + ''' Returns a command that do Import. + ''' + 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 - ''' - ''' Execute the Door. This method is invoked by the DoorsCommand. - ''' - Public Sub Doors(ByVal param As Object) - Application.Msn.NotifyColleagues(Application.DOORSSCRIPT, String.Empty) - End Sub + ''' + ''' Execute the Door. This method is invoked by the DoorsCommand. + ''' + Public Sub Doors(ByVal param As Object) + Application.Msn.NotifyColleagues(Application.DOORSSCRIPT, String.Empty) + End Sub #End Region ' DoorsCommand #Region "OpenMruDoorCommand" - ''' - ''' Returns a command that do Open. - ''' - 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 + ''' + ''' Returns a command that do Open. + ''' + 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 - ''' - ''' Execute the Open. This method is invoked by the OpenCommand. - ''' - Public Shared Sub OpenMruDoor(ByVal param As Object) - Application.Msn.NotifyColleagues(Application.DOORSSCRIPT, DirectCast(param, String).Replace("__", "_")) - End Sub + ''' + ''' Execute the Open. This method is invoked by the OpenCommand. + ''' + Public Shared Sub OpenMruDoor(ByVal param As Object) + Application.Msn.NotifyColleagues(Application.DOORSSCRIPT, DirectCast(param, String).Replace("__", "_")) + End Sub #End Region ' OpenMruFileCommand #Region "DMachCommand" - ''' - ''' Returns a command that do Import. - ''' - 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 + ''' + ''' Returns a command that do Import. + ''' + 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 - ''' - ''' Execute the Dmach. This method is invoked by the DMachCommand. - ''' - Public Sub DMach(ByVal param As Object) - Application.Msn.NotifyColleagues(Application.DMACHSCRIPT) - End Sub + ''' + ''' Execute the Dmach. This method is invoked by the DMachCommand. + ''' + Public Sub DMach(ByVal param As Object) + Application.Msn.NotifyColleagues(Application.DMACHSCRIPT) + End Sub #End Region ' DMachCommand #Region "MTableDbCommand" - ''' - ''' Returns a command that do Exec. - ''' - 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 - - ''' - ''' Execute the Exec. This method is invoked by the ExecCommand. - ''' - 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 + ''' + ''' Returns a command that do Exec. + ''' + 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() + ''' + ''' Execute the Exec. This method is invoked by the ExecCommand. + ''' + 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 \ No newline at end of file +End Class \ No newline at end of file diff --git a/DrawPanel/DrawPanelVM.vb b/DrawPanel/DrawPanelVM.vb index a76a309..f885114 100644 --- a/DrawPanel/DrawPanelVM.vb +++ b/DrawPanel/DrawPanelVM.vb @@ -1,407 +1,405 @@ Imports EgtUILib -Namespace EgtCAM5 +Public Class DrawPanelVM + Inherits ViewModelBase - Public Class DrawPanelVM - Inherits ViewModelBase - - Private WithEvents IdleTimer As New System.Windows.Threading.DispatcherTimer(TimeSpan.FromMilliseconds(200), Windows.Threading.DispatcherPriority.ApplicationIdle, AddressOf OnIdle, Application.Current.Dispatcher) + Private WithEvents IdleTimer As New System.Windows.Threading.DispatcherTimer(TimeSpan.FromMilliseconds(200), Windows.Threading.DispatcherPriority.ApplicationIdle, AddressOf OnIdle, Application.Current.Dispatcher) #Region "FIELDS & PROPERTIES" #Region "Messages" - Public ReadOnly Property Draw2DMsg As String - Get - Return EgtMsg(MSG_DRAWPANEL + 44) - End Get - End Property - Public ReadOnly Property Draw3DMsg As String - Get - Return EgtMsg(MSG_DRAWPANEL + 45) - End Get - End Property - Public ReadOnly Property ModifyMsg As String - Get - Return EgtMsg(MSG_DRAWPANEL + 46) - End Get - End Property - Public ReadOnly Property TransformMsg As String - Get - Return EgtMsg(MSG_DRAWPANEL + 47) - End Get - End Property + Public ReadOnly Property Draw2DMsg As String + Get + Return EgtMsg(MSG_DRAWPANEL + 44) + End Get + End Property + Public ReadOnly Property Draw3DMsg As String + Get + Return EgtMsg(MSG_DRAWPANEL + 45) + End Get + End Property + Public ReadOnly Property ModifyMsg As String + Get + Return EgtMsg(MSG_DRAWPANEL + 46) + End Get + End Property + Public ReadOnly Property TransformMsg As String + Get + Return EgtMsg(MSG_DRAWPANEL + 47) + End Get + End Property #End Region ' Messages #Region "ToolTip" - 'Proprietà ToolTip - Public ReadOnly Property PointToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 1) - End Get - End Property - Public ReadOnly Property Line2PToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 2) - End Get - End Property - Public ReadOnly Property LinePDLToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 3) - End Get - End Property - Public ReadOnly Property CirclePDToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 4) - End Get - End Property - Public ReadOnly Property CircleCDToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 5) - End Get - End Property - Public ReadOnly Property ArcCSEToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 6) - End Get - End Property - Public ReadOnly Property Arc3PToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 7) - End Get - End Property - Public ReadOnly Property ArcPDPToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 8) - End Get - End Property - Public ReadOnly Property FilletToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 9) - End Get - End Property - Public ReadOnly Property ChamferToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 10) - End Get - End Property - Public ReadOnly Property Rectangle2PToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 11) - End Get - End Property - Public ReadOnly Property PolygonToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 12) - End Get - End Property - Public ReadOnly Property PolygonSideToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 13) - End Get - End Property - Public ReadOnly Property TextToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 14) - End Get - End Property + 'Proprietà ToolTip + Public ReadOnly Property PointToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 1) + End Get + End Property + Public ReadOnly Property Line2PToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 2) + End Get + End Property + Public ReadOnly Property LinePDLToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 3) + End Get + End Property + Public ReadOnly Property CirclePDToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 4) + End Get + End Property + Public ReadOnly Property CircleCDToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 5) + End Get + End Property + Public ReadOnly Property ArcCSEToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 6) + End Get + End Property + Public ReadOnly Property Arc3PToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 7) + End Get + End Property + Public ReadOnly Property ArcPDPToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 8) + End Get + End Property + Public ReadOnly Property FilletToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 9) + End Get + End Property + Public ReadOnly Property ChamferToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 10) + End Get + End Property + Public ReadOnly Property Rectangle2PToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 11) + End Get + End Property + Public ReadOnly Property PolygonToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 12) + End Get + End Property + Public ReadOnly Property PolygonSideToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 13) + End Get + End Property + Public ReadOnly Property TextToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 14) + End Get + End Property - Public ReadOnly Property PlaneToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 15) - End Get - End Property - Public ReadOnly Property ExtrudeToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 16) - End Get - End Property - Public ReadOnly Property RevolveToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 17) - End Get - End Property - Public ReadOnly Property ScrewToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 18) - End Get - End Property - Public ReadOnly Property RuledToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 19) - End Get - End Property - Public ReadOnly Property MergeSurfToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 20) - End Get - End Property - Public ReadOnly Property ExplodeSurfToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 21) - End Get - End Property - Public ReadOnly Property InvertSurfToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 22) - End Get - End Property + Public ReadOnly Property PlaneToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 15) + End Get + End Property + Public ReadOnly Property ExtrudeToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 16) + End Get + End Property + Public ReadOnly Property RevolveToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 17) + End Get + End Property + Public ReadOnly Property ScrewToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 18) + End Get + End Property + Public ReadOnly Property RuledToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 19) + End Get + End Property + Public ReadOnly Property MergeSurfToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 20) + End Get + End Property + Public ReadOnly Property ExplodeSurfToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 21) + End Get + End Property + Public ReadOnly Property InvertSurfToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 22) + End Get + End Property - Public ReadOnly Property DeleteToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 23) - End Get - End Property + Public ReadOnly Property DeleteToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 23) + End Get + End Property - Public ReadOnly Property ChangeLayerToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 24) - End Get - End Property - Public ReadOnly Property ChangeAlphaToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 25) - End Get - End Property - Public ReadOnly Property ResetColorToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 26) - End Get - End Property - Public ReadOnly Property ChangeColorToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 27) - End Get - End Property + Public ReadOnly Property ChangeLayerToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 24) + End Get + End Property + Public ReadOnly Property ChangeAlphaToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 25) + End Get + End Property + Public ReadOnly Property ResetColorToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 26) + End Get + End Property + Public ReadOnly Property ChangeColorToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 27) + End Get + End Property - Public ReadOnly Property InvertCurveToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 28) - End Get - End Property - Public ReadOnly Property ChangeStartToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 29) - End Get - End Property - Public ReadOnly Property ExtendCurveToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 30) - End Get - End Property - Public ReadOnly Property BreakCurveToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 31) - End Get - End Property - Public ReadOnly Property SplitCurveToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 32) - End Get - End Property + Public ReadOnly Property InvertCurveToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 28) + End Get + End Property + Public ReadOnly Property ChangeStartToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 29) + End Get + End Property + Public ReadOnly Property ExtendCurveToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 30) + End Get + End Property + Public ReadOnly Property BreakCurveToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 31) + End Get + End Property + Public ReadOnly Property SplitCurveToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 32) + End Get + End Property - Public ReadOnly Property JoinCurveToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 33) - End Get - End Property - Public ReadOnly Property ExplodeCurveToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 34) - End Get - End Property - Public ReadOnly Property ThickCurveToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 35) - End Get - End Property + Public ReadOnly Property JoinCurveToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 33) + End Get + End Property + Public ReadOnly Property ExplodeCurveToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 34) + End Get + End Property + Public ReadOnly Property ThickCurveToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 35) + End Get + End Property - Public ReadOnly Property MoveToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 36) - End Get - End Property - Public ReadOnly Property RotateToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 37) - End Get - End Property - Public ReadOnly Property Rotate3DToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 38) - End Get - End Property - Public ReadOnly Property MirrorToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 39) - End Get - End Property - Public ReadOnly Property Mirror3DToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 40) - End Get - End Property - Public ReadOnly Property ScaleToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 41) - End Get - End Property - Public ReadOnly Property Scale3DToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 42) - End Get - End Property + Public ReadOnly Property MoveToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 36) + End Get + End Property + Public ReadOnly Property RotateToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 37) + End Get + End Property + Public ReadOnly Property Rotate3DToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 38) + End Get + End Property + Public ReadOnly Property MirrorToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 39) + End Get + End Property + Public ReadOnly Property Mirror3DToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 40) + End Get + End Property + Public ReadOnly Property ScaleToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 41) + End Get + End Property + Public ReadOnly Property Scale3DToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 42) + End Get + End Property - Public ReadOnly Property OffsetToolTip As String - Get - Return EgtMsg(MSG_DRAWPANEL + 43) - End Get - End Property + Public ReadOnly Property OffsetToolTip As String + Get + Return EgtMsg(MSG_DRAWPANEL + 43) + End Get + End Property #End Region ' ToolTip - ' Proprietà che permettono di aprire e chiudere gli expander - Private m_Draw2DIsExpanded As Boolean - Public Property Draw2DIsExpanded As Boolean - Get - Return m_Draw2DIsExpanded - End Get - Set(value As Boolean) - m_Draw2DIsExpanded = value - End Set - End Property + ' Proprietà che permettono di aprire e chiudere gli expander + Private m_Draw2DIsExpanded As Boolean + Public Property Draw2DIsExpanded As Boolean + Get + Return m_Draw2DIsExpanded + End Get + Set(value As Boolean) + m_Draw2DIsExpanded = value + End Set + End Property - Private m_Draw3DIsExpanded As Boolean - Public Property Draw3DIsExpanded As Boolean - Get - Return m_Draw3DIsExpanded - End Get - Set(value As Boolean) - m_Draw3DIsExpanded = value - End Set - End Property + Private m_Draw3DIsExpanded As Boolean + Public Property Draw3DIsExpanded As Boolean + Get + Return m_Draw3DIsExpanded + End Get + Set(value As Boolean) + m_Draw3DIsExpanded = value + End Set + End Property - Private m_ModifyIsExpanded As Boolean - Public Property ModifyIsExpanded As Boolean - Get - Return m_ModifyIsExpanded - End Get - Set(value As Boolean) - m_ModifyIsExpanded = value - End Set - End Property + Private m_ModifyIsExpanded As Boolean + Public Property ModifyIsExpanded As Boolean + Get + Return m_ModifyIsExpanded + End Get + Set(value As Boolean) + m_ModifyIsExpanded = value + End Set + End Property - Private m_TransformIsExpanded As Boolean - Public Property TransformIsExpanded As Boolean - Get - Return m_TransformIsExpanded - End Get - Set(value As Boolean) - m_TransformIsExpanded = value - End Set - End Property + Private m_TransformIsExpanded As Boolean + Public Property TransformIsExpanded As Boolean + Get + Return m_TransformIsExpanded + End Get + Set(value As Boolean) + m_TransformIsExpanded = value + End Set + End Property #Region "Button state" - Private m_bLayerOk As Boolean - Public Property bLayerOk As Boolean - Get - Return m_bLayerOk - End Get - Set(value As Boolean) - m_bLayerOk = value - OnPropertyChanged("bLayerOk") - End Set - End Property - Private m_bSelOk As Boolean - Public Property bSelOk As Boolean - Get - Return m_bSelOk - End Get - Set(value As Boolean) - m_bSelOk = value - OnPropertyChanged("bSelOk") - End Set - End Property - Private m_bLayerOkAndSelOk As Boolean - Public Property bLayerOkAndSelOk As Boolean - Get - Return m_bLayerOkAndSelOk - End Get - Set(value As Boolean) - m_bLayerOkAndSelOk = value - OnPropertyChanged("bLayerOkAndSelOk") - End Set - End Property + Private m_bLayerOk As Boolean + Public Property bLayerOk As Boolean + Get + Return m_bLayerOk + End Get + Set(value As Boolean) + m_bLayerOk = value + OnPropertyChanged("bLayerOk") + End Set + End Property + Private m_bSelOk As Boolean + Public Property bSelOk As Boolean + Get + Return m_bSelOk + End Get + Set(value As Boolean) + m_bSelOk = value + OnPropertyChanged("bSelOk") + End Set + End Property + Private m_bLayerOkAndSelOk As Boolean + Public Property bLayerOkAndSelOk As Boolean + Get + Return m_bLayerOkAndSelOk + End Get + Set(value As Boolean) + m_bLayerOkAndSelOk = value + OnPropertyChanged("bLayerOkAndSelOk") + End Set + End Property #End Region ' Button state - ' Definizione comandi - Private m_cmdPoint As ICommand - Private m_cmdLine2P As ICommand - Private m_cmdLinePDL As ICommand - Private m_cmdCircleCP As ICommand - Private m_cmdCircleCD As ICommand - Private m_cmdArcCSE As ICommand - Private m_cmdArc3P As ICommand - Private m_cmdArcPDP As ICommand - Private m_cmdFillet As ICommand - Private m_cmdChamfer As ICommand - Private m_cmdRectangle2P As ICommand - Private m_cmdPolygon As ICommand - Private m_cmdPolygonSide As ICommand - Private m_cmdText As ICommand - Private m_cmdPlane As ICommand - Private m_cmdExtrude As ICommand - Private m_cmdRevolve As ICommand - Private m_cmdScrew As ICommand - Private m_cmdRuled As ICommand - Private m_cmdMergeSurf As ICommand - Private m_cmdExplodeSurf As ICommand - Private m_cmdInvertSurf As ICommand - Private m_cmdDelete As ICommand - Private m_cmdChangeLayer As ICommand - Private m_cmdChangeAlpha As ICommand - Private m_cmdResetColor As ICommand - Private m_cmdChangeColor As ICommand - Private m_cmdInvertCurve As ICommand - Private m_cmdChangeStartCurve As ICommand - Private m_cmdExtendCurve As ICommand - Private m_cmdBreakCurve As ICommand - Private m_cmdSplitCurve As ICommand - Private m_cmdJoinCurve As ICommand - Private m_cmdExplodeCurve As ICommand - Private m_cmdSetCurveTh As ICommand - Private m_cmdMove As ICommand - Private m_cmdRotate As ICommand - Private m_cmdRotate3D As ICommand - Private m_cmdMirror As ICommand - Private m_cmdMirror3D As ICommand - Private m_cmdScale As ICommand - Private m_cmdScale3D As ICommand - Private m_cmdOffset As ICommand + ' Definizione comandi + Private m_cmdPoint As ICommand + Private m_cmdLine2P As ICommand + Private m_cmdLinePDL As ICommand + Private m_cmdCircleCP As ICommand + Private m_cmdCircleCD As ICommand + Private m_cmdArcCSE As ICommand + Private m_cmdArc3P As ICommand + Private m_cmdArcPDP As ICommand + Private m_cmdFillet As ICommand + Private m_cmdChamfer As ICommand + Private m_cmdRectangle2P As ICommand + Private m_cmdPolygon As ICommand + Private m_cmdPolygonSide As ICommand + Private m_cmdText As ICommand + Private m_cmdPlane As ICommand + Private m_cmdExtrude As ICommand + Private m_cmdRevolve As ICommand + Private m_cmdScrew As ICommand + Private m_cmdRuled As ICommand + Private m_cmdMergeSurf As ICommand + Private m_cmdExplodeSurf As ICommand + Private m_cmdInvertSurf As ICommand + Private m_cmdDelete As ICommand + Private m_cmdChangeLayer As ICommand + Private m_cmdChangeAlpha As ICommand + Private m_cmdResetColor As ICommand + Private m_cmdChangeColor As ICommand + Private m_cmdInvertCurve As ICommand + Private m_cmdChangeStartCurve As ICommand + Private m_cmdExtendCurve As ICommand + Private m_cmdBreakCurve As ICommand + Private m_cmdSplitCurve As ICommand + Private m_cmdJoinCurve As ICommand + Private m_cmdExplodeCurve As ICommand + Private m_cmdSetCurveTh As ICommand + Private m_cmdMove As ICommand + Private m_cmdRotate As ICommand + Private m_cmdRotate3D As ICommand + Private m_cmdMirror As ICommand + Private m_cmdMirror3D As ICommand + Private m_cmdScale As ICommand + Private m_cmdScale3D As ICommand + Private m_cmdOffset As ICommand #End Region ' Fileds & Properties #Region "CONSTRUCTOR" - Sub New() - ' Leggo stato expander da file ini - Draw2DIsExpanded = If(GetPrivateProfileInt(S_GENERAL, K_DRAW2D, 0) = 0, False, True) - Draw3DIsExpanded = If(GetPrivateProfileInt(S_GENERAL, K_DRAW3D, 0) = 0, False, True) - ModifyIsExpanded = If(GetPrivateProfileInt(S_GENERAL, K_MODIFY, 0) = 0, False, True) - TransformIsExpanded = If(GetPrivateProfileInt(S_GENERAL, K_TRANSFORM, 0) = 0, False, True) - Application.Msn.Register(Application.CLOSEAPPLICATION, Sub() - If Not IniFile.m_bFailedRun Then - WritePrivateProfileString(S_GENERAL, K_DRAW2D, If(m_Draw2DIsExpanded, "1", "0")) - WritePrivateProfileString(S_GENERAL, K_DRAW3D, If(m_Draw3DIsExpanded, "1", "0")) - WritePrivateProfileString(S_GENERAL, K_MODIFY, If(m_ModifyIsExpanded, "1", "0")) - WritePrivateProfileString(S_GENERAL, K_TRANSFORM, If(m_TransformIsExpanded, "1", "0")) - End If - End Sub) - End Sub + Sub New() + ' Leggo stato expander da file ini + Draw2DIsExpanded = If(GetPrivateProfileInt(S_GENERAL, K_DRAW2D, 0) = 0, False, True) + Draw3DIsExpanded = If(GetPrivateProfileInt(S_GENERAL, K_DRAW3D, 0) = 0, False, True) + ModifyIsExpanded = If(GetPrivateProfileInt(S_GENERAL, K_MODIFY, 0) = 0, False, True) + TransformIsExpanded = If(GetPrivateProfileInt(S_GENERAL, K_TRANSFORM, 0) = 0, False, True) + Application.Msn.Register(Application.CLOSEAPPLICATION, Sub() + If Not IniFile.m_bFailedRun Then + WritePrivateProfileString(S_GENERAL, K_DRAW2D, If(m_Draw2DIsExpanded, "1", "0")) + WritePrivateProfileString(S_GENERAL, K_DRAW3D, If(m_Draw3DIsExpanded, "1", "0")) + WritePrivateProfileString(S_GENERAL, K_MODIFY, If(m_ModifyIsExpanded, "1", "0")) + WritePrivateProfileString(S_GENERAL, K_TRANSFORM, If(m_TransformIsExpanded, "1", "0")) + End If + End Sub) + End Sub #End Region ' Constructor @@ -409,1050 +407,1048 @@ Namespace EgtCAM5 #Region "PointCommand" - ''' - ''' Returns a command that do Point. - ''' - Public ReadOnly Property PointCommand As ICommand - Get - If m_cmdPoint Is Nothing Then - m_cmdPoint = New RelayCommand(AddressOf Point) - End If - Return m_cmdPoint - End Get - End Property - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - Public Sub Point(ByVal param As Object) - If (Keyboard.Modifiers And ModifierKeys.Control) = ModifierKeys.Control Then - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.FRAME) - ElseIf (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.VECTOR) - Else - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.POINT) + ''' + ''' Returns a command that do Point. + ''' + Public ReadOnly Property PointCommand As ICommand + Get + If m_cmdPoint Is Nothing Then + m_cmdPoint = New RelayCommand(AddressOf Point) End If - End Sub + Return m_cmdPoint + End Get + End Property + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + Public Sub Point(ByVal param As Object) + If (Keyboard.Modifiers And ModifierKeys.Control) = ModifierKeys.Control Then + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.FRAME) + ElseIf (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.VECTOR) + Else + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.POINT) + End If + End Sub #End Region ' PointCommand #Region "Line2PCommand" - ''' - ''' Returns a command that do Line2P. - ''' - Public ReadOnly Property Line2PCommand As ICommand - Get - If m_cmdLine2P Is Nothing Then - m_cmdLine2P = New RelayCommand(AddressOf Line2P) - End If - Return m_cmdLine2P - End Get - End Property - - ''' - ''' Execute the Line2P. This method is invoked by the Line2PCommand. - ''' - Public Sub Line2P(ByVal param As Object) - If (Keyboard.Modifiers And ModifierKeys.Control) = ModifierKeys.Control Then - Map.refProjectVM.GetController.SetContinue() - 'EmitStripStatusOutput(EgtMsg(399)) ' Continue : 'L' with line, 'A' with arc + ''' + ''' Returns a command that do Line2P. + ''' + Public ReadOnly Property Line2PCommand As ICommand + Get + If m_cmdLine2P Is Nothing Then + m_cmdLine2P = New RelayCommand(AddressOf Line2P) End If - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.LINE2P) - End Sub + Return m_cmdLine2P + End Get + End Property + + ''' + ''' Execute the Line2P. This method is invoked by the Line2PCommand. + ''' + Public Sub Line2P(ByVal param As Object) + If (Keyboard.Modifiers And ModifierKeys.Control) = ModifierKeys.Control Then + Map.refProjectVM.GetController.SetContinue() + 'EmitStripStatusOutput(EgtMsg(399)) ' Continue : 'L' with line, 'A' with arc + End If + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.LINE2P) + End Sub #End Region ' Line2PCommand #Region "LinePDLCommand" - ''' - ''' Returns a command that do LinePDL. - ''' - Public ReadOnly Property LinePDLCommand As ICommand - Get - If m_cmdLinePDL Is Nothing Then - m_cmdLinePDL = New RelayCommand(AddressOf LinePDL) - End If - Return m_cmdLinePDL - End Get - End Property - - ''' - ''' Execute the LinePDL. This method is invoked by the LinePDLCommand. - ''' - Public Sub LinePDL(ByVal param As Object) - If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.LINEPDL) - Else - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.LINEPVL) + ''' + ''' Returns a command that do LinePDL. + ''' + Public ReadOnly Property LinePDLCommand As ICommand + Get + If m_cmdLinePDL Is Nothing Then + m_cmdLinePDL = New RelayCommand(AddressOf LinePDL) End If - End Sub + Return m_cmdLinePDL + End Get + End Property + + ''' + ''' Execute the LinePDL. This method is invoked by the LinePDLCommand. + ''' + Public Sub LinePDL(ByVal param As Object) + If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.LINEPDL) + Else + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.LINEPVL) + End If + End Sub #End Region ' LinePDLCommand #Region "CircleCPCommand" - ''' - ''' Returns a command that do CircleCP. - ''' - Public ReadOnly Property CircleCPCommand As ICommand - Get - If m_cmdCircleCP Is Nothing Then - m_cmdCircleCP = New RelayCommand(AddressOf CircleCP) - End If - Return m_cmdCircleCP - End Get - End Property + ''' + ''' Returns a command that do CircleCP. + ''' + Public ReadOnly Property CircleCPCommand As ICommand + Get + If m_cmdCircleCP Is Nothing Then + m_cmdCircleCP = New RelayCommand(AddressOf CircleCP) + End If + Return m_cmdCircleCP + End Get + End Property - ''' - ''' Execute the CircleCP. This method is invoked by the CircleCPCommand. - ''' - Public Sub CircleCP(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.CIRCLECP) - End Sub + ''' + ''' Execute the CircleCP. This method is invoked by the CircleCPCommand. + ''' + Public Sub CircleCP(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.CIRCLECP) + End Sub #End Region ' CircleCPCommand #Region "CircleCDCommand" - ''' - ''' Returns a command that do CircleCD. - ''' - Public ReadOnly Property CircleCDCommand As ICommand - Get - If m_cmdCircleCD Is Nothing Then - m_cmdCircleCD = New RelayCommand(AddressOf CircleCD) - End If - Return m_cmdCircleCD - End Get - End Property + ''' + ''' Returns a command that do CircleCD. + ''' + Public ReadOnly Property CircleCDCommand As ICommand + Get + If m_cmdCircleCD Is Nothing Then + m_cmdCircleCD = New RelayCommand(AddressOf CircleCD) + End If + Return m_cmdCircleCD + End Get + End Property - ''' - ''' Execute the CircleCD. This method is invoked by the CircleCDCommand. - ''' - Public Sub CircleCD(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.CIRCLECD) - End Sub + ''' + ''' Execute the CircleCD. This method is invoked by the CircleCDCommand. + ''' + Public Sub CircleCD(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.CIRCLECD) + End Sub #End Region ' CircleCDCommand #Region "ArcCSECommand" - ''' - ''' Returns a command that do ArcCSE. - ''' - Public ReadOnly Property ArcCSECommand As ICommand - Get - If m_cmdArcCSE Is Nothing Then - m_cmdArcCSE = New RelayCommand(AddressOf ArcCSE) - End If - Return m_cmdArcCSE - End Get - End Property + ''' + ''' Returns a command that do ArcCSE. + ''' + Public ReadOnly Property ArcCSECommand As ICommand + Get + If m_cmdArcCSE Is Nothing Then + m_cmdArcCSE = New RelayCommand(AddressOf ArcCSE) + End If + Return m_cmdArcCSE + End Get + End Property - ''' - ''' Execute the ArcCSE. This method is invoked by the ArcCSECommand. - ''' - Public Sub ArcCSE(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.ARCCSE) - End Sub + ''' + ''' Execute the ArcCSE. This method is invoked by the ArcCSECommand. + ''' + Public Sub ArcCSE(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.ARCCSE) + End Sub #End Region ' ArcCSECommand #Region "Arc3PCommand" - ''' - ''' Returns a command that do Arc3P. - ''' - Public ReadOnly Property Arc3PCommand As ICommand - Get - If m_cmdArc3P Is Nothing Then - m_cmdArc3P = New RelayCommand(AddressOf Arc3P) - End If - Return m_cmdArc3P - End Get - End Property + ''' + ''' Returns a command that do Arc3P. + ''' + Public ReadOnly Property Arc3PCommand As ICommand + Get + If m_cmdArc3P Is Nothing Then + m_cmdArc3P = New RelayCommand(AddressOf Arc3P) + End If + Return m_cmdArc3P + End Get + End Property - ''' - ''' Execute the Arc3P. This method is invoked by the Arc3PCommand. - ''' - Public Sub Arc3P(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.ARC3P) - End Sub + ''' + ''' Execute the Arc3P. This method is invoked by the Arc3PCommand. + ''' + Public Sub Arc3P(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.ARC3P) + End Sub #End Region ' Arc3PCommand #Region "ArcPDPCommand" - ''' - ''' Returns a command that do ArcPDP. - ''' - Public ReadOnly Property ArcPDPCommand As ICommand - Get - If m_cmdArcPDP Is Nothing Then - m_cmdArcPDP = New RelayCommand(AddressOf ArcPDP) - End If - Return m_cmdArcPDP - End Get - End Property - - ''' - ''' Execute the ArcPDP. This method is invoked by the ArcPDPCommand. - ''' - Public Sub ArcPDP(ByVal param As Object) - If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then - If (Keyboard.Modifiers And ModifierKeys.Control) = ModifierKeys.Control Then - Map.refProjectVM.GetController.SetContinue() - 'EmitStripStatusOutput(EgtMsg(399)) ' Continue : 'L' with line, 'A' with arc - End If - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.ARCPDP) - Else - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.ARCPVP) + ''' + ''' Returns a command that do ArcPDP. + ''' + Public ReadOnly Property ArcPDPCommand As ICommand + Get + If m_cmdArcPDP Is Nothing Then + m_cmdArcPDP = New RelayCommand(AddressOf ArcPDP) End If - End Sub + Return m_cmdArcPDP + End Get + End Property + + ''' + ''' Execute the ArcPDP. This method is invoked by the ArcPDPCommand. + ''' + Public Sub ArcPDP(ByVal param As Object) + If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then + If (Keyboard.Modifiers And ModifierKeys.Control) = ModifierKeys.Control Then + Map.refProjectVM.GetController.SetContinue() + 'EmitStripStatusOutput(EgtMsg(399)) ' Continue : 'L' with line, 'A' with arc + End If + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.ARCPDP) + Else + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.ARCPVP) + End If + End Sub #End Region ' ArcPDPCommand #Region "FilletCommand" - ''' - ''' Returns a command that do Fillet. - ''' - Public ReadOnly Property FilletCommand As ICommand - Get - If m_cmdFillet Is Nothing Then - m_cmdFillet = New RelayCommand(AddressOf Fillet) - End If - Return m_cmdFillet - End Get - End Property + ''' + ''' Returns a command that do Fillet. + ''' + Public ReadOnly Property FilletCommand As ICommand + Get + If m_cmdFillet Is Nothing Then + m_cmdFillet = New RelayCommand(AddressOf Fillet) + End If + Return m_cmdFillet + End Get + End Property - ''' - ''' Execute the Fillet. This method is invoked by the FilletCommand. - ''' - Public Sub Fillet(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.FILLET) - End Sub + ''' + ''' Execute the Fillet. This method is invoked by the FilletCommand. + ''' + Public Sub Fillet(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.FILLET) + End Sub #End Region ' FilletCommand #Region "ChamferCommand" - ''' - ''' Returns a command that do Chamfer. - ''' - Public ReadOnly Property ChamferCommand As ICommand - Get - If m_cmdChamfer Is Nothing Then - m_cmdChamfer = New RelayCommand(AddressOf Chamfer) - End If - Return m_cmdChamfer - End Get - End Property + ''' + ''' Returns a command that do Chamfer. + ''' + Public ReadOnly Property ChamferCommand As ICommand + Get + If m_cmdChamfer Is Nothing Then + m_cmdChamfer = New RelayCommand(AddressOf Chamfer) + End If + Return m_cmdChamfer + End Get + End Property - ''' - ''' Execute the Chamfer. This method is invoked by the ChamferCommand. - ''' - Public Sub Chamfer(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.CHAMFER) - End Sub + ''' + ''' Execute the Chamfer. This method is invoked by the ChamferCommand. + ''' + Public Sub Chamfer(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.CHAMFER) + End Sub #End Region ' ChamferCommand #Region "Rectangle2PCommand" - ''' - ''' Returns a command that do Rectangle2P. - ''' - Public ReadOnly Property Rectangle2PCommand As ICommand - Get - If m_cmdRectangle2P Is Nothing Then - m_cmdRectangle2P = New RelayCommand(AddressOf Rectangle2P) - End If - Return m_cmdRectangle2P - End Get - End Property + ''' + ''' Returns a command that do Rectangle2P. + ''' + Public ReadOnly Property Rectangle2PCommand As ICommand + Get + If m_cmdRectangle2P Is Nothing Then + m_cmdRectangle2P = New RelayCommand(AddressOf Rectangle2P) + End If + Return m_cmdRectangle2P + End Get + End Property - ''' - ''' Execute the Rectangle2P. This method is invoked by the Rectangle2PCommand. - ''' - Public Sub Rectangle2P(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.RECTANGLE2P) - End Sub + ''' + ''' Execute the Rectangle2P. This method is invoked by the Rectangle2PCommand. + ''' + Public Sub Rectangle2P(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.RECTANGLE2P) + End Sub #End Region ' Rectangle2PCommand #Region "PolygonCommand" - ''' - ''' Returns a command that do Polygon. - ''' - Public ReadOnly Property PolygonCommand As ICommand - Get - If m_cmdPolygon Is Nothing Then - m_cmdPolygon = New RelayCommand(AddressOf Polygon) - End If - Return m_cmdPolygon - End Get - End Property + ''' + ''' Returns a command that do Polygon. + ''' + Public ReadOnly Property PolygonCommand As ICommand + Get + If m_cmdPolygon Is Nothing Then + m_cmdPolygon = New RelayCommand(AddressOf Polygon) + End If + Return m_cmdPolygon + End Get + End Property - ''' - ''' Execute the Polygon. This method is invoked by the PolygonCommand. - ''' - Public Sub Polygon(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.POLYGON) - End Sub + ''' + ''' Execute the Polygon. This method is invoked by the PolygonCommand. + ''' + Public Sub Polygon(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.POLYGON) + End Sub #End Region ' PolygonCommand #Region "PolygonSideCommand" - ''' - ''' Returns a command that do PolygonSide. - ''' - Public ReadOnly Property PolygonSideCommand As ICommand - Get - If m_cmdPolygonSide Is Nothing Then - m_cmdPolygonSide = New RelayCommand(AddressOf PolygonSide) - End If - Return m_cmdPolygonSide - End Get - End Property + ''' + ''' Returns a command that do PolygonSide. + ''' + Public ReadOnly Property PolygonSideCommand As ICommand + Get + If m_cmdPolygonSide Is Nothing Then + m_cmdPolygonSide = New RelayCommand(AddressOf PolygonSide) + End If + Return m_cmdPolygonSide + End Get + End Property - ''' - ''' Execute the PolygonSide. This method is invoked by the PolygonSideCommand. - ''' - Public Sub PolygonSide(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.POLYGONSIDE) - End Sub + ''' + ''' Execute the PolygonSide. This method is invoked by the PolygonSideCommand. + ''' + Public Sub PolygonSide(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.POLYGONSIDE) + End Sub #End Region ' PolygonSideCommand #Region "TextCommand" - ''' - ''' Returns a command that do Text. - ''' - Public ReadOnly Property TextCommand As ICommand - Get - If m_cmdText Is Nothing Then - m_cmdText = New RelayCommand(AddressOf Text) - End If - Return m_cmdText - End Get - End Property - - ''' - ''' Execute the Text. This method is invoked by the TextCommand. - ''' - Public Sub Text(ByVal param As Object) - If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.TEXT) - Else - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.TEXTPLUS) + ''' + ''' Returns a command that do Text. + ''' + Public ReadOnly Property TextCommand As ICommand + Get + If m_cmdText Is Nothing Then + m_cmdText = New RelayCommand(AddressOf Text) End If - End Sub + Return m_cmdText + End Get + End Property + + ''' + ''' Execute the Text. This method is invoked by the TextCommand. + ''' + Public Sub Text(ByVal param As Object) + If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.TEXT) + Else + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.TEXTPLUS) + End If + End Sub #End Region ' TextCommand #Region "PlaneCommand" - ''' - ''' Returns a command that do Plane. - ''' - Public ReadOnly Property PlaneCommand As ICommand - Get - If m_cmdPlane Is Nothing Then - m_cmdPlane = New RelayCommand(AddressOf Plane) - End If - Return m_cmdPlane - End Get - End Property - - ''' - ''' Execute the Plane. This method is invoked by the PlaneCommand. - ''' - Public Sub Plane(ByVal param As Object) - If (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.REGION) - Else - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.PLANE) + ''' + ''' Returns a command that do Plane. + ''' + Public ReadOnly Property PlaneCommand As ICommand + Get + If m_cmdPlane Is Nothing Then + m_cmdPlane = New RelayCommand(AddressOf Plane) End If - End Sub + Return m_cmdPlane + End Get + End Property + + ''' + ''' Execute the Plane. This method is invoked by the PlaneCommand. + ''' + Public Sub Plane(ByVal param As Object) + If (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift Then + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.REGION) + Else + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.PLANE) + End If + End Sub #End Region ' PlaneCommand #Region "ExtrudeCommand" - ''' - ''' Returns a command that do Extrude. - ''' - Public ReadOnly Property ExtrudeCommand As ICommand - Get - If m_cmdExtrude Is Nothing Then - m_cmdExtrude = New RelayCommand(AddressOf Extrude) - End If - Return m_cmdExtrude - End Get - End Property + ''' + ''' Returns a command that do Extrude. + ''' + Public ReadOnly Property ExtrudeCommand As ICommand + Get + If m_cmdExtrude Is Nothing Then + m_cmdExtrude = New RelayCommand(AddressOf Extrude) + End If + Return m_cmdExtrude + End Get + End Property - ''' - ''' Execute the Extrude. This method is invoked by the ExtrudeCommand. - ''' - Public Sub Extrude(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.EXTRUDE) - End Sub + ''' + ''' Execute the Extrude. This method is invoked by the ExtrudeCommand. + ''' + Public Sub Extrude(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.EXTRUDE) + End Sub #End Region ' ExtrudeCommand #Region "RevolveCommand" - ''' - ''' Returns a command that do Revolve. - ''' - Public ReadOnly Property RevolveCommand As ICommand - Get - If m_cmdRevolve Is Nothing Then - m_cmdRevolve = New RelayCommand(AddressOf Revolve) - End If - Return m_cmdRevolve - End Get - End Property + ''' + ''' Returns a command that do Revolve. + ''' + Public ReadOnly Property RevolveCommand As ICommand + Get + If m_cmdRevolve Is Nothing Then + m_cmdRevolve = New RelayCommand(AddressOf Revolve) + End If + Return m_cmdRevolve + End Get + End Property - ''' - ''' Execute the Revolve. This method is invoked by the RevolveCommand. - ''' - Public Sub Revolve(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.REVOLVE) - End Sub + ''' + ''' Execute the Revolve. This method is invoked by the RevolveCommand. + ''' + Public Sub Revolve(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.REVOLVE) + End Sub #End Region ' RevolveCommand #Region "ScrewCommand" - ''' - ''' Returns a command that do Screw. - ''' - Public ReadOnly Property ScrewCommand As ICommand - Get - If m_cmdScrew Is Nothing Then - m_cmdScrew = New RelayCommand(AddressOf Screw) - End If - Return m_cmdScrew - End Get - End Property + ''' + ''' Returns a command that do Screw. + ''' + Public ReadOnly Property ScrewCommand As ICommand + Get + If m_cmdScrew Is Nothing Then + m_cmdScrew = New RelayCommand(AddressOf Screw) + End If + Return m_cmdScrew + End Get + End Property - ''' - ''' Execute the Screw. This method is invoked by the ScrewCommand. - ''' - Public Sub Screw(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.SCREW) - End Sub + ''' + ''' Execute the Screw. This method is invoked by the ScrewCommand. + ''' + Public Sub Screw(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.SCREW) + End Sub #End Region ' ScrewCommand #Region "RuledCommand" - ''' - ''' Returns a command that do Ruled. - ''' - Public ReadOnly Property RuledCommand As ICommand - Get - If m_cmdRuled Is Nothing Then - m_cmdRuled = New RelayCommand(AddressOf Ruled) - End If - Return m_cmdRuled - End Get - End Property + ''' + ''' Returns a command that do Ruled. + ''' + Public ReadOnly Property RuledCommand As ICommand + Get + If m_cmdRuled Is Nothing Then + m_cmdRuled = New RelayCommand(AddressOf Ruled) + End If + Return m_cmdRuled + End Get + End Property - ''' - ''' Execute the Ruled. This method is invoked by the RuledCommand. - ''' - Public Sub Ruled(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.RULED) - End Sub + ''' + ''' Execute the Ruled. This method is invoked by the RuledCommand. + ''' + Public Sub Ruled(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.RULED) + End Sub #End Region ' RuledCommand #Region "MergeSurfCommand" - ''' - ''' Returns a command that do MergeSurf. - ''' - Public ReadOnly Property MergeSurfCommand As ICommand - Get - If m_cmdMergeSurf Is Nothing Then - m_cmdMergeSurf = New RelayCommand(AddressOf MergeSurf) - End If - Return m_cmdMergeSurf - End Get - End Property + ''' + ''' Returns a command that do MergeSurf. + ''' + Public ReadOnly Property MergeSurfCommand As ICommand + Get + If m_cmdMergeSurf Is Nothing Then + m_cmdMergeSurf = New RelayCommand(AddressOf MergeSurf) + End If + Return m_cmdMergeSurf + End Get + End Property - ''' - ''' Execute the MergeSurf. This method is invoked by the MergeSurfCommand. - ''' - Public Sub MergeSurf(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.MERGESURF) - End Sub + ''' + ''' Execute the MergeSurf. This method is invoked by the MergeSurfCommand. + ''' + Public Sub MergeSurf(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.MERGESURF) + End Sub #End Region ' MergeSurfCommand #Region "ExplodeSurfCommand" - ''' - ''' Returns a command that do ExplodeSurf. - ''' - Public ReadOnly Property ExplodeSurfCommand As ICommand - Get - If m_cmdExplodeSurf Is Nothing Then - m_cmdExplodeSurf = New RelayCommand(AddressOf ExplodeSurf) - End If - Return m_cmdExplodeSurf - End Get - End Property + ''' + ''' Returns a command that do ExplodeSurf. + ''' + Public ReadOnly Property ExplodeSurfCommand As ICommand + Get + If m_cmdExplodeSurf Is Nothing Then + m_cmdExplodeSurf = New RelayCommand(AddressOf ExplodeSurf) + End If + Return m_cmdExplodeSurf + End Get + End Property - ''' - ''' Execute the ExplodeSurf. This method is invoked by the ExplodeSurfCommand. - ''' - Public Sub ExplodeSurf(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.EXPLODESURF) - End Sub + ''' + ''' Execute the ExplodeSurf. This method is invoked by the ExplodeSurfCommand. + ''' + Public Sub ExplodeSurf(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.EXPLODESURF) + End Sub #End Region ' ExplodeSurfCommand #Region "InvertSurfCommand" - ''' - ''' Returns a command that do InvertSurf. - ''' - Public ReadOnly Property InvertSurfCommand As ICommand - Get - If m_cmdInvertSurf Is Nothing Then - m_cmdInvertSurf = New RelayCommand(AddressOf InvertSurf) - End If - Return m_cmdInvertSurf - End Get - End Property + ''' + ''' Returns a command that do InvertSurf. + ''' + Public ReadOnly Property InvertSurfCommand As ICommand + Get + If m_cmdInvertSurf Is Nothing Then + m_cmdInvertSurf = New RelayCommand(AddressOf InvertSurf) + End If + Return m_cmdInvertSurf + End Get + End Property - ''' - ''' Execute the InvertSurf. This method is invoked by the InvertSurfCommand. - ''' - Public Sub InvertSurf(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.INVERTSURF) - End Sub + ''' + ''' Execute the InvertSurf. This method is invoked by the InvertSurfCommand. + ''' + Public Sub InvertSurf(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.INVERTSURF) + End Sub #End Region ' InvertSurfCommand #Region "DeleteCommand" - ''' - ''' Returns a command that do Delete. - ''' - 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 + ''' + ''' Returns a command that do Delete. + ''' + 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 - ''' - ''' Execute the Delete. This method is invoked by the DeleteCommand. - ''' - Public Sub Delete(ByVal param As Object) - Map.refProjectVM.GetController.SetLastInteger(GDB_ID.SEL) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.DELETE) - End Sub + ''' + ''' Execute the Delete. This method is invoked by the DeleteCommand. + ''' + Public Sub Delete(ByVal param As Object) + Map.refProjectVM.GetController.SetLastInteger(GDB_ID.SEL) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.DELETE) + End Sub #End Region ' DeleteCommand #Region "ChangeLayerCommand" - ''' - ''' Returns a command that do ChangeLayer. - ''' - Public ReadOnly Property ChangeLayerCommand As ICommand - Get - If m_cmdChangeLayer Is Nothing Then - m_cmdChangeLayer = New RelayCommand(AddressOf ChangeLayer) - End If - Return m_cmdChangeLayer - End Get - End Property - - ''' - ''' Execute the ChangeLayer. This method is invoked by the ChangeLayerCommand. - ''' - Public Sub ChangeLayer(ByVal param As Object) - If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.CHANGELAYERGLOB) - Else - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.CHANGELAYER) + ''' + ''' Returns a command that do ChangeLayer. + ''' + Public ReadOnly Property ChangeLayerCommand As ICommand + Get + If m_cmdChangeLayer Is Nothing Then + m_cmdChangeLayer = New RelayCommand(AddressOf ChangeLayer) End If - End Sub + Return m_cmdChangeLayer + End Get + End Property + + ''' + ''' Execute the ChangeLayer. This method is invoked by the ChangeLayerCommand. + ''' + Public Sub ChangeLayer(ByVal param As Object) + If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.CHANGELAYERGLOB) + Else + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.CHANGELAYER) + End If + End Sub #End Region ' ChangeLayerCommand #Region "ChangeAlphaCommand" - ''' - ''' Returns a command that do ChangeAlpha. - ''' - Public ReadOnly Property ChangeAlphaCommand As ICommand - Get - If m_cmdChangeAlpha Is Nothing Then - m_cmdChangeAlpha = New RelayCommand(AddressOf ChangeAlpha) - End If - Return m_cmdChangeAlpha - End Get - End Property + ''' + ''' Returns a command that do ChangeAlpha. + ''' + Public ReadOnly Property ChangeAlphaCommand As ICommand + Get + If m_cmdChangeAlpha Is Nothing Then + m_cmdChangeAlpha = New RelayCommand(AddressOf ChangeAlpha) + End If + Return m_cmdChangeAlpha + End Get + End Property - ''' - ''' Execute the ChangeAlpha. This method is invoked by the ChangeAlphaCommand. - ''' - Public Sub ChangeAlpha(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.CHANGEALPHA) - End Sub + ''' + ''' Execute the ChangeAlpha. This method is invoked by the ChangeAlphaCommand. + ''' + Public Sub ChangeAlpha(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.CHANGEALPHA) + End Sub #End Region ' ChangeAlphaCommand #Region "ResetColorCommand" - ''' - ''' Returns a command that do ResetColor. - ''' - Public ReadOnly Property ResetColorCommand As ICommand - Get - If m_cmdResetColor Is Nothing Then - m_cmdResetColor = New RelayCommand(AddressOf ResetColor) - End If - Return m_cmdResetColor - End Get - End Property + ''' + ''' Returns a command that do ResetColor. + ''' + Public ReadOnly Property ResetColorCommand As ICommand + Get + If m_cmdResetColor Is Nothing Then + m_cmdResetColor = New RelayCommand(AddressOf ResetColor) + End If + Return m_cmdResetColor + End Get + End Property - ''' - ''' Execute the ResetColor. This method is invoked by the ResetColorCommand. - ''' - Public Sub ResetColor(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.RESETCOLOR) - End Sub + ''' + ''' Execute the ResetColor. This method is invoked by the ResetColorCommand. + ''' + Public Sub ResetColor(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.RESETCOLOR) + End Sub #End Region ' ResetColorCommand #Region "ChangeColorCommand" - ''' - ''' Returns a command that do ChangeColor. - ''' - Public ReadOnly Property ChangeColorCommand As ICommand - Get - If m_cmdChangeColor Is Nothing Then - m_cmdChangeColor = New RelayCommand(AddressOf ChangeColor) - End If - Return m_cmdChangeColor - End Get - End Property + ''' + ''' Returns a command that do ChangeColor. + ''' + Public ReadOnly Property ChangeColorCommand As ICommand + Get + If m_cmdChangeColor Is Nothing Then + m_cmdChangeColor = New RelayCommand(AddressOf ChangeColor) + End If + Return m_cmdChangeColor + End Get + End Property - ''' - ''' Execute the ChangeColor. This method is invoked by the ChangeColorCommand. - ''' - Public Sub ChangeColor(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.CHANGECOLOR) - End Sub + ''' + ''' Execute the ChangeColor. This method is invoked by the ChangeColorCommand. + ''' + Public Sub ChangeColor(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.CHANGECOLOR) + End Sub #End Region ' ChangeColorCommand #Region "InvertCurveCommand" - ''' - ''' Returns a command that do InvertCurve. - ''' - Public ReadOnly Property InvertCurveCommand As ICommand - Get - If m_cmdInvertCurve Is Nothing Then - m_cmdInvertCurve = New RelayCommand(AddressOf InvertCurve) - End If - Return m_cmdInvertCurve - End Get - End Property + ''' + ''' Returns a command that do InvertCurve. + ''' + Public ReadOnly Property InvertCurveCommand As ICommand + Get + If m_cmdInvertCurve Is Nothing Then + m_cmdInvertCurve = New RelayCommand(AddressOf InvertCurve) + End If + Return m_cmdInvertCurve + End Get + End Property - ''' - ''' Execute the InvertCurve. This method is invoked by the InvertCurveCommand. - ''' - Public Sub InvertCurve(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.INVERTCURVE) - End Sub + ''' + ''' Execute the InvertCurve. This method is invoked by the InvertCurveCommand. + ''' + Public Sub InvertCurve(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.INVERTCURVE) + End Sub #End Region ' InvertCurveCommand #Region "ChangeStartCurveCommand" - ''' - ''' Returns a command that do ChangeStartCurve. - ''' - Public ReadOnly Property ChangeStartCurveCommand As ICommand - Get - If m_cmdChangeStartCurve Is Nothing Then - m_cmdChangeStartCurve = New RelayCommand(AddressOf ChangeStartCurve) - End If - Return m_cmdChangeStartCurve - End Get - End Property + ''' + ''' Returns a command that do ChangeStartCurve. + ''' + Public ReadOnly Property ChangeStartCurveCommand As ICommand + Get + If m_cmdChangeStartCurve Is Nothing Then + m_cmdChangeStartCurve = New RelayCommand(AddressOf ChangeStartCurve) + End If + Return m_cmdChangeStartCurve + End Get + End Property - ''' - ''' Execute the ChangeStartCurve. This method is invoked by the InvertCurveCommand. - ''' - Public Sub ChangeStartCurve(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.CHANGESTARTCURVE) - End Sub + ''' + ''' Execute the ChangeStartCurve. This method is invoked by the InvertCurveCommand. + ''' + Public Sub ChangeStartCurve(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.CHANGESTARTCURVE) + End Sub #End Region ' ChangeStartCurveCommand #Region "ExtendCurveCommand" - ''' - ''' Returns a command that do ExtendCurve. - ''' - Public ReadOnly Property ExtendCurveCommand As ICommand - Get - If m_cmdExtendCurve Is Nothing Then - m_cmdExtendCurve = New RelayCommand(AddressOf ExtendCurve) - End If - Return m_cmdExtendCurve - End Get - End Property + ''' + ''' Returns a command that do ExtendCurve. + ''' + Public ReadOnly Property ExtendCurveCommand As ICommand + Get + If m_cmdExtendCurve Is Nothing Then + m_cmdExtendCurve = New RelayCommand(AddressOf ExtendCurve) + End If + Return m_cmdExtendCurve + End Get + End Property - ''' - ''' Execute the ExtendCurve. This method is invoked by the ExtendCurveCommand. - ''' - Public Sub ExtendCurve(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.TRIMEXTENDCURVE) - End Sub + ''' + ''' Execute the ExtendCurve. This method is invoked by the ExtendCurveCommand. + ''' + Public Sub ExtendCurve(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.TRIMEXTENDCURVE) + End Sub #End Region ' ExtendCurveCommand #Region "BreakCurveCommand" - ''' - ''' Returns a command that do BreakCurve. - ''' - Public ReadOnly Property BreakCurveCommand As ICommand - Get - If m_cmdBreakCurve Is Nothing Then - m_cmdBreakCurve = New RelayCommand(AddressOf BreakCurve) - End If - Return m_cmdBreakCurve - End Get - End Property + ''' + ''' Returns a command that do BreakCurve. + ''' + Public ReadOnly Property BreakCurveCommand As ICommand + Get + If m_cmdBreakCurve Is Nothing Then + m_cmdBreakCurve = New RelayCommand(AddressOf BreakCurve) + End If + Return m_cmdBreakCurve + End Get + End Property - ''' - ''' Execute the BreakCurve. This method is invoked by the BreakCurveCommand. - ''' - Public Sub BreakCurve(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.BREAKCURVE) - End Sub + ''' + ''' Execute the BreakCurve. This method is invoked by the BreakCurveCommand. + ''' + Public Sub BreakCurve(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.BREAKCURVE) + End Sub #End Region ' BreakCurveCommand #Region "SplitCurveCommand" - ''' - ''' Returns a command that do SplitCurve. - ''' - Public ReadOnly Property SplitCurveCommand As ICommand - Get - If m_cmdSplitCurve Is Nothing Then - m_cmdSplitCurve = New RelayCommand(AddressOf SplitCurve) - End If - Return m_cmdSplitCurve - End Get - End Property + ''' + ''' Returns a command that do SplitCurve. + ''' + Public ReadOnly Property SplitCurveCommand As ICommand + Get + If m_cmdSplitCurve Is Nothing Then + m_cmdSplitCurve = New RelayCommand(AddressOf SplitCurve) + End If + Return m_cmdSplitCurve + End Get + End Property - ''' - ''' Execute the SplitCurve. This method is invoked by the SplitCurveCommand. - ''' - Public Sub SplitCurve(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.SPLITCURVE) - End Sub + ''' + ''' Execute the SplitCurve. This method is invoked by the SplitCurveCommand. + ''' + Public Sub SplitCurve(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.SPLITCURVE) + End Sub #End Region ' SplitCurveCommand #Region "JoinCurveCommand" - ''' - ''' Returns a command that do JoinCurve. - ''' - Public ReadOnly Property JoinCurveCommand As ICommand - Get - If m_cmdJoinCurve Is Nothing Then - m_cmdJoinCurve = New RelayCommand(AddressOf JoinCurve) - End If - Return m_cmdJoinCurve - End Get - End Property - - ''' - ''' Execute the JoinCurve. This method is invoked by the JoinCurveCommand. - ''' - Public Sub JoinCurve(ByVal param As Object) - If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then - Map.refProjectVM.GetController.SetLastBoolean(False) - Else - Map.refProjectVM.GetController.SetLastBoolean(True) + ''' + ''' Returns a command that do JoinCurve. + ''' + Public ReadOnly Property JoinCurveCommand As ICommand + Get + If m_cmdJoinCurve Is Nothing Then + m_cmdJoinCurve = New RelayCommand(AddressOf JoinCurve) End If - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.JOINCURVE) - End Sub + Return m_cmdJoinCurve + End Get + End Property + + ''' + ''' Execute the JoinCurve. This method is invoked by the JoinCurveCommand. + ''' + Public Sub JoinCurve(ByVal param As Object) + If (Keyboard.Modifiers And ModifierKeys.Shift) <> ModifierKeys.Shift Then + Map.refProjectVM.GetController.SetLastBoolean(False) + Else + Map.refProjectVM.GetController.SetLastBoolean(True) + End If + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.JOINCURVE) + End Sub #End Region ' JoinCurveCommand #Region "ExplodeCurveCommand" - ''' - ''' Returns a command that do ExplodeCurve. - ''' - Public ReadOnly Property ExplodeCurveCommand As ICommand - Get - If m_cmdExplodeCurve Is Nothing Then - m_cmdExplodeCurve = New RelayCommand(AddressOf ExplodeCurve) - End If - Return m_cmdExplodeCurve - End Get - End Property + ''' + ''' Returns a command that do ExplodeCurve. + ''' + Public ReadOnly Property ExplodeCurveCommand As ICommand + Get + If m_cmdExplodeCurve Is Nothing Then + m_cmdExplodeCurve = New RelayCommand(AddressOf ExplodeCurve) + End If + Return m_cmdExplodeCurve + End Get + End Property - ''' - ''' Execute the ExplodeCurve. This method is invoked by the ExplodeCurveCommand. - ''' - Public Sub ExplodeCurve(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.EXPLODECURVE) - End Sub + ''' + ''' Execute the ExplodeCurve. This method is invoked by the ExplodeCurveCommand. + ''' + Public Sub ExplodeCurve(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.EXPLODECURVE) + End Sub #End Region ' ExplodeCurveCommand #Region "SetCurveThCommand" - ''' - ''' Returns a command that do SetCurveTh. - ''' - Public ReadOnly Property SetCurveThCommand As ICommand - Get - If m_cmdSetCurveTh Is Nothing Then - m_cmdSetCurveTh = New RelayCommand(AddressOf SetCurveTh) - End If - Return m_cmdSetCurveTh - End Get - End Property + ''' + ''' Returns a command that do SetCurveTh. + ''' + Public ReadOnly Property SetCurveThCommand As ICommand + Get + If m_cmdSetCurveTh Is Nothing Then + m_cmdSetCurveTh = New RelayCommand(AddressOf SetCurveTh) + End If + Return m_cmdSetCurveTh + End Get + End Property - ''' - ''' Execute the SetCurveTh. This method is invoked by the SetCurveThCommand. - ''' - Public Sub SetCurveTh(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.SETCURVETHICKNESS) - End Sub + ''' + ''' Execute the SetCurveTh. This method is invoked by the SetCurveThCommand. + ''' + Public Sub SetCurveTh(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.SETCURVETHICKNESS) + End Sub #End Region ' SetCurveThCommand #Region "MoveCommand" - ''' - ''' Returns a command that do Move. - ''' - Public ReadOnly Property MoveCommand As ICommand - Get - If m_cmdMove Is Nothing Then - m_cmdMove = New RelayCommand(AddressOf Move) - End If - Return m_cmdMove - End Get - End Property + ''' + ''' Returns a command that do Move. + ''' + Public ReadOnly Property MoveCommand As ICommand + Get + If m_cmdMove Is Nothing Then + m_cmdMove = New RelayCommand(AddressOf Move) + End If + Return m_cmdMove + End Get + End Property - ''' - ''' Execute the Move. This method is invoked by the MoveCommand. - ''' - Public Sub Move(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.MOVE) - End Sub + ''' + ''' Execute the Move. This method is invoked by the MoveCommand. + ''' + Public Sub Move(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.MOVE) + End Sub #End Region ' MoveCommand #Region "RotateCommand" - ''' - ''' Returns a command that do Rotate. - ''' - Public ReadOnly Property RotateCommand As ICommand - Get - If m_cmdRotate Is Nothing Then - m_cmdRotate = New RelayCommand(AddressOf Rotate) - End If - Return m_cmdRotate - End Get - End Property + ''' + ''' Returns a command that do Rotate. + ''' + Public ReadOnly Property RotateCommand As ICommand + Get + If m_cmdRotate Is Nothing Then + m_cmdRotate = New RelayCommand(AddressOf Rotate) + End If + Return m_cmdRotate + End Get + End Property - ''' - ''' Execute the Rotate. This method is invoked by the RotateCommand. - ''' - Public Sub Rotate(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.ROTATE) - End Sub + ''' + ''' Execute the Rotate. This method is invoked by the RotateCommand. + ''' + Public Sub Rotate(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.ROTATE) + End Sub #End Region ' RotateCommand #Region "Rotate3DCommand" - ''' - ''' Returns a command that do Rotate3D. - ''' - Public ReadOnly Property Rotate3DCommand As ICommand - Get - If m_cmdRotate3D Is Nothing Then - m_cmdRotate3D = New RelayCommand(AddressOf Rotate3D) - End If - Return m_cmdRotate3D - End Get - End Property + ''' + ''' Returns a command that do Rotate3D. + ''' + Public ReadOnly Property Rotate3DCommand As ICommand + Get + If m_cmdRotate3D Is Nothing Then + m_cmdRotate3D = New RelayCommand(AddressOf Rotate3D) + End If + Return m_cmdRotate3D + End Get + End Property - ''' - ''' Execute the Rotate3D. This method is invoked by the Rotate3DCommand. - ''' - Public Sub Rotate3D(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.ROTATE3D) - End Sub + ''' + ''' Execute the Rotate3D. This method is invoked by the Rotate3DCommand. + ''' + Public Sub Rotate3D(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.ROTATE3D) + End Sub #End Region ' Rotate3DCommand #Region "MirrorCommand" - ''' - ''' Returns a command that do Mirror. - ''' - Public ReadOnly Property MirrorCommand As ICommand - Get - If m_cmdMirror Is Nothing Then - m_cmdMirror = New RelayCommand(AddressOf Mirror) - End If - Return m_cmdMirror - End Get - End Property + ''' + ''' Returns a command that do Mirror. + ''' + Public ReadOnly Property MirrorCommand As ICommand + Get + If m_cmdMirror Is Nothing Then + m_cmdMirror = New RelayCommand(AddressOf Mirror) + End If + Return m_cmdMirror + End Get + End Property - ''' - ''' Execute the Mirror. This method is invoked by the MirrorCommand. - ''' - Public Sub Mirror(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.MIRROR) - End Sub + ''' + ''' Execute the Mirror. This method is invoked by the MirrorCommand. + ''' + Public Sub Mirror(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.MIRROR) + End Sub #End Region ' MirrorCommand #Region "Mirror3DCommand" - ''' - ''' Returns a command that do Mirror3D. - ''' - Public ReadOnly Property Mirror3DCommand As ICommand - Get - If m_cmdMirror3D Is Nothing Then - m_cmdMirror3D = New RelayCommand(AddressOf Mirror3D) - End If - Return m_cmdMirror3D - End Get - End Property + ''' + ''' Returns a command that do Mirror3D. + ''' + Public ReadOnly Property Mirror3DCommand As ICommand + Get + If m_cmdMirror3D Is Nothing Then + m_cmdMirror3D = New RelayCommand(AddressOf Mirror3D) + End If + Return m_cmdMirror3D + End Get + End Property - ''' - ''' Execute the Mirror3D. This method is invoked by the Mirror3DCommand. - ''' - Public Sub Mirror3D(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.MIRROR3D) - End Sub + ''' + ''' Execute the Mirror3D. This method is invoked by the Mirror3DCommand. + ''' + Public Sub Mirror3D(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.MIRROR3D) + End Sub #End Region ' Mirror3DCommand #Region "ScaleCommand" - ''' - ''' Returns a command that do Scale. - ''' - Public ReadOnly Property ScaleCommand As ICommand - Get - If m_cmdScale Is Nothing Then - m_cmdScale = New RelayCommand(AddressOf Scale) - End If - Return m_cmdScale - End Get - End Property + ''' + ''' Returns a command that do Scale. + ''' + Public ReadOnly Property ScaleCommand As ICommand + Get + If m_cmdScale Is Nothing Then + m_cmdScale = New RelayCommand(AddressOf Scale) + End If + Return m_cmdScale + End Get + End Property - ''' - ''' Execute the Scale. This method is invoked by the ScaleCommand. - ''' - Public Sub Scale(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.SCALE) - End Sub + ''' + ''' Execute the Scale. This method is invoked by the ScaleCommand. + ''' + Public Sub Scale(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.SCALE) + End Sub #End Region ' ScaleCommand #Region "Scale3DCommand" - ''' - ''' Returns a command that do Scale3D. - ''' - Public ReadOnly Property Scale3DCommand As ICommand - Get - If m_cmdScale3D Is Nothing Then - m_cmdScale3D = New RelayCommand(AddressOf Scale3D) - End If - Return m_cmdScale3D - End Get - End Property + ''' + ''' Returns a command that do Scale3D. + ''' + Public ReadOnly Property Scale3DCommand As ICommand + Get + If m_cmdScale3D Is Nothing Then + m_cmdScale3D = New RelayCommand(AddressOf Scale3D) + End If + Return m_cmdScale3D + End Get + End Property - ''' - ''' Execute the Scale3D. This method is invoked by the Scale3DCommand. - ''' - Public Sub Scale3D(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.SCALE3D) - End Sub + ''' + ''' Execute the Scale3D. This method is invoked by the Scale3DCommand. + ''' + Public Sub Scale3D(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.SCALE3D) + End Sub #End Region ' Scale3DCommand #Region "OffsetCommand" - ''' - ''' Returns a command that do Offset. - ''' - Public ReadOnly Property OffsetCommand As ICommand - Get - If m_cmdOffset Is Nothing Then - m_cmdOffset = New RelayCommand(AddressOf Offset) - End If - Return m_cmdOffset - End Get - End Property + ''' + ''' Returns a command that do Offset. + ''' + Public ReadOnly Property OffsetCommand As ICommand + Get + If m_cmdOffset Is Nothing Then + m_cmdOffset = New RelayCommand(AddressOf Offset) + End If + Return m_cmdOffset + End Get + End Property - ''' - ''' Execute the Offset. This method is invoked by the OffsetCommand. - ''' - Public Sub Offset(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.OFFSET) - End Sub + ''' + ''' Execute the Offset. This method is invoked by the OffsetCommand. + ''' + Public Sub Offset(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.OFFSET) + End Sub #End Region ' OffsetCommand #End Region ' Commands - Private Sub OnIdle() - If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then - bLayerOk = Map.refProjectVM.GetController.GetCurrLayer <> GDB_ID.NULL - If Not IniFile.m_ProjectSceneContext = 0 Then - bSelOk = EgtGetFirstSelectedObj() <> GDB_ID.NULL - bLayerOkAndSelOk = m_bLayerOk And m_bSelOk - End If - - If Application.m_UpdateLayerTree Then - Application.Msn.NotifyColleagues(Application.LOADOBJTREE) - Application.m_UpdateLayerTree = False - End If + Private Sub OnIdle() + If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then + bLayerOk = Map.refProjectVM.GetController.GetCurrLayer <> GDB_ID.NULL + If Not IniFile.m_ProjectSceneContext = 0 Then + bSelOk = EgtGetFirstSelectedObj() <> GDB_ID.NULL + bLayerOkAndSelOk = m_bLayerOk And m_bSelOk End If - End Sub - End Class + If Application.m_UpdateLayerTree Then + Application.Msn.NotifyColleagues(Application.LOADOBJTREE) + Application.m_UpdateLayerTree = False + End If + End If + End Sub -End Namespace \ No newline at end of file +End Class \ No newline at end of file diff --git a/EgtCAM5.vbproj b/EgtCAM5.vbproj index ea273bf..fb5fbad 100644 --- a/EgtCAM5.vbproj +++ b/EgtCAM5.vbproj @@ -206,26 +206,26 @@ MachGroupPanelV.xaml - - MachiningTreeExpanderView.xaml + + MachiningTreeExpanderV.xaml - - FixtureParametersView.xaml + + FixtureParametersV.xaml - - - RawPartOptionView.xaml + + + RawPartOptionV.xaml - - + + - - - DispositionParameterExpanderView.xaml + + + DispositionParameterExpanderV.xaml - - MachiningParameterExpanderView.xaml + + MachiningParameterExpanderV.xaml @@ -254,25 +254,25 @@ OptionPanelV.xaml - - InfoExpanderView.xaml + + InfoExpanderV.xaml - - - InputExpanderView.xaml + + + InputExpanderV.xaml - - + + - - ManageLayerExpanderView.xaml + + ManageLayerExpanderV.xaml - + - - OperationExpanderView.xaml + + OperationExpanderV.xaml - + SimulationExpanderView.xaml @@ -381,19 +381,19 @@ Designer MSBuild:Compile - + Designer MSBuild:Compile - + Designer MSBuild:Compile - + Designer MSBuild:Compile - + Designer MSBuild:Compile @@ -421,23 +421,23 @@ Designer MSBuild:Compile - + Designer MSBuild:Compile - + Designer MSBuild:Compile - + Designer MSBuild:Compile - + MSBuild:Compile Designer - + Designer MSBuild:Compile diff --git a/ExecutePanel/ExecutePanelVM.vb b/ExecutePanel/ExecutePanelVM.vb index 37c4174..0fe3ab8 100644 --- a/ExecutePanel/ExecutePanelVM.vb +++ b/ExecutePanel/ExecutePanelVM.vb @@ -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" - ''' - ''' Returns a command that do Exec. - ''' - Public ReadOnly Property ExecCommand As ICommand - Get - If m_cmdExec Is Nothing Then - m_cmdExec = New RelayCommand(AddressOf Exec) - End If - Return m_cmdExec - End Get - End Property + ''' + ''' Returns a command that do Exec. + ''' + Public ReadOnly Property ExecCommand As ICommand + Get + If m_cmdExec Is Nothing Then + m_cmdExec = New RelayCommand(AddressOf Exec) + End If + Return m_cmdExec + End Get + End Property - ''' - ''' Execute the Exec. This method is invoked by the ExecCommand. - ''' - Public Sub Exec(ByVal param As Object) - Application.Msn.NotifyColleagues(Application.PREEXECSCRIPT, True) - Application.Msn.NotifyColleagues(Application.EXECSCRIPT, String.Empty) - End Sub + ''' + ''' Execute the Exec. This method is invoked by the ExecCommand. + ''' + 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" - ''' - ''' Returns a command that do Open. - ''' - 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 + ''' + ''' Returns a command that do Open. + ''' + 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 - ''' - ''' Execute the Open. This method is invoked by the OpenCommand. - ''' - 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 + ''' + ''' Execute the Open. This method is invoked by the OpenCommand. + ''' + 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 \ No newline at end of file +End Class \ No newline at end of file diff --git a/GridPanel/GridPanelVM.vb b/GridPanel/GridPanelVM.vb index a859322..10b3910 100644 --- a/GridPanel/GridPanelVM.vb +++ b/GridPanel/GridPanelVM.vb @@ -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" - ''' - ''' Returns a command that do CPlaneTop. - ''' - 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 + ''' + ''' Returns a command that do CPlaneTop. + ''' + 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 - ''' - ''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand. - ''' - Public Sub CPlaneTop(ByVal param As Object) - Map.refProjectVM.GetController.SetLastInteger(Controller.GRID_TYPE.TOP) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID) - End Sub + ''' + ''' Execute the CPlaneTop. This method is invoked by the CPlaneTopCommand. + ''' + 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" - ''' - ''' Returns a command that do CPlaneFront. - ''' - 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 + ''' + ''' Returns a command that do CPlaneFront. + ''' + 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 - ''' - ''' Execute the CPlaneFront. This method is invoked by the CPlaneFrontCommand. - ''' - Public Sub CPlaneFront(ByVal param As Object) - Map.refProjectVM.GetController.SetLastInteger(Controller.GRID_TYPE.FRONT) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID) - End Sub + ''' + ''' Execute the CPlaneFront. This method is invoked by the CPlaneFrontCommand. + ''' + 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" - ''' - ''' Returns a command that do CPlaneRight. - ''' - 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 + ''' + ''' Returns a command that do CPlaneRight. + ''' + 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 - ''' - ''' Execute the CPlaneRight. This method is invoked by the CPlaneRightCommand. - ''' - Public Sub CPlaneRight(ByVal param As Object) - Map.refProjectVM.GetController.SetLastInteger(Controller.GRID_TYPE.RIGHT) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID) - End Sub + ''' + ''' Execute the CPlaneRight. This method is invoked by the CPlaneRightCommand. + ''' + 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" - ''' - ''' Returns a command that do CPlaneBack. - ''' - 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 + ''' + ''' Returns a command that do CPlaneBack. + ''' + 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 - ''' - ''' Execute the CPlaneBack. This method is invoked by the CPlaneBackCommand. - ''' - Public Sub CPlaneBack(ByVal param As Object) - Map.refProjectVM.GetController.SetLastInteger(Controller.GRID_TYPE.BACK) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID) - End Sub + ''' + ''' Execute the CPlaneBack. This method is invoked by the CPlaneBackCommand. + ''' + 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" - ''' - ''' Returns a command that do CPlaneLeft. - ''' - 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 + ''' + ''' Returns a command that do CPlaneLeft. + ''' + 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 - ''' - ''' Execute the CPlaneLeft. This method is invoked by the CPlaneLeftCommand. - ''' - Public Sub CPlaneLeft(ByVal param As Object) - Map.refProjectVM.GetController.SetLastInteger(Controller.GRID_TYPE.LEFT) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID) - End Sub + ''' + ''' Execute the CPlaneLeft. This method is invoked by the CPlaneLeftCommand. + ''' + 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" - ''' - ''' Returns a command that do CPlaneBottom. - ''' - 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 + ''' + ''' Returns a command that do CPlaneBottom. + ''' + 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 - ''' - ''' Execute the CPlaneBottom. This method is invoked by the CPlaneBottomCommand. - ''' - Public Sub CPlaneBottom(ByVal param As Object) - Map.refProjectVM.GetController.SetLastInteger(Controller.GRID_TYPE.BOTTOM) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID) - End Sub + ''' + ''' Execute the CPlaneBottom. This method is invoked by the CPlaneBottomCommand. + ''' + 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" - ''' - ''' Returns a command that do CPlaneElevation. - ''' - 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 + ''' + ''' Returns a command that do CPlaneElevation. + ''' + 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 - ''' - ''' Execute the CPlaneElevation. This method is invoked by the CPlaneElevationCommand. - ''' - Public Sub CPlaneElevation(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID_ELEVATION) - End Sub + ''' + ''' Execute the CPlaneElevation. This method is invoked by the CPlaneElevationCommand. + ''' + Public Sub CPlaneElevation(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID_ELEVATION) + End Sub #End Region ' CPlaneElevationCommand #Region "CPlaneOriginCommand" - ''' - ''' Returns a command that do CPlaneOrigin. - ''' - 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 + ''' + ''' Returns a command that do CPlaneOrigin. + ''' + 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 - ''' - ''' Execute the CPlaneOrigin. This method is invoked by the CPlaneOriginCommand. - ''' - Public Sub CPlaneOrigin(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID_ORIGIN) - End Sub + ''' + ''' Execute the CPlaneOrigin. This method is invoked by the CPlaneOriginCommand. + ''' + 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 \ No newline at end of file +End Class \ No newline at end of file diff --git a/GunStockPanel/GunStockPanelVM.vb b/GunStockPanel/GunStockPanelVM.vb index 8c2216b..0bdcb8e 100644 --- a/GunStockPanel/GunStockPanelVM.vb +++ b/GunStockPanel/GunStockPanelVM.vb @@ -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" - ''' - ''' Returns a command that do Import. - ''' - 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 + ''' + ''' Returns a command that do Import. + ''' + 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 - ''' - ''' Execute the Door. This method is invoked by the DoorsCommand. - ''' - Public Sub NewGunStock(ByVal param As Object) - Application.Msn.NotifyColleagues(Application.GUNSTOCKNEW, String.Empty) - End Sub + ''' + ''' Execute the Door. This method is invoked by the DoorsCommand. + ''' + Public Sub NewGunStock(ByVal param As Object) + Application.Msn.NotifyColleagues(Application.GUNSTOCKNEW, String.Empty) + End Sub #End Region ' NewGunStockCommand #Region "ModifyGunStockCommand" - ''' - ''' Returns a command that do Import. - ''' - 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 + ''' + ''' Returns a command that do Import. + ''' + 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 - ''' - ''' Execute the Door. This method is invoked by the DoorsCommand. - ''' - Public Sub ModifyGunStock(ByVal param As Object) - Application.Msn.NotifyColleagues(Application.GUNSTOCKMODIF, String.Empty) - End Sub + ''' + ''' Execute the Door. This method is invoked by the DoorsCommand. + ''' + Public Sub ModifyGunStock(ByVal param As Object) + Application.Msn.NotifyColleagues(Application.GUNSTOCKMODIF, String.Empty) + End Sub #End Region ' ModifyGunStockCommand #Region "OpenMruNewGunStockCommand" - ''' - ''' Returns a command that do Open. - ''' - 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 + ''' + ''' Returns a command that do Open. + ''' + 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 - ''' - ''' Execute the Open. This method is invoked by the OpenCommand. - ''' - Public Shared Sub OpenMruNewGunStock(ByVal param As Object) - Application.Msn.NotifyColleagues(Application.GUNSTOCKNEW, DirectCast(param, String).Replace("__", "_")) - End Sub + ''' + ''' Execute the Open. This method is invoked by the OpenCommand. + ''' + Public Shared Sub OpenMruNewGunStock(ByVal param As Object) + Application.Msn.NotifyColleagues(Application.GUNSTOCKNEW, DirectCast(param, String).Replace("__", "_")) + End Sub #End Region ' OpenMruNewGunStockCommand #Region "OpenMruModifyGunStockCommand" - ''' - ''' Returns a command that do Open. - ''' - 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 + ''' + ''' Returns a command that do Open. + ''' + 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 - ''' - ''' Execute the Open. This method is invoked by the OpenCommand. - ''' - Public Shared Sub OpenMruModifyGunStock(ByVal param As Object) - Application.Msn.NotifyColleagues(Application.GUNSTOCKMODIF, DirectCast(param, String).Replace("__", "_")) - End Sub + ''' + ''' Execute the Open. This method is invoked by the OpenCommand. + ''' + 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 \ No newline at end of file +End Class \ No newline at end of file diff --git a/InstrumentPanel/InstrumentPanelVM.vb b/InstrumentPanel/InstrumentPanelVM.vb index eeb22e5..de56c7a 100644 --- a/InstrumentPanel/InstrumentPanelVM.vb +++ b/InstrumentPanel/InstrumentPanelVM.vb @@ -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 \ No newline at end of file +End Class \ No newline at end of file diff --git a/Internals/MruList.vb b/Internals/MruList.vb index 0e17aae..e20cc46 100644 --- a/Internals/MruList.vb +++ b/Internals/MruList.vb @@ -13,7 +13,6 @@ '-------------------------------------------------------------------------------------------------- Imports System.Collections.ObjectModel -'Imports EgtCAM5.EgtCAM5 Public Class MruList diff --git a/MTableDb/MTableDbV.xaml.vb b/MTableDb/MTableDbV.xaml.vb index 656f4c2..5c5fac1 100644 --- a/MTableDb/MTableDbV.xaml.vb +++ b/MTableDb/MTableDbV.xaml.vb @@ -1,6 +1,5 @@ Imports System.Windows Imports System.Windows.Controls.Primitives -Imports EgtCAM5.EgtCAM5 Imports EgtWPFLib5 Public Class MTableDbV diff --git a/MachGroupPanel/MachGroupPanelVM.vb b/MachGroupPanel/MachGroupPanelVM.vb index 2fb8775..0d9cea7 100644 --- a/MachGroupPanel/MachGroupPanelVM.vb +++ b/MachGroupPanel/MachGroupPanelVM.vb @@ -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" - ''' - ''' Returns a command that set the selected MachGroup as the Current one. - ''' - 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 + ''' + ''' Returns a command that set the selected MachGroup as the Current one. + ''' + 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" - ''' - ''' Returns a command that set the selected MachGroup as the Current one. - ''' - 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) + ''' + ''' Returns a command that set the selected MachGroup as the Current one. + ''' + 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" - ''' - ''' Returns a command that set the selected MachGroup as the Current one. - ''' - 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 + ''' + ''' Returns a command that set the selected MachGroup as the Current one. + ''' + 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 \ No newline at end of file +End Class \ No newline at end of file diff --git a/MachOptionsWindow/MachOptionVM.vb b/MachOptionsWindow/MachOptionVM.vb index 3c91a2d..91b0248 100644 --- a/MachOptionsWindow/MachOptionVM.vb +++ b/MachOptionsWindow/MachOptionVM.vb @@ -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" - ''' - ''' Returns a command that remove the current selected machining. - ''' - 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 + ''' + ''' Returns a command that remove the current selected machining. + ''' + 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 - ''' - ''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand. - ''' - 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 + ''' + ''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand. + ''' + 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 diff --git a/MachinePanel/MachinePanelVM.vb b/MachinePanel/MachinePanelVM.vb index 3e4c763..85d0b2c 100644 --- a/MachinePanel/MachinePanelVM.vb +++ b/MachinePanel/MachinePanelVM.vb @@ -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" - ''' - ''' Returns a command that do Exec. - ''' - 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 - - ''' - ''' Execute the Exec. This method is invoked by the ExecCommand. - ''' - 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 + ''' + ''' Returns a command that do Exec. + ''' + 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 + + ''' + ''' Execute the Exec. This method is invoked by the ExecCommand. + ''' + 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" - ''' - ''' Returns a command that do Exec. - ''' - 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 - - ''' - ''' Execute the Exec. This method is invoked by the ExecCommand. - ''' - 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 + ''' + ''' Returns a command that do Exec. + ''' + 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 + + ''' + ''' Execute the Exec. This method is invoked by the ExecCommand. + ''' + 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" - ''' - ''' Returns a command that do Exec. - ''' - 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 + ''' + ''' Returns a command that do Exec. + ''' + 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 - ''' - ''' Execute the Exec. This method is invoked by the ExecCommand. - ''' - 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 + ''' + ''' Execute the Exec. This method is invoked by the ExecCommand. + ''' + 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 \ No newline at end of file +End Class \ No newline at end of file diff --git a/MachiningDbWindow/MachiningDbVM.vb b/MachiningDbWindow/MachiningDbVM.vb index 19ee232..5ae7d3b 100644 --- a/MachiningDbWindow/MachiningDbVM.vb +++ b/MachiningDbWindow/MachiningDbVM.vb @@ -3,449 +3,447 @@ Imports System.Collections.ObjectModel Imports System.IO Imports EgtUILib -Namespace EgtCAM5 +Public Class MachiningDbVM + Inherits TabViewModel - Public Class MachiningDbVM - Inherits TabViewModel + Friend Shared m_bActive As Boolean = False - Friend Shared m_bActive As Boolean = False + Private m_Title As String + Public ReadOnly Property Title As String + Get + Return EgtMsg(MSG_MAINWINDOW + 4) + End Get + End Property - Private m_Title As String - Public ReadOnly Property Title As String - Get - Return EgtMsg(MSG_MAINWINDOW + 4) - End Get - End Property + ' Lista delle lavorazioni + Private m_MachiningsList As New ObservableCollection(Of FamilyMachiningTreeViewItem) + Public Property MachiningsList As ObservableCollection(Of FamilyMachiningTreeViewItem) + Get + Return m_MachiningsList + End Get + Set(value As ObservableCollection(Of FamilyMachiningTreeViewItem)) + m_MachiningsList = value + End Set + End Property - ' Lista delle lavorazioni - Private m_MachiningsList As New ObservableCollection(Of FamilyMachiningTreeViewItem) - Public Property MachiningsList As ObservableCollection(Of FamilyMachiningTreeViewItem) - Get - Return m_MachiningsList - End Get - Set(value As ObservableCollection(Of FamilyMachiningTreeViewItem)) - m_MachiningsList = value - End Set - End Property + Private m_IsEnabledNewBtn As Boolean + Public ReadOnly Property IsEnabledNewBtn As Boolean + Get + Return m_IsEnabledNewBtn + End Get + End Property - Private m_IsEnabledNewBtn As Boolean - Public ReadOnly Property IsEnabledNewBtn As Boolean - Get - Return m_IsEnabledNewBtn - End Get - End Property + Private m_IsEnabledSaveBtn As Boolean + Public ReadOnly Property IsEnabledSaveBtn As Boolean + Get + Return m_IsEnabledSaveBtn + End Get + End Property - Private m_IsEnabledSaveBtn As Boolean - Public ReadOnly Property IsEnabledSaveBtn As Boolean - Get - Return m_IsEnabledSaveBtn - End Get - End Property + Private m_IsEnabledRemoveBtn As Boolean + Public ReadOnly Property IsEnabledRemoveBtn As Boolean + Get + Return m_IsEnabledRemoveBtn + End Get + End Property - Private m_IsEnabledRemoveBtn As Boolean - Public ReadOnly Property IsEnabledRemoveBtn As Boolean - Get - Return m_IsEnabledRemoveBtn - End Get - End Property - - ' Definizione comandi - Private m_cmdNew As ICommand - Private m_cmdSave As ICommand - Private m_cmdRemove As ICommand - Private m_cmdReloadMachining As ICommand - Private m_cmdCloseMachiningsDb As ICommand + ' Definizione comandi + Private m_cmdNew As ICommand + Private m_cmdSave As ICommand + Private m_cmdRemove As ICommand + Private m_cmdReloadMachining As ICommand + Private m_cmdCloseMachiningsDb As ICommand #Region "MESSAGES" - 'Definizione dei messaggi della pagina - Public ReadOnly Property InvertTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 51) - End Get - End Property + 'Definizione dei messaggi della pagina + Public ReadOnly Property InvertTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 51) + End Get + End Property - Public ReadOnly Property LeaveTabTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 52) - End Get - End Property + Public ReadOnly Property LeaveTabTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 52) + End Get + End Property - Public ReadOnly Property WorkSideTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 54) - End Get - End Property + Public ReadOnly Property WorkSideTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 54) + End Get + End Property - Public ReadOnly Property HeadSideTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 55) - End Get - End Property + Public ReadOnly Property HeadSideTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 55) + End Get + End Property - Public ReadOnly Property LeadInTypeTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 56) - End Get - End Property + Public ReadOnly Property LeadInTypeTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 56) + End Get + End Property - Public ReadOnly Property ExtLinkTypeTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 57) - End Get - End Property + Public ReadOnly Property ExtLinkTypeTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 57) + End Get + End Property - Public ReadOnly Property LeadOutTypeTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 58) - End Get - End Property + Public ReadOnly Property LeadOutTypeTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 58) + End Get + End Property - Public ReadOnly Property CurveUseTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 59) - End Get - End Property + Public ReadOnly Property CurveUseTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 59) + End Get + End Property - Public ReadOnly Property StepTypeTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 60) - End Get - End Property + Public ReadOnly Property StepTypeTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 60) + End Get + End Property - Public ReadOnly Property LeadLinkTypeTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 62) - End Get - End Property + Public ReadOnly Property LeadLinkTypeTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 62) + End Get + End Property - Public ReadOnly Property InvertToolDirTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 151) - End Get - End Property + Public ReadOnly Property InvertToolDirTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 151) + End Get + End Property - Public ReadOnly Property FaceUseTypeTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 152) - End Get - End Property + Public ReadOnly Property FaceUseTypeTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 152) + End Get + End Property - Public ReadOnly Property AxRotRefTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 164) - End Get - End Property + Public ReadOnly Property AxRotRefTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 164) + End Get + End Property - Public ReadOnly Property BlockedAxesRefTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 165) - End Get - End Property + Public ReadOnly Property BlockedAxesRefTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 165) + End Get + End Property - Public ReadOnly Property SolChoiceTypeTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 104) - End Get - End Property + Public ReadOnly Property SolChoiceTypeTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 104) + End Get + End Property - Public ReadOnly Property SpeedTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 63) - End Get - End Property + Public ReadOnly Property SpeedTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 63) + End Get + End Property - Public ReadOnly Property FeedTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 64) - End Get - End Property + Public ReadOnly Property FeedTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 64) + End Get + End Property - Public ReadOnly Property StartFeedTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 65) - End Get - End Property + Public ReadOnly Property StartFeedTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 65) + End Get + End Property - Public ReadOnly Property EndFeedTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 66) - End Get - End Property + Public ReadOnly Property EndFeedTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 66) + End Get + End Property - Public ReadOnly Property TipFeedTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 67) - End Get - End Property + Public ReadOnly Property TipFeedTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 67) + End Get + End Property - Public ReadOnly Property OffSrTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 68) - End Get - End Property + Public ReadOnly Property OffSrTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 68) + End Get + End Property - Public ReadOnly Property OffSlTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 69) - End Get - End Property + Public ReadOnly Property OffSlTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 69) + End Get + End Property - Public ReadOnly Property SideAngleTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 71) - End Get - End Property + Public ReadOnly Property SideAngleTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 71) + End Get + End Property - Public ReadOnly Property ApproxTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 72) - End Get - End Property + Public ReadOnly Property ApproxTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 72) + End Get + End Property - Public ReadOnly Property StartPosTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 73) - End Get - End Property + Public ReadOnly Property StartPosTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 73) + End Get + End Property - Public ReadOnly Property StartSlowLenTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 74) - End Get - End Property + Public ReadOnly Property StartSlowLenTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 74) + End Get + End Property - Public ReadOnly Property EndSlowLenTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 75) - End Get - End Property + Public ReadOnly Property EndSlowLenTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 75) + End Get + End Property - Public ReadOnly Property ThrouAddLenTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 76) - End Get - End Property + Public ReadOnly Property ThrouAddLenTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 76) + End Get + End Property - Public ReadOnly Property StepParTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 77) - End Get - End Property + Public ReadOnly Property StepParTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 77) + End Get + End Property - Public ReadOnly Property ReturnPosTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 78) - End Get - End Property + Public ReadOnly Property ReturnPosTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 78) + End Get + End Property - Public ReadOnly Property TabLenTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 79) - End Get - End Property + Public ReadOnly Property TabLenTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 79) + End Get + End Property - Public ReadOnly Property TabDistTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 80) - End Get - End Property + Public ReadOnly Property TabDistTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 80) + End Get + End Property - Public ReadOnly Property TabHeightTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 81) - End Get - End Property + Public ReadOnly Property TabHeightTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 81) + End Get + End Property - Public ReadOnly Property TabAngleTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 82) - End Get - End Property + Public ReadOnly Property TabAngleTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 82) + End Get + End Property - Public ReadOnly Property LiTangTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 83) - End Get - End Property + Public ReadOnly Property LiTangTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 83) + End Get + End Property - Public ReadOnly Property LiPerpTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 84) - End Get - End Property + Public ReadOnly Property LiPerpTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 84) + End Get + End Property - Public ReadOnly Property LiElevTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 85) - End Get - End Property + Public ReadOnly Property LiElevTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 85) + End Get + End Property - Public ReadOnly Property LiCompLenTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 86) - End Get - End Property + Public ReadOnly Property LiCompLenTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 86) + End Get + End Property - Public ReadOnly Property LoTangTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 87) - End Get - End Property + Public ReadOnly Property LoTangTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 87) + End Get + End Property - Public ReadOnly Property LoPerpTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 88) - End Get - End Property + Public ReadOnly Property LoPerpTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 88) + End Get + End Property - Public ReadOnly Property LoElevTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 89) - End Get - End Property + Public ReadOnly Property LoElevTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 89) + End Get + End Property - Public ReadOnly Property LoCompLenTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 90) - End Get - End Property + Public ReadOnly Property LoCompLenTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 90) + End Get + End Property - Public ReadOnly Property StartAddLenTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 91) - End Get - End Property + Public ReadOnly Property StartAddLenTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 91) + End Get + End Property - Public ReadOnly Property EndAddLenTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 92) - End Get - End Property + Public ReadOnly Property EndAddLenTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 92) + End Get + End Property - Public ReadOnly Property StepExtArcTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 93) - End Get - End Property + Public ReadOnly Property StepExtArcTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 93) + End Get + End Property - Public ReadOnly Property StepIntArcTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 94) - End Get - End Property + Public ReadOnly Property StepIntArcTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 94) + End Get + End Property - Public ReadOnly Property SideStepTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 95) - End Get - End Property + Public ReadOnly Property SideStepTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 95) + End Get + End Property - Public ReadOnly Property VertFeedTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 96) - End Get - End Property + Public ReadOnly Property VertFeedTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 96) + End Get + End Property - Public ReadOnly Property NameParTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 97) - End Get - End Property + Public ReadOnly Property NameParTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 97) + End Get + End Property - Public ReadOnly Property ToolTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 98) - End Get - End Property + Public ReadOnly Property ToolTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 98) + End Get + End Property - Public ReadOnly Property DepthStrTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 99) - End Get - End Property + Public ReadOnly Property DepthStrTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 99) + End Get + End Property - Public ReadOnly Property UserNotesTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 100) - End Get - End Property + Public ReadOnly Property UserNotesTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 100) + End Get + End Property - Public ReadOnly Property OverLapTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 101) - End Get - End Property + Public ReadOnly Property OverLapTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 101) + End Get + End Property - Public ReadOnly Property SubTypeTxBl As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 103) - End Get - End Property + Public ReadOnly Property SubTypeTxBl As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 103) + End Get + End Property #End Region #Region "CONSTRUCTOR" - Sub New() + Sub New() - m_bActive = True + m_bActive = True - ' Passo all'item della lista il delegato alla funzuione che permette di cancellare una lavorazione - MachiningTreeViewItem.m_delRemoveMachining = AddressOf RemoveMachining - ' Passo all'item della lista il delegato alla funzuione che permette di disattivare la lista delle lavorazioni - MachiningTreeViewItem.m_delErrorOnMachining = AddressOf ErrorOnMachining - ' Passo all'item della lista il delegato alla funzuione che permette di disattivare la lista delle lavorazioni - MachiningTreeViewItem.m_delIsEnabledBtns = AddressOf IsEnabledBtns - FamilyMachiningTreeViewItem.m_delIsEnabledBtns = AddressOf IsEnabledBtns + ' Passo all'item della lista il delegato alla funzuione che permette di cancellare una lavorazione + MachiningTreeViewItem.m_delRemoveMachining = AddressOf RemoveMachining + ' Passo all'item della lista il delegato alla funzuione che permette di disattivare la lista delle lavorazioni + MachiningTreeViewItem.m_delErrorOnMachining = AddressOf ErrorOnMachining + ' Passo all'item della lista il delegato alla funzuione che permette di disattivare la lista delle lavorazioni + MachiningTreeViewItem.m_delIsEnabledBtns = AddressOf IsEnabledBtns + FamilyMachiningTreeViewItem.m_delIsEnabledBtns = AddressOf IsEnabledBtns - ' Carico la lista delle lavorazioni della macchina selezionata - LoadSelectedMachineMachinings() + ' Carico la lista delle lavorazioni della macchina selezionata + LoadSelectedMachineMachinings() - End Sub + End Sub #End Region ' Constructor #Region "METHODS" - Private Sub IsEnabledBtns(bIsEnabledNewBtn As Boolean, bIsEnabledSaveBtn As Boolean, bIsEnabledDeleteBtn As Boolean) - m_IsEnabledNewBtn = bIsEnabledNewBtn - m_IsEnabledSaveBtn = bIsEnabledSaveBtn - m_IsEnabledRemoveBtn = bIsEnabledDeleteBtn - OnPropertyChanged("IsEnabledNewBtn") - OnPropertyChanged("IsEnabledSaveBtn") - OnPropertyChanged("IsEnabledRemoveBtn") - End Sub + Private Sub IsEnabledBtns(bIsEnabledNewBtn As Boolean, bIsEnabledSaveBtn As Boolean, bIsEnabledDeleteBtn As Boolean) + m_IsEnabledNewBtn = bIsEnabledNewBtn + m_IsEnabledSaveBtn = bIsEnabledSaveBtn + m_IsEnabledRemoveBtn = bIsEnabledDeleteBtn + OnPropertyChanged("IsEnabledNewBtn") + OnPropertyChanged("IsEnabledSaveBtn") + OnPropertyChanged("IsEnabledRemoveBtn") + End Sub - ' Quando chiamato, disattiva tutti gli item dell'albero o li riattiva a seconda che ci sia o meno un errore - Private Sub ErrorOnMachining(bIsEnabled As Boolean) - For Each FamilyMachiningItem In MachiningsList - FamilyMachiningItem.IsEnabled = Not bIsEnabled - Next - End Sub + ' Quando chiamato, disattiva tutti gli item dell'albero o li riattiva a seconda che ci sia o meno un errore + Private Sub ErrorOnMachining(bIsEnabled As Boolean) + For Each FamilyMachiningItem In MachiningsList + FamilyMachiningItem.IsEnabled = Not bIsEnabled + Next + End Sub - ''' - ''' Method that search the machines in the correct folder and add to the MachinesList those valid. - ''' - Private Sub LoadSelectedMachineMachinings() - EgtSetCurrentContext(IniFile.m_ProjectSceneContext) - Dim ActiveMachiningsTypes() As MachiningsType = MachineModel.ReadActiveMachiningsFamilies() - For Each MachiningsType In ActiveMachiningsTypes - Dim FamilyTreeView As New FamilyMachiningTreeViewItem(MachiningsType.TypeName, MachiningsType.TypeId) - MachiningsList.Add(FamilyTreeView) - Dim MachiningName As String = String.Empty - EgtMdbGetFirstMachining(MachiningsType.TypeId, MachiningName) - While Not String.IsNullOrWhiteSpace(MachiningName) - FamilyTreeView.Items.Add(New MachiningTreeViewItem(MachiningName, MachiningsType.TypeId)) - 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 + ''' + ''' Method that search the machines in the correct folder and add to the MachinesList those valid. + ''' + Private Sub LoadSelectedMachineMachinings() + EgtSetCurrentContext(IniFile.m_ProjectSceneContext) + Dim ActiveMachiningsTypes() As MachiningsType = MachineModel.ReadActiveMachiningsFamilies() + For Each MachiningsType In ActiveMachiningsTypes + Dim FamilyTreeView As New FamilyMachiningTreeViewItem(MachiningsType.TypeName, MachiningsType.TypeId) + MachiningsList.Add(FamilyTreeView) + Dim MachiningName As String = String.Empty + EgtMdbGetFirstMachining(MachiningsType.TypeId, MachiningName) + While Not String.IsNullOrWhiteSpace(MachiningName) + FamilyTreeView.Items.Add(New MachiningTreeViewItem(MachiningName, MachiningsType.TypeId)) + 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 ' Methods @@ -453,240 +451,238 @@ Namespace EgtCAM5 #Region "NewCommand" - ''' - ''' Returns a command that create a new machining. - ''' - Public ReadOnly Property NewCommand As ICommand - Get - If m_cmdNew Is Nothing Then - m_cmdNew = New RelayCommand(AddressOf NewPar) - End If - Return m_cmdNew - End Get - End Property - - ''' - ''' Creata the new machining. This method is invoked by the NewCommand. - ''' - Public Sub NewPar(ByVal param As Object) - ' Verifico se sia selezionata una famiglia - Dim NewMachiningItem As MachiningTreeViewItem - If TypeOf param Is FamilyMachiningTreeViewItem Then - Dim MachiningFamily As FamilyMachiningTreeViewItem = DirectCast(param, FamilyMachiningTreeViewItem) - Dim NewName As String = MachiningFamily.Name - EgtMdbGetMachiningNewName(NewName) - If EgtMdbAddMachining(NewName, MachiningFamily.MachiningType) Then - NewMachiningItem = New MachiningTreeViewItem(NewName, MachiningFamily.MachiningType) - MachiningFamily.Items.Add(NewMachiningItem) - EgtMdbSaveCurrMachining() - NewMachiningItem.NewMachining = True - If Not MachiningFamily.IsExpanded Then MachiningFamily.IsExpanded = True - NewMachiningItem.IsSelected = True - NewMachiningItem.NotifyPropertyChanged("IsSelected") - End If - ' Verifico se sia selezionata una lavorazione - ElseIf TypeOf param Is MachiningTreeViewItem Then - Dim MachiningCopied As MachiningTreeViewItem = DirectCast(param, MachiningTreeViewItem) - Dim NewName As String = MachiningCopied.Name - EgtMdbGetMachiningNewName(NewName) - If EgtMdbCopyMachining(MachiningCopied.Name, NewName) Then - Dim CurrType As Integer - EgtMdbGetCurrMachiningParam(MCH_MP.TYPE, CurrType) - For Each MachiningFamily In MachiningsList - If (MachiningFamily.MachiningType And CurrType) <> 0 Then - NewMachiningItem = New MachiningTreeViewItem(NewName, MachiningFamily.MachiningType) - MachiningFamily.Items.Add(NewMachiningItem) - EgtMdbSaveCurrMachining() - NewMachiningItem.NewMachining = True - ' Reimposto la lavorazione vecchia nel Db per deselezionarla e fare le verifiche correttamente - EgtMdbSetCurrMachining(MachiningCopied.Name) - MachiningCopied.IsSelected = False - MachiningCopied.NotifyPropertyChanged("IsSelected") - NewMachiningItem.IsSelected = True - Exit For - End If - Next - End If + ''' + ''' Returns a command that create a new machining. + ''' + Public ReadOnly Property NewCommand As ICommand + Get + If m_cmdNew Is Nothing Then + m_cmdNew = New RelayCommand(AddressOf NewPar) End If + Return m_cmdNew + End Get + End Property - End Sub + ''' + ''' Creata the new machining. This method is invoked by the NewCommand. + ''' + Public Sub NewPar(ByVal param As Object) + ' Verifico se sia selezionata una famiglia + Dim NewMachiningItem As MachiningTreeViewItem + If TypeOf param Is FamilyMachiningTreeViewItem Then + Dim MachiningFamily As FamilyMachiningTreeViewItem = DirectCast(param, FamilyMachiningTreeViewItem) + Dim NewName As String = MachiningFamily.Name + EgtMdbGetMachiningNewName(NewName) + If EgtMdbAddMachining(NewName, MachiningFamily.MachiningType) Then + NewMachiningItem = New MachiningTreeViewItem(NewName, MachiningFamily.MachiningType) + MachiningFamily.Items.Add(NewMachiningItem) + EgtMdbSaveCurrMachining() + NewMachiningItem.NewMachining = True + If Not MachiningFamily.IsExpanded Then MachiningFamily.IsExpanded = True + NewMachiningItem.IsSelected = True + NewMachiningItem.NotifyPropertyChanged("IsSelected") + End If + ' Verifico se sia selezionata una lavorazione + ElseIf TypeOf param Is MachiningTreeViewItem Then + Dim MachiningCopied As MachiningTreeViewItem = DirectCast(param, MachiningTreeViewItem) + Dim NewName As String = MachiningCopied.Name + EgtMdbGetMachiningNewName(NewName) + If EgtMdbCopyMachining(MachiningCopied.Name, NewName) Then + Dim CurrType As Integer + EgtMdbGetCurrMachiningParam(MCH_MP.TYPE, CurrType) + For Each MachiningFamily In MachiningsList + If (MachiningFamily.MachiningType And CurrType) <> 0 Then + NewMachiningItem = New MachiningTreeViewItem(NewName, MachiningFamily.MachiningType) + MachiningFamily.Items.Add(NewMachiningItem) + EgtMdbSaveCurrMachining() + NewMachiningItem.NewMachining = True + ' Reimposto la lavorazione vecchia nel Db per deselezionarla e fare le verifiche correttamente + EgtMdbSetCurrMachining(MachiningCopied.Name) + MachiningCopied.IsSelected = False + MachiningCopied.NotifyPropertyChanged("IsSelected") + NewMachiningItem.IsSelected = True + Exit For + End If + Next + End If + End If + + End Sub #End Region ' NewCommand #Region "SaveCommand" - ''' - ''' Returns a command that save the current selected machining. - ''' - 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 + ''' + ''' Returns a command that save the current selected machining. + ''' + 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 - ''' - ''' Saves the current machining. This method is invoked by the SaveCommand. - ''' - Public Sub Save(ByVal param As Object) - Dim CurrMachining As MachiningTreeViewItem = DirectCast(param, MachiningTreeViewItem) - CurrMachining.WriteMachiningParam() - CurrMachining.m_Name = CurrMachining.m_Name.Trim() - CurrMachining.WriteMachiningName() - EgtMdbSaveCurrMachining() - CurrMachining.NewMachining = False - CurrMachining.IsModifiedReset() - IsEnabledBtns(CurrMachining.IsValid And Not CurrMachining.IsModified, False, True) - End Sub + ''' + ''' Saves the current machining. This method is invoked by the SaveCommand. + ''' + Public Sub Save(ByVal param As Object) + Dim CurrMachining As MachiningTreeViewItem = DirectCast(param, MachiningTreeViewItem) + CurrMachining.WriteMachiningParam() + CurrMachining.m_Name = CurrMachining.m_Name.Trim() + CurrMachining.WriteMachiningName() + EgtMdbSaveCurrMachining() + CurrMachining.NewMachining = False + CurrMachining.IsModifiedReset() + IsEnabledBtns(CurrMachining.IsValid And Not CurrMachining.IsModified, False, True) + End Sub #End Region ' SaveCommand #Region "RemoveCommand" - ''' - ''' Returns a command that remove the current selected machining. - ''' - 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 - - ''' - ''' Remove the current selected machining from Db and TreeView. This method is invoked by the RemoveCommand. - ''' - Public Sub Remove(ByVal param As Object) - EgtSetCurrentContext(IniFile.m_ProjectSceneContext) - Dim MachiningToRemove As MachiningTreeViewItem = DirectCast(param, MachiningTreeViewItem) - ' Chiedo conferma cancellazione lavorazione - If MessageBox.Show(EgtMsg(MSG_MACHININGSERRORS + 4) & " " & MachiningToRemove.Name & EgtMsg(MSG_MACHININGSERRORS + 5), EgtMsg(MSG_MACHININGSERRORS + 6), MessageBoxButton.YesNo, MessageBoxImage.Question) <> MessageBoxResult.Yes Then - Return + ''' + ''' Returns a command that remove the current selected machining. + ''' + Public ReadOnly Property RemoveCommand() As ICommand + Get + If m_cmdRemove Is Nothing Then + m_cmdRemove = New RelayCommand(AddressOf Remove) End If - RemoveMachining(MachiningToRemove) - End Sub + Return m_cmdRemove + End Get + End Property - Public Sub RemoveMachining(MachiningToRemove As MachiningTreeViewItem) - ' Salvo il tipo di lavorazione per poterla cancellare - Dim MachiningType As Integer = MachiningToRemove.Type - ' Cancello la lavorazione - Dim CurrMachiningOriginalName As String = String.Empty - EgtMdbGetMachiningFromUUID(MachiningToRemove.Uuid, CurrMachiningOriginalName) - EgtMdbRemoveMachining(CurrMachiningOriginalName) - ' Rimuovo il nome dall'albero - For Each MachiningFamily In MachiningsList - If (MachiningFamily.MachiningType And MachiningType) <> 0 Then - MachiningFamily.Items.Remove(MachiningToRemove) - End If - Next - ErrorOnMachining(False) - End Sub + ''' + ''' Remove the current selected machining from Db and TreeView. This method is invoked by the RemoveCommand. + ''' + Public Sub Remove(ByVal param As Object) + EgtSetCurrentContext(IniFile.m_ProjectSceneContext) + Dim MachiningToRemove As MachiningTreeViewItem = DirectCast(param, MachiningTreeViewItem) + ' Chiedo conferma cancellazione lavorazione + If MessageBox.Show(EgtMsg(MSG_MACHININGSERRORS + 4) & " " & MachiningToRemove.Name & EgtMsg(MSG_MACHININGSERRORS + 5), EgtMsg(MSG_MACHININGSERRORS + 6), MessageBoxButton.YesNo, MessageBoxImage.Question) <> MessageBoxResult.Yes Then + Return + End If + RemoveMachining(MachiningToRemove) + End Sub + + Public Sub RemoveMachining(MachiningToRemove As MachiningTreeViewItem) + ' Salvo il tipo di lavorazione per poterla cancellare + Dim MachiningType As Integer = MachiningToRemove.Type + ' Cancello la lavorazione + Dim CurrMachiningOriginalName As String = String.Empty + EgtMdbGetMachiningFromUUID(MachiningToRemove.Uuid, CurrMachiningOriginalName) + EgtMdbRemoveMachining(CurrMachiningOriginalName) + ' Rimuovo il nome dall'albero + For Each MachiningFamily In MachiningsList + If (MachiningFamily.MachiningType And MachiningType) <> 0 Then + MachiningFamily.Items.Remove(MachiningToRemove) + End If + Next + ErrorOnMachining(False) + End Sub #End Region ' RemoveCommand #Region "ReloadMachiningCommand" - ''' - ''' Returns a command that reload the current selected tool. - ''' - Public ReadOnly Property ReloadMachiningCommand() As ICommand - Get - If m_cmdReloadMachining Is Nothing Then - m_cmdReloadMachining = New RelayCommand(AddressOf ReloadMachining) - End If - Return m_cmdReloadMachining - End Get - End Property - - ''' - ''' Reload the current selected tools. This method is invoked by the RemoveCommand. - ''' - Public Sub ReloadMachining(ByVal param As Object) - If TypeOf param Is FamilyMachiningTreeViewItem Then - Return - ' Verifico se sia selezionato un utensile - ElseIf TypeOf param Is MachiningTreeViewItem Then - Dim MachiningToReload As MachiningTreeViewItem = DirectCast(param, MachiningTreeViewItem) - EgtSetCurrentContext(IniFile.m_ProjectSceneContext) - MachiningToReload.ReadMachiningParam() - MachiningToReload.ReadMachiningName() - MachiningToReload.IsModifiedReset() + ''' + ''' Returns a command that reload the current selected tool. + ''' + Public ReadOnly Property ReloadMachiningCommand() As ICommand + Get + If m_cmdReloadMachining Is Nothing Then + m_cmdReloadMachining = New RelayCommand(AddressOf ReloadMachining) End If - End Sub + Return m_cmdReloadMachining + End Get + End Property + + ''' + ''' Reload the current selected tools. This method is invoked by the RemoveCommand. + ''' + Public Sub ReloadMachining(ByVal param As Object) + If TypeOf param Is FamilyMachiningTreeViewItem Then + Return + ' Verifico se sia selezionato un utensile + ElseIf TypeOf param Is MachiningTreeViewItem Then + Dim MachiningToReload As MachiningTreeViewItem = DirectCast(param, MachiningTreeViewItem) + EgtSetCurrentContext(IniFile.m_ProjectSceneContext) + MachiningToReload.ReadMachiningParam() + MachiningToReload.ReadMachiningName() + MachiningToReload.IsModifiedReset() + End If + End Sub #End Region ' ReloadMachiningCommand #Region "CloseMachiningsDbCommand" - ''' - ''' Returns a command that remove the current selected machining. - ''' - Public ReadOnly Property CloseMachiningsDbCommand() As ICommand - Get - If m_cmdCloseMachiningsDb Is Nothing Then - m_cmdCloseMachiningsDb = New RelayCommand(AddressOf CloseMachiningsDb) - End If - Return m_cmdCloseMachiningsDb - End Get - End Property - - ''' - ''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand. - ''' - Public Sub CloseMachiningsDb(param As Object) - m_bActive = False - ' Se selezionata una lavorazione, verifico salvataggio - If TypeOf param Is MachiningTreeViewItem Then - Dim CurrMachining As MachiningTreeViewItem = DirectCast(param, MachiningTreeViewItem) - If CurrMachining.IsValid Then - CurrMachining.WriteMachiningParam() - If EgtMdbIsCurrMachiningModified() Or CurrMachining.m_IsModifiedName Or CurrMachining.NewMachining Then - Select Case MsgBox(EgtMsg(MSG_MACHININGSERRORS), MsgBoxStyle.YesNo, EgtMsg(MSG_MACHININGSERRORS + 1)) - Case MsgBoxResult.Yes - CurrMachining.NewMachining = False - CurrMachining.m_Name = CurrMachining.m_Name.Trim() - CurrMachining.WriteMachiningName() - EgtMdbSaveCurrMachining() - Case MsgBoxResult.No - If CurrMachining.NewMachining Then - RemoveMachining(CurrMachining) - ElseIf CurrMachining.m_IsModifiedName Then - Dim DbName As String = String.Empty - EgtMdbGetCurrMachiningParam(MCH_MP.NAME, DbName) - CurrMachining.NamePar = DbName - End If - End Select - End If - Else - MessageBox.Show("Utensile non valido, correggerlo o cancellarlo prima di uscire.", "ERRORE") - Return - End If + ''' + ''' Returns a command that remove the current selected machining. + ''' + Public ReadOnly Property CloseMachiningsDbCommand() As ICommand + Get + If m_cmdCloseMachiningsDb Is Nothing Then + m_cmdCloseMachiningsDb = New RelayCommand(AddressOf CloseMachiningsDb) End If - ' Salvataggio DB lavorazioni - EgtMdbSave() - Application.Msn.NotifyColleagues(Application.UPDATEOPERATIONMACHININGLIST) - ' Chiusura finestra - MachiningTreeViewItem.m_delRemoveMachining = Nothing - MachiningTreeViewItem.m_delErrorOnMachining = Nothing - MachiningTreeViewItem.m_delIsEnabledBtns = Nothing - FamilyMachiningTreeViewItem.m_delIsEnabledBtns = Nothing - For Each Window In Application.Current.Windows - If TypeOf Window Is MachiningDbV Then - Dim MachiningsDbWindow As MachiningDbV = DirectCast(Window, MachiningDbV) - MachiningsDbWindow.DataContext = Nothing - MachiningsDbWindow.Close() + Return m_cmdCloseMachiningsDb + End Get + End Property + + ''' + ''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand. + ''' + Public Sub CloseMachiningsDb(param As Object) + m_bActive = False + ' Se selezionata una lavorazione, verifico salvataggio + If TypeOf param Is MachiningTreeViewItem Then + Dim CurrMachining As MachiningTreeViewItem = DirectCast(param, MachiningTreeViewItem) + If CurrMachining.IsValid Then + CurrMachining.WriteMachiningParam() + If EgtMdbIsCurrMachiningModified() Or CurrMachining.m_IsModifiedName Or CurrMachining.NewMachining Then + Select Case MsgBox(EgtMsg(MSG_MACHININGSERRORS), MsgBoxStyle.YesNo, EgtMsg(MSG_MACHININGSERRORS + 1)) + Case MsgBoxResult.Yes + CurrMachining.NewMachining = False + CurrMachining.m_Name = CurrMachining.m_Name.Trim() + CurrMachining.WriteMachiningName() + EgtMdbSaveCurrMachining() + Case MsgBoxResult.No + If CurrMachining.NewMachining Then + RemoveMachining(CurrMachining) + ElseIf CurrMachining.m_IsModifiedName Then + Dim DbName As String = String.Empty + EgtMdbGetCurrMachiningParam(MCH_MP.NAME, DbName) + CurrMachining.NamePar = DbName + End If + End Select End If - Next - End Sub + Else + MessageBox.Show("Utensile non valido, correggerlo o cancellarlo prima di uscire.", "ERRORE") + Return + End If + End If + ' Salvataggio DB lavorazioni + EgtMdbSave() + Application.Msn.NotifyColleagues(Application.UPDATEOPERATIONMACHININGLIST) + ' Chiusura finestra + MachiningTreeViewItem.m_delRemoveMachining = Nothing + MachiningTreeViewItem.m_delErrorOnMachining = Nothing + MachiningTreeViewItem.m_delIsEnabledBtns = Nothing + FamilyMachiningTreeViewItem.m_delIsEnabledBtns = Nothing + For Each Window In Application.Current.Windows + If TypeOf Window Is MachiningDbV Then + Dim MachiningsDbWindow As MachiningDbV = DirectCast(Window, MachiningDbV) + MachiningsDbWindow.DataContext = Nothing + MachiningsDbWindow.Close() + End If + Next + End Sub #End Region ' CloseMachiningDbCommand #End Region ' Commands - End Class - -End Namespace \ No newline at end of file +End Class \ No newline at end of file diff --git a/MainWindow/MainWindowV.xaml b/MainWindow/MainWindowV.xaml index 7812a08..43c4d9c 100644 --- a/MainWindow/MainWindowV.xaml +++ b/MainWindow/MainWindowV.xaml @@ -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" diff --git a/MainWindow/MainWindowVM.vb b/MainWindow/MainWindowVM.vb index ba6f378..73c2a35 100644 --- a/MainWindow/MainWindowVM.vb +++ b/MainWindow/MainWindowVM.vb @@ -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" - ''' - ''' Returns a command that manage the MainWindow_Unloaded command - ''' - 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 - - ''' - ''' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded. - ''' - 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 + ''' + ''' Returns a command that manage the MainWindow_Unloaded command + ''' + 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 + + ''' + ''' Manage the MainWindow_Unloaded event. This method is invoked by the cmdMainWindow_Unloaded. + ''' + 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" - ''' - ''' Returns a command that manage the MainWindow_ContentRendered command - ''' - 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 - - ''' - ''' Manage the MainWindow_ContentRendered event. This method is invoked by the cmdMainWindow_ContentRendered. - ''' - 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.") + ''' + ''' Returns a command that manage the MainWindow_ContentRendered command + ''' + 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 + + ''' + ''' Manage the MainWindow_ContentRendered event. This method is invoked by the cmdMainWindow_ContentRendered. + ''' + 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" - ''' - ''' Returns a command that manage the MainWindow_ContentRendered command - ''' - 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 + ''' + ''' Returns a command that manage the MainWindow_ContentRendered command + ''' + 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 - ''' - ''' Manage the MainWindow_ContentRendered event. This method is invoked by the cmdMainWindow_ContentRendered. - ''' - Public Sub MainWindow_Activated(ByVal param As Object) - ' Notify the ContentRendered event - Application.Msn.NotifyColleagues(Application.MAINWINDOW_ACTIVATED) - End Sub + ''' + ''' Manage the MainWindow_ContentRendered event. This method is invoked by the cmdMainWindow_ContentRendered. + ''' + 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" - ''' - ''' Returns a command that manage the MainWindow_ContentRendered command - ''' - 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 + ''' + ''' Returns a command that manage the MainWindow_ContentRendered command + ''' + 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 - ''' - ''' Manage the MainWindow_ContentRendered event. This method is invoked by the cmdMainWindow_ContentRendered. - ''' - Public Sub MainWindow_Deactivated(ByVal param As Object) - ' Notify the ContentRendered event - Application.Msn.NotifyColleagues(Application.MAINWINDOW_DEACTIVATED) - End Sub + ''' + ''' Manage the MainWindow_ContentRendered event. This method is invoked by the cmdMainWindow_ContentRendered. + ''' + 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 - ''' - ''' Method that initialize EgalTech environment - ''' - Private Sub InitializeEgtEnvironment() - ' Title - Application.Msn.NotifyColleagues(Application.EMITTITLE) - ' Impostazione path radice per i dati + ''' + ''' Method that initialize EgalTech environment + ''' + 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 - ''' - ''' Funzione che permette di gestire il numero di istanze del programma attive contemporaneamente - ''' - 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") + ''' + ''' Funzione che permette di gestire il numero di istanze del programma attive contemporaneamente + ''' + 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" - ''' - ''' Should we let our window close? - ''' - Private m_allowWindowToClose As Boolean = False + ''' + ''' Should we let our window close? + ''' + Private m_allowWindowToClose As Boolean = False #End Region - End Class - -End Namespace \ No newline at end of file +End Class \ No newline at end of file diff --git a/OptionPanel/DrawOptionPanel/InfoExpander/InfoExpanderView.xaml b/OptionPanel/DrawOptionPanel/InfoExpander/InfoExpanderV.xaml similarity index 82% rename from OptionPanel/DrawOptionPanel/InfoExpander/InfoExpanderView.xaml rename to OptionPanel/DrawOptionPanel/InfoExpander/InfoExpanderV.xaml index 6e21bde..d13ada8 100644 --- a/OptionPanel/DrawOptionPanel/InfoExpander/InfoExpanderView.xaml +++ b/OptionPanel/DrawOptionPanel/InfoExpander/InfoExpanderV.xaml @@ -1,7 +1,6 @@ - + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> diff --git a/OptionPanel/DrawOptionPanel/InfoExpander/InfoExpanderV.xaml.vb b/OptionPanel/DrawOptionPanel/InfoExpander/InfoExpanderV.xaml.vb new file mode 100644 index 0000000..32c6a0e --- /dev/null +++ b/OptionPanel/DrawOptionPanel/InfoExpander/InfoExpanderV.xaml.vb @@ -0,0 +1,3 @@ +Public Class InfoExpanderV + +End Class diff --git a/OptionPanel/DrawOptionPanel/InfoExpander/InfoExpanderVM.vb b/OptionPanel/DrawOptionPanel/InfoExpander/InfoExpanderVM.vb new file mode 100644 index 0000000..daf9871 --- /dev/null +++ b/OptionPanel/DrawOptionPanel/InfoExpander/InfoExpanderVM.vb @@ -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 \ No newline at end of file diff --git a/OptionPanel/DrawOptionPanel/InfoExpander/InfoExpanderView.xaml.vb b/OptionPanel/DrawOptionPanel/InfoExpander/InfoExpanderView.xaml.vb deleted file mode 100644 index 77119ad..0000000 --- a/OptionPanel/DrawOptionPanel/InfoExpander/InfoExpanderView.xaml.vb +++ /dev/null @@ -1,3 +0,0 @@ -Public Class InfoExpanderView - -End Class diff --git a/OptionPanel/DrawOptionPanel/InfoExpander/InfoExpanderViewModel.vb b/OptionPanel/DrawOptionPanel/InfoExpander/InfoExpanderViewModel.vb deleted file mode 100644 index 2f4a081..0000000 --- a/OptionPanel/DrawOptionPanel/InfoExpander/InfoExpanderViewModel.vb +++ /dev/null @@ -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 \ No newline at end of file diff --git a/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderView.xaml b/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderV.xaml similarity index 96% rename from OptionPanel/DrawOptionPanel/InputExpander/InputExpanderView.xaml rename to OptionPanel/DrawOptionPanel/InputExpander/InputExpanderV.xaml index 77274f1..ddebd40 100644 --- a/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderView.xaml +++ b/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderV.xaml @@ -1,4 +1,4 @@ - diff --git a/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderV.xaml.vb b/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderV.xaml.vb new file mode 100644 index 0000000..007e511 --- /dev/null +++ b/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderV.xaml.vb @@ -0,0 +1,3 @@ +Public Class InputExpanderV + +End Class diff --git a/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderVM.vb b/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderVM.vb new file mode 100644 index 0000000..4bcc267 --- /dev/null +++ b/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderVM.vb @@ -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" + + ''' + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + Public Sub Show(ByVal param As Object) + Application.Msn.NotifyColleagues(Application.SHOW, TextBox) + End Sub + + ''' + ''' Returns always true. + ''' + Private Function CanShow(ByVal param As Object) As Boolean + Return If(m_ShowBtnVisibility = Visibility.Visible, True, False) + End Function + +#End Region ' ShowCommand + +#Region "DoneCommand" + + ''' + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + Public Sub Done(ByVal param As Object) + Application.Msn.NotifyColleagues(Application.DONE, m_TextBox) + End Sub + + ''' + ''' Returns always true. + ''' + 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 diff --git a/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderView.xaml.vb b/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderView.xaml.vb deleted file mode 100644 index b774417..0000000 --- a/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderView.xaml.vb +++ /dev/null @@ -1,3 +0,0 @@ -Public Class InputExpanderView - -End Class diff --git a/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderViewModel.vb b/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderViewModel.vb deleted file mode 100644 index 07be465..0000000 --- a/OptionPanel/DrawOptionPanel/InputExpander/InputExpanderViewModel.vb +++ /dev/null @@ -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" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - Public Sub Show(ByVal param As Object) - Application.Msn.NotifyColleagues(Application.SHOW, TextBox) - End Sub - - ''' - ''' Returns always true. - ''' - Private Function CanShow(ByVal param As Object) As Boolean - Return If(m_ShowBtnVisibility = Visibility.Visible, True, False) - End Function - -#End Region ' ShowCommand - -#Region "DoneCommand" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - Public Sub Done(ByVal param As Object) - Application.Msn.NotifyColleagues(Application.DONE, m_TextBox) - End Sub - - ''' - ''' Returns always true. - ''' - 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 \ No newline at end of file diff --git a/OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderView.xaml b/OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderV.xaml similarity index 97% rename from OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderView.xaml rename to OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderV.xaml index f9ff49e..07aa8a1 100644 --- a/OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderView.xaml +++ b/OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderV.xaml @@ -1,4 +1,4 @@ - + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + 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" + + ''' + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + 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" + + ''' + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + 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" + + ''' + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + 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" + + ''' + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + 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" + + ''' + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + 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" + + ''' + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + 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" + + ''' + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + 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" + + ''' + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + 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" + + ''' + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + 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" + + ''' + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + 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" + + ''' + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + 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" + + ''' + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + 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" + + ''' + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + 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 diff --git a/OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderView.xaml.vb b/OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderView.xaml.vb deleted file mode 100644 index 5aacc44..0000000 --- a/OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderView.xaml.vb +++ /dev/null @@ -1,3 +0,0 @@ -Public Class ManageLayerExpanderView - -End Class diff --git a/OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderViewModel.vb b/OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderViewModel.vb deleted file mode 100644 index 8fb1e72..0000000 --- a/OptionPanel/DrawOptionPanel/ManageLayerExpander/ManageLayerExpanderViewModel.vb +++ /dev/null @@ -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" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - 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" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - 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" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - 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" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - 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" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - 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" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - 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" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - 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" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - 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" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - 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" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - 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" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - 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" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - 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" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - 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" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - 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 \ No newline at end of file diff --git a/OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderView.xaml b/OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderV.xaml similarity index 96% rename from OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderView.xaml rename to OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderV.xaml index dccbe3c..6dd9cda 100644 --- a/OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderView.xaml +++ b/OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderV.xaml @@ -1,4 +1,4 @@ - 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" + + ''' + ''' Returns a command that do TreeViewDoubleClick. + ''' + 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 + + ''' + ''' Execute the TreeViewDoubleClick. This method is invoked by the TreeViewDoubleClickCommand. + ''' + 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" + + ''' + ''' Returns a command that do TreeViewDoubleClick. + ''' + 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 + + ''' + ''' Execute the TreeViewDoubleClick. This method is invoked by the TreeViewDoubleClickCommand. + ''' + Public Sub CancelNew(ByVal param As Object) + Application.Msn.NotifyColleagues(Application.CANCELOPERATIONCOMMAND) + End Sub + +#End Region ' CancelNewCommand + +#End Region ' Commands + +#Region "METHODS" + + ''' + ''' Method that search the machines in the correct folder and add to the MachinesList those valid. + ''' + 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 \ No newline at end of file diff --git a/OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderViewModel.vb b/OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderViewModel.vb deleted file mode 100644 index 639376b..0000000 --- a/OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderViewModel.vb +++ /dev/null @@ -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" - - ''' - ''' Returns a command that do TreeViewDoubleClick. - ''' - 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 - - ''' - ''' Execute the TreeViewDoubleClick. This method is invoked by the TreeViewDoubleClickCommand. - ''' - 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" - - ''' - ''' Returns a command that do TreeViewDoubleClick. - ''' - 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 - - ''' - ''' Execute the TreeViewDoubleClick. This method is invoked by the TreeViewDoubleClickCommand. - ''' - Public Sub CancelNew(ByVal param As Object) - Application.Msn.NotifyColleagues(Application.CANCELOPERATIONCOMMAND) - End Sub - -#End Region ' CancelNewCommand - -#End Region ' Commands - -#Region "METHODS" - - ''' - ''' Method that search the machines in the correct folder and add to the MachinesList those valid. - ''' - 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 \ No newline at end of file diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderView.xaml b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderV.xaml similarity index 96% rename from OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderView.xaml rename to OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderV.xaml index 74a7058..3b402fa 100644 --- a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderView.xaml +++ b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderV.xaml @@ -1,4 +1,4 @@ - diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderV.xaml.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderV.xaml.vb new file mode 100644 index 0000000..8f16798 --- /dev/null +++ b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderV.xaml.vb @@ -0,0 +1,3 @@ +Public Class DispositionParameterExpanderV + +End Class diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderVM.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderVM.vb new file mode 100644 index 0000000..286566e --- /dev/null +++ b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderVM.vb @@ -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" + + ''' + ''' Returns a command that do Done. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the DoneCommand. + ''' + 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" + + ''' + ''' Returns a command that do Done. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the DoneCommand. + ''' + 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 \ No newline at end of file diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderView.xaml.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderView.xaml.vb deleted file mode 100644 index d405710..0000000 --- a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderView.xaml.vb +++ /dev/null @@ -1,3 +0,0 @@ -Public Class DispositionParameterExpanderView - -End Class diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderViewModel.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderViewModel.vb deleted file mode 100644 index 0520c12..0000000 --- a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderViewModel.vb +++ /dev/null @@ -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" - - ''' - ''' Returns a command that do Done. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the DoneCommand. - ''' - 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" - - ''' - ''' Returns a command that do Done. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the DoneCommand. - ''' - 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 \ No newline at end of file diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersView.xaml b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersV.xaml similarity index 96% rename from OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersView.xaml rename to OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersV.xaml index 8195dd2..d3c067d 100644 --- a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersView.xaml +++ b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersV.xaml @@ -1,4 +1,4 @@ - diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersV.xaml.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersV.xaml.vb new file mode 100644 index 0000000..369dac0 --- /dev/null +++ b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersV.xaml.vb @@ -0,0 +1,3 @@ +Public Class FixtureParametersV + +End Class diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersVM.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersVM.vb new file mode 100644 index 0000000..7194bc4 --- /dev/null +++ b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersVM.vb @@ -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" + + ''' + ''' Returns a command that do Done. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the DoneCommand. + ''' + 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" + + ''' + ''' Returns a command that do Done. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the DoneCommand. + ''' + 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 diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersView.xaml.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersView.xaml.vb deleted file mode 100644 index 757159d..0000000 --- a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersView.xaml.vb +++ /dev/null @@ -1,3 +0,0 @@ -Public Class FixtureParametersView - -End Class diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersViewModel.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersViewModel.vb deleted file mode 100644 index ecc2f20..0000000 --- a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/FixtureParameters/FixtureParametersViewModel.vb +++ /dev/null @@ -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" - - ''' - ''' Returns a command that do Done. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the DoneCommand. - ''' - 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" - - ''' - ''' Returns a command that do Done. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the DoneCommand. - ''' - 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 diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionView.xaml b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionV.xaml similarity index 95% rename from OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionView.xaml rename to OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionV.xaml index 287d86e..d35a4e9 100644 --- a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionView.xaml +++ b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionV.xaml @@ -1,4 +1,4 @@ - diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionV.xaml.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionV.xaml.vb new file mode 100644 index 0000000..76262e2 --- /dev/null +++ b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionV.xaml.vb @@ -0,0 +1,3 @@ +Public Class RawPartOptionV + +End Class diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionVM.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionVM.vb new file mode 100644 index 0000000..9671e3e --- /dev/null +++ b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionVM.vb @@ -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" + + ''' + ''' Returns a command that do Done. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the DoneCommand. + ''' + Public Sub NewRawPart() + DispositionUtility.ShowParts() + m_bRawPartParamVisibility = Visibility.Visible + OnPropertyChanged("RawPartParamVisibility") + End Sub + +#End Region ' NewRawPartCommand + +#End Region ' Commands + +End Class \ No newline at end of file diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionView.xaml.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionView.xaml.vb deleted file mode 100644 index f95a626..0000000 --- a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionView.xaml.vb +++ /dev/null @@ -1,3 +0,0 @@ -Public Class RawPartOptionView - -End Class diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionViewModel.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionViewModel.vb deleted file mode 100644 index 8975441..0000000 --- a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionViewModel.vb +++ /dev/null @@ -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" - - ''' - ''' Returns a command that do Done. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the DoneCommand. - ''' - Public Sub NewRawPart() - DispositionUtility.ShowParts() - m_bRawPartParamVisibility = Visibility.Visible - OnPropertyChanged("RawPartParamVisibility") - End Sub - -#End Region ' NewRawPartCommand - -#End Region ' Commands - - End Class - -End Namespace \ No newline at end of file diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderView.xaml b/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderV.xaml similarity index 98% rename from OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderView.xaml rename to OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderV.xaml index 9ae9f56..ec9a412 100644 --- a/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderView.xaml +++ b/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderV.xaml @@ -1,4 +1,4 @@ - + ''' Property that read and write to the Machining's database the Invert + ''' + Public Property Invert As Boolean + Get + Return m_Invert + End Get + Set(value As Boolean) + If value <> m_Invert Then + m_Invert = value + Dim OrigInvert As Boolean = False + EgtGetMachiningParam(MCH_MP.INVERT, OrigInvert) + m_IsModifiedInvert = If(value <> OrigInvert, True, False) + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedLeaveTab As Boolean = False + Private m_LeaveTab As Boolean + ''' + ''' Property that read and write to the Machining's database the Leave Tab + ''' + Public Property LeaveTab As Boolean + Get + Return m_LeaveTab + End Get + Set(value As Boolean) + If value <> m_LeaveTab Then + m_LeaveTab = value + Dim OrigLeaveTab As Boolean = False + EgtGetMachiningParam(MCH_MP.LEAVETAB, OrigLeaveTab) + m_IsModifiedLeaveTab = If(value <> OrigLeaveTab, True, False) + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedToolInvert As Boolean = False + Private m_ToolInvert As Boolean = False + ''' + ''' Property that read and write to the Machining's database the Invert + ''' + Public Property ToolInvert As Boolean + Get + Return m_ToolInvert + End Get + Set(value As Boolean) + If value <> m_ToolInvert Then + m_ToolInvert = value + Dim OrigToolInvert As Boolean = False + EgtGetMachiningParam(MCH_MP.TOOLINVERT, OrigToolInvert) + m_IsModifiedToolInvert = If(value <> OrigToolInvert, True, False) + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_Type As Integer + ''' + ''' Property that read from the Machining's database the Type + ''' + Public ReadOnly Property Type As Integer + Get + Return m_Type + End Get + End Property + + 'ObservableCollection che contiene le variabili per il combobox WorkSide + Private m_WorkSideList As ObservableCollection(Of IdNameStruct) + Public ReadOnly Property WorkSideList As ObservableCollection(Of IdNameStruct) + Get + Select Case m_Type + Case MCH_MY.MORTISING + m_WorkSideList = New ObservableCollection(Of IdNameStruct)( + {New IdNameStruct(MCH_MORTISE_WS.LEFT, EgtMsg(MSG_MACHININGSDBPAGE + 121)), + New IdNameStruct(MCH_MORTISE_WS.RIGHT, EgtMsg(MSG_MACHININGSDBPAGE + 122))}) + Case MCH_MY.CHISELING + m_WorkSideList = New ObservableCollection(Of IdNameStruct)( + {New IdNameStruct(MCH_CHISEL_WS.LEFT, EgtMsg(MSG_MACHININGSDBPAGE + 121)), + New IdNameStruct(MCH_CHISEL_WS.RIGHT, EgtMsg(MSG_MACHININGSDBPAGE + 122))}) + Case Else + m_WorkSideList = New ObservableCollection(Of IdNameStruct)( + {New IdNameStruct(MCH_SAW_WS.CENTER, EgtMsg(MSG_MACHININGSDBPAGE + 120)), + New IdNameStruct(MCH_SAW_WS.LEFT, EgtMsg(MSG_MACHININGSDBPAGE + 121)), + New IdNameStruct(MCH_SAW_WS.RIGHT, EgtMsg(MSG_MACHININGSDBPAGE + 122))}) + End Select + Return m_WorkSideList + End Get + End Property + + Private m_IsModifiedSelectedWorkSide As Boolean = False + Private m_SelectedWorkSide As Integer + ' Proprietà che indica il WorkSide (MCH_SAW_WS) + Public Property SelectedWorkSide As Integer + Get + If IsNothing(WorkSideList) Then Return Nothing + Return m_SelectedWorkSide + End Get + Set(value As Integer) + If value <> m_SelectedWorkSide Then + If Not IsNothing(WorkSideList) Then + m_SelectedWorkSide = value + Dim OrigWorkSide As Integer = 0 + EgtGetMachiningParam(MCH_MP.WORKSIDE, OrigWorkSide) + OrigWorkSide = IdNameStruct.IndFromId(OrigWorkSide, WorkSideList) + m_IsModifiedSelectedWorkSide = (value <> OrigWorkSide) + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End If + End Set + End Property + + 'ObservableCollection che contiene le variabili per il combobox HeadSide + Private m_HeadSideList As New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAW_HS.LEFT, EgtMsg(MSG_MACHININGSDBPAGE + 121)), + New IdNameStruct(MCH_SAW_HS.RIGHT, EgtMsg(MSG_MACHININGSDBPAGE + 122))}) + Public ReadOnly Property HeadSideList As ObservableCollection(Of IdNameStruct) + Get + Return m_HeadSideList + End Get + End Property + + Private m_IsModifiedSelectedHeadSide As Boolean = False + Private m_SelectedHeadSide As Integer + ' Proprietà che indica il HeadSide (MCH_SAW_HS) + Public Property SelectedHeadSide As Integer + Get + If IsNothing(HeadSideList) Then Return Nothing + Return m_SelectedHeadSide + End Get + Set(value As Integer) + If value <> m_SelectedHeadSide Then + If Not IsNothing(HeadSideList) Then + m_SelectedHeadSide = value + Dim OrigHeadSide As Integer = 0 + EgtGetMachiningParam(MCH_MP.HEADSIDE, OrigHeadSide) + OrigHeadSide = IdNameStruct.IndFromId(OrigHeadSide, HeadSideList) + m_IsModifiedSelectedHeadSide = If(value <> OrigHeadSide, True, False) + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End If + End Set + End Property + + 'ObservableCollection che contiene le variabili per il combobox LeadInType + Private m_LeadInTypeList As ObservableCollection(Of IdNameStruct) + Public ReadOnly Property LeadInTypeList As ObservableCollection(Of IdNameStruct) + Get + Select Case m_Type + Case MCH_MY.SAWING + m_LeadInTypeList = New ObservableCollection(Of IdNameStruct)( + {New IdNameStruct(MCH_SAW_LI.CENT, EgtMsg(MSG_MACHININGSDBPAGE + 120)), + New IdNameStruct(MCH_SAW_LI.STRICT, EgtMsg(MSG_MACHININGSDBPAGE + 125)), + New IdNameStruct(MCH_SAW_LI.OUT, EgtMsg(MSG_MACHININGSDBPAGE + 126)), + New IdNameStruct(MCH_SAW_LI.EXT_CENT, EgtMsg(MSG_MACHININGSDBPAGE + 127)), + New IdNameStruct(MCH_SAW_LI.EXT_OUT, EgtMsg(MSG_MACHININGSDBPAGE + 128))}) + Case MCH_MY.MILLING + m_LeadInTypeList = New ObservableCollection(Of IdNameStruct)( + {New IdNameStruct(MCH_MIL_LI.NONE, EgtMsg(MSG_MACHININGSDBPAGE + 129)), + New IdNameStruct(MCH_MIL_LI.LINEAR, EgtMsg(MSG_MACHININGSDBPAGE + 130)), + New IdNameStruct(MCH_MIL_LI.TANGENT, EgtMsg(MSG_MACHININGSDBPAGE + 131)), + New IdNameStruct(MCH_MIL_LI.GLIDE, EgtMsg(MSG_MACHININGSDBPAGE + 132)), + New IdNameStruct(MCH_MIL_LI.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), + New IdNameStruct(MCH_MIL_LI.HELIX, EgtMsg(MSG_MACHININGSDBPAGE + 133))}) + Case MCH_MY.POCKETING + m_LeadInTypeList = New ObservableCollection(Of IdNameStruct)( + {New IdNameStruct(MCH_POCK_LI.NONE, EgtMsg(MSG_MACHININGSDBPAGE + 129)), + New IdNameStruct(MCH_POCK_LI.GLIDE, EgtMsg(MSG_MACHININGSDBPAGE + 132)), + New IdNameStruct(MCH_POCK_LI.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), + New IdNameStruct(MCH_POCK_LI.HELIX, EgtMsg(MSG_MACHININGSDBPAGE + 133))}) + Case Else + m_LeadInTypeList = Nothing + End Select + Return m_LeadInTypeList + End Get + End Property + + Private m_IsModifiedSelectedLeadInType As Boolean = False + Private m_SelectedLeadInType As Integer + ' Proprietà che indica il LeadInType + Public Property SelectedLeadInType As Integer + Get + If IsNothing(LeadInTypeList) Then Return Nothing + Return IdNameStruct.IdFromInd(m_SelectedLeadInType, LeadInTypeList) + End Get + Set(value As Integer) + If value <> m_SelectedLeadInType Then + If Not IsNothing(LeadInTypeList) Then + m_SelectedLeadInType = IdNameStruct.IndFromId(value, LeadInTypeList) + Dim OrigLeadInType As Integer = 0 + EgtGetMachiningParam(MCH_MP.LEADINTYPE, OrigLeadInType) + m_IsModifiedSelectedLeadInType = If(value <> OrigLeadInType, True, False) + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End If + End Set + End Property + + 'ObservableCollection che contiene le variabili per il combobox ExtLinkType + Private m_ExtLinkTypeList As New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAW_EL.CENT, EgtMsg(MSG_MACHININGSDBPAGE + 120)), New IdNameStruct(MCH_SAW_EL.EXT_PREV, EgtMsg(MSG_MACHININGSDBPAGE + 134)), New IdNameStruct(MCH_SAW_EL.EXT_NEXT, EgtMsg(MSG_MACHININGSDBPAGE + 135)), New IdNameStruct(MCH_SAW_EL.EXT_BOTH, EgtMsg(MSG_MACHININGSDBPAGE + 136))}) + Public ReadOnly Property ExtLinkTypeList As ObservableCollection(Of IdNameStruct) + Get + Return m_ExtLinkTypeList + End Get + End Property + + Private m_IsModifiedSelectedExtLinkType As Boolean = False + Private m_SelectedExtLinkType As Integer + ' Proprietà che indica il ExtLinkType (MCH_SAW_EL) + Public Property SelectedExtLinkType As Integer + Get + If IsNothing(ExtLinkTypeList) Then Return Nothing + Return IdNameStruct.IdFromInd(m_SelectedExtLinkType, ExtLinkTypeList) + End Get + Set(value As Integer) + If value <> m_SelectedExtLinkType Then + If Not IsNothing(ExtLinkTypeList) Then + m_SelectedExtLinkType = IdNameStruct.IndFromId(value, ExtLinkTypeList) + Dim OrigExtLinkType As Integer = 0 + EgtGetMachiningParam(MCH_MP.EXTLINKTYPE, OrigExtLinkType) + m_IsModifiedSelectedExtLinkType = If(value <> OrigExtLinkType, True, False) + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End If + End Set + End Property + + 'ObservableCollection che contiene le variabili per il combobox LeadOutType + Private m_LeadOutTypeList As ObservableCollection(Of IdNameStruct) + Public ReadOnly Property LeadOutTypeList As ObservableCollection(Of IdNameStruct) + Get + Select Case m_Type + Case MCH_MY.SAWING + m_LeadOutTypeList = New ObservableCollection(Of IdNameStruct)( + {New IdNameStruct(MCH_SAW_LO.CENT, EgtMsg(MSG_MACHININGSDBPAGE + 120)), + New IdNameStruct(MCH_SAW_LO.STRICT, EgtMsg(MSG_MACHININGSDBPAGE + 125)), + New IdNameStruct(MCH_SAW_LO.EXT_CENT, EgtMsg(MSG_MACHININGSDBPAGE + 127)), + New IdNameStruct(MCH_SAW_LO.OUT, EgtMsg(MSG_MACHININGSDBPAGE + 126)), + New IdNameStruct(MCH_SAW_LO.EXT_OUT, EgtMsg(MSG_MACHININGSDBPAGE + 128))}) + Case MCH_MY.MILLING + m_LeadOutTypeList = New ObservableCollection(Of IdNameStruct)( + {New IdNameStruct(MCH_MIL_LO.NONE, EgtMsg(MSG_MACHININGSDBPAGE + 129)), + New IdNameStruct(MCH_MIL_LO.LINEAR, EgtMsg(MSG_MACHININGSDBPAGE + 130)), + New IdNameStruct(MCH_MIL_LO.TANGENT, EgtMsg(MSG_MACHININGSDBPAGE + 131)), + New IdNameStruct(MCH_MIL_LO.GLIDE, EgtMsg(MSG_MACHININGSDBPAGE + 132)), + New IdNameStruct(MCH_MIL_LO.AS_LI, EgtMsg(MSG_MACHININGSDBPAGE + 137))}) + Case MCH_MY.POCKETING + m_LeadOutTypeList = New ObservableCollection(Of IdNameStruct)( + {New IdNameStruct(MCH_POCK_LO.NONE, EgtMsg(MSG_MACHININGSDBPAGE + 129)), + New IdNameStruct(MCH_POCK_LO.GLIDE, EgtMsg(MSG_MACHININGSDBPAGE + 132))}) + Case Else + m_LeadOutTypeList = Nothing + End Select + Return m_LeadOutTypeList + End Get + End Property + + Private m_IsModifiedSelectedLeadOutType As Boolean = False + Private m_SelectedLeadOutType As Integer + ' Proprietà che indica il LeadOutType + Public Property SelectedLeadOutType As Integer + Get + If IsNothing(LeadOutTypeList) Then Return Nothing + Return IdNameStruct.IdFromInd(m_SelectedLeadOutType, LeadOutTypeList) + End Get + Set(value As Integer) + If value <> m_SelectedLeadOutType Then + If Not IsNothing(LeadOutTypeList) Then + m_SelectedLeadOutType = IdNameStruct.IndFromId(value, LeadOutTypeList) + Dim OrigLeadOutType As Integer = 0 + EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, OrigLeadOutType) + m_IsModifiedSelectedLeadOutType = If(value <> OrigLeadOutType, True, False) + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End If + End Set + End Property + + 'ObservableCollection che contiene le variabili per il combobox CurveUse + Private m_CurveUseList As ObservableCollection(Of IdNameStruct) + Public ReadOnly Property CurveUseList As ObservableCollection(Of IdNameStruct) + Get + If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_SAWINGONARCS, 0, IniFile.m_sCurrMachIniFilePath) <> 0 Then + m_CurveUseList = New ObservableCollection(Of IdNameStruct)( + {New IdNameStruct(MCH_SAW_CU.SKIP, EgtMsg(MSG_MACHININGSDBPAGE + 138)), + New IdNameStruct(MCH_SAW_CU.APPROX, EgtMsg(MSG_MACHININGSDBPAGE + 139)), + New IdNameStruct(MCH_SAW_CU.CONVEX, EgtMsg(MSG_MACHININGSDBPAGE + 140)), + New IdNameStruct(MCH_SAW_CU.KEEP, EgtMsg(MSG_MACHININGSDBPAGE + 141))}) + Else + m_CurveUseList = New ObservableCollection(Of IdNameStruct)( + {New IdNameStruct(MCH_SAW_CU.SKIP, EgtMsg(MSG_MACHININGSDBPAGE + 138)), + New IdNameStruct(MCH_SAW_CU.APPROX, EgtMsg(MSG_MACHININGSDBPAGE + 139)), + New IdNameStruct(MCH_SAW_CU.CONVEX, EgtMsg(MSG_MACHININGSDBPAGE + 140))}) + End If + Return m_CurveUseList + End Get + End Property + + Private m_IsModifiedSelectedCurveUse As Boolean = False + Private m_SelectedCurveUse As Integer + ' Proprietà che indica il CurveUse (MCH_SAW_CU) + Public Property SelectedCurveUse As Integer + Get + If IsNothing(CurveUseList) Then Return Nothing + Return IdNameStruct.IdFromInd(m_SelectedCurveUse, CurveUseList) + End Get + Set(value As Integer) + If value <> m_SelectedCurveUse Then + If Not IsNothing(CurveUseList) Then + m_SelectedCurveUse = IdNameStruct.IndFromId(value, CurveUseList) + Dim OrigCurveUse As Integer = 0 + EgtGetMachiningParam(MCH_MP.CURVEUSE, OrigCurveUse) + m_IsModifiedSelectedCurveUse = If(value <> OrigCurveUse, True, False) + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End If + End Set + End Property + + 'ObservableCollection che contiene le variabili per il combobox StepType + Private m_StepTypeList As ObservableCollection(Of IdNameStruct) + Public ReadOnly Property StepTypeList As ObservableCollection(Of IdNameStruct) + Get + Select Case m_Type + Case MCH_MY.SAWING + m_StepTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAW_ST.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), + New IdNameStruct(MCH_SAW_ST.ONEWAY, EgtMsg(MSG_MACHININGSDBPAGE + 143)), + New IdNameStruct(MCH_SAW_ST.TOANDFROM, EgtMsg(MSG_MACHININGSDBPAGE + 145))}) + Case MCH_MY.MILLING + m_StepTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_MIL_ST.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), + New IdNameStruct(MCH_MIL_ST.ONEWAY, EgtMsg(MSG_MACHININGSDBPAGE + 143)), + New IdNameStruct(MCH_MIL_ST.SPIRAL, EgtMsg(MSG_MACHININGSDBPAGE + 144))}) + Case MCH_MY.MORTISING + m_StepTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_MORTISE_ST.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), + New IdNameStruct(MCH_MORTISE_ST.ONEWAY, EgtMsg(MSG_MACHININGSDBPAGE + 143))}) + Case MCH_MY.SAWROUGHING, MCH_MY.SAWFINISHING + m_StepTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAWROU_ST.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), + New IdNameStruct(MCH_SAWROU_ST.ONEWAY, EgtMsg(MSG_MACHININGSDBPAGE + 143))}) + Case Else + m_StepTypeList = Nothing + End Select + Return m_StepTypeList + End Get + End Property + + Private m_IsModifiedSelectedStepType As Boolean = False + Private m_SelectedStepType As Integer + ' Proprietà che indica lo StepType + Public Property SelectedStepType As Integer + Get + If IsNothing(StepTypeList) Then Return Nothing + Return IdNameStruct.IdFromInd(m_SelectedStepType, StepTypeList) + End Get + Set(value As Integer) + If value <> m_SelectedStepType Then + If Not IsNothing(StepTypeList) Then + m_SelectedStepType = value + Dim OrigStepType As Integer = 0 + EgtGetMachiningParam(MCH_MP.STEPTYPE, OrigStepType) + OrigStepType = IdNameStruct.IndFromId(OrigStepType, StepTypeList) + m_IsModifiedSelectedStepType = (value <> OrigStepType) + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End If + End Set + End Property + + 'ObservableCollection che contiene le variabili per il combobox SubType + Private m_SubTypeList As ObservableCollection(Of IdNameStruct) + Public ReadOnly Property SubTypeList As ObservableCollection(Of IdNameStruct) + Get + Select Case m_Type + Case MCH_MY.POCKETING + m_SubTypeList = New ObservableCollection(Of IdNameStruct)( + {New IdNameStruct(MCH_POCK_SUB.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), + New IdNameStruct(MCH_POCK_SUB.ONEWAY, EgtMsg(MSG_MACHININGSDBPAGE + 143)), + New IdNameStruct(MCH_POCK_SUB.SPIRALIN, EgtMsg(MSG_MACHININGSDBPAGE + 148)), + New IdNameStruct(MCH_POCK_SUB.SPIRALOUT, EgtMsg(MSG_MACHININGSDBPAGE + 149))}) + Case MCH_MY.SAWFINISHING + m_SubTypeList = New ObservableCollection(Of IdNameStruct)( + {New IdNameStruct(MCH_SAWFIN_SUB.ALONG, EgtMsg(MSG_MACHININGSDBPAGE + 146)), + New IdNameStruct(MCH_SAWFIN_SUB.ACROSS, EgtMsg(MSG_MACHININGSDBPAGE + 147))}) + Case MCH_MY.GENMACHINING + Dim Index = 1 + Dim sGenScript As String = String.Empty + m_SubTypeList = New ObservableCollection(Of IdNameStruct) + While EgtUILib.GetPrivateProfileString(S_GENMACHINING, K_GENSCRIPT & Index, "", sGenScript, IniFile.m_sCurrMachIniFilePath) > 0 + m_SubTypeList.Add(New IdNameStruct(Index, sGenScript)) + Index += 1 + End While + If m_SubTypeList.Count = 0 Then + m_SubTypeList.Add(New IdNameStruct(0, "")) + End If + Case Else + m_SubTypeList = Nothing + End Select + Return m_SubTypeList + End Get + End Property + + Private m_IsModifiedSelectedSubType As Boolean = False + Private m_SelectedSubType As Integer + ' Proprietà che indica il SubType + Public Property SelectedSubType As Integer + Get + If IsNothing(SubTypeList) Then Return Nothing + Return m_SelectedSubType + End Get + Set(value As Integer) + If value <> m_SelectedSubType Then + If Not IsNothing(SubTypeList) Then + m_SelectedSubType = value + Dim OrigSubType As Integer = 0 + EgtGetMachiningParam(MCH_MP.SUBTYPE, OrigSubType) + OrigSubType = IdNameStruct.IndFromId(OrigSubType, SubTypeList) + m_IsModifiedSelectedSubType = If(value <> OrigSubType, True, False) + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End If + End Set + End Property + + 'ObservableCollection che contiene le variabili per il combobox LeadLinkType + Private m_LeadLinkTypeList As ObservableCollection(Of IdNameStruct) + Public ReadOnly Property LeadLinkTypeList As ObservableCollection(Of IdNameStruct) + Get + Select Case m_Type + Case MCH_MY.SAWROUGHING + m_LeadLinkTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAWROU_LL.CENT, EgtMsg(MSG_MACHININGSDBPAGE + 120)), New IdNameStruct(MCH_SAWROU_LL.EXT, EgtMsg(MSG_MACHININGSDBPAGE + 123))}) + Case MCH_MY.SAWFINISHING + m_LeadLinkTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAWFIN_LL.STD, EgtMsg(MSG_MACHININGSDBPAGE + 124)), New IdNameStruct(MCH_SAWFIN_LL.CENT, EgtMsg(MSG_MACHININGSDBPAGE + 120)), New IdNameStruct(MCH_SAWFIN_LL.EXT, EgtMsg(MSG_MACHININGSDBPAGE + 123))}) + Case Else + m_LeadLinkTypeList = Nothing + End Select + Return m_LeadLinkTypeList + End Get + End Property + + Private m_IsModifiedSelectedLeadLinkType As Boolean = False + Private m_SelectedLeadLinkType As Integer + ' Proprietà che indica il LeadLinkType + Public Property SelectedLeadLinkType As Integer + Get + If IsNothing(LeadLinkTypeList) Then Return Nothing + Return IdNameStruct.IdFromInd(m_SelectedLeadLinkType, LeadLinkTypeList) + End Get + Set(value As Integer) + If value <> m_SelectedLeadLinkType Then + If Not IsNothing(LeadLinkTypeList) Then + m_SelectedLeadLinkType = IdNameStruct.IndFromId(value, LeadLinkTypeList) + Dim OrigLeadLinkType As Integer = 0 + EgtGetMachiningParam(MCH_MP.LEADLINKTYPE, OrigLeadLinkType) + m_IsModifiedSelectedLeadLinkType = If(value <> OrigLeadLinkType, True, False) + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End If + End Set + End Property + + 'ObservableCollection che contiene le variabili per il combobox FaceUseType + Private m_FaceUseTypeList As ObservableCollection(Of IdNameStruct) + Public ReadOnly Property FaceUseTypeList As ObservableCollection(Of IdNameStruct) + Get + Select Case m_Type + Case MCH_MY.MORTISING + m_FaceUseTypeList = New ObservableCollection(Of IdNameStruct)( + {New IdNameStruct(MCH_MIL_FU.NONE, EgtMsg(MSG_MACHININGSDBPAGE + 153)), + New IdNameStruct(MCH_MIL_FU.PARAL_DOWN, EgtMsg(MSG_MACHININGSDBPAGE + 157) & EgtMsg(MSG_MACHININGSDBPAGE + 154)), + New IdNameStruct(MCH_MIL_FU.PARAL_TOP, EgtMsg(MSG_MACHININGSDBPAGE + 158) & EgtMsg(MSG_MACHININGSDBPAGE + 154)), + New IdNameStruct(MCH_MIL_FU.PARAL_FRONT, EgtMsg(MSG_MACHININGSDBPAGE + 159) & EgtMsg(MSG_MACHININGSDBPAGE + 154)), + New IdNameStruct(MCH_MIL_FU.PARAL_BACK, EgtMsg(MSG_MACHININGSDBPAGE + 160) & EgtMsg(MSG_MACHININGSDBPAGE + 154)), + New IdNameStruct(MCH_MIL_FU.PARAL_LEFT, EgtMsg(MSG_MACHININGSDBPAGE + 161) & EgtMsg(MSG_MACHININGSDBPAGE + 154)), + New IdNameStruct(MCH_MIL_FU.PARAL_RIGHT, EgtMsg(MSG_MACHININGSDBPAGE + 162) & EgtMsg(MSG_MACHININGSDBPAGE + 154))}) + Case Else + m_FaceUseTypeList = New ObservableCollection(Of IdNameStruct)( + {New IdNameStruct(MCH_MIL_FU.NONE, EgtMsg(MSG_MACHININGSDBPAGE + 153)), + New IdNameStruct(MCH_MIL_FU.PARAL_DOWN, EgtMsg(MSG_MACHININGSDBPAGE + 157) & EgtMsg(MSG_MACHININGSDBPAGE + 154)), + New IdNameStruct(MCH_MIL_FU.PARAL_TOP, EgtMsg(MSG_MACHININGSDBPAGE + 158) & EgtMsg(MSG_MACHININGSDBPAGE + 154)), + New IdNameStruct(MCH_MIL_FU.PARAL_FRONT, EgtMsg(MSG_MACHININGSDBPAGE + 159) & EgtMsg(MSG_MACHININGSDBPAGE + 154)), + New IdNameStruct(MCH_MIL_FU.PARAL_BACK, EgtMsg(MSG_MACHININGSDBPAGE + 160) & EgtMsg(MSG_MACHININGSDBPAGE + 154)), + New IdNameStruct(MCH_MIL_FU.PARAL_LEFT, EgtMsg(MSG_MACHININGSDBPAGE + 161) & EgtMsg(MSG_MACHININGSDBPAGE + 154)), + New IdNameStruct(MCH_MIL_FU.PARAL_RIGHT, EgtMsg(MSG_MACHININGSDBPAGE + 162) & EgtMsg(MSG_MACHININGSDBPAGE + 154)), + New IdNameStruct(MCH_MIL_FU.ORTHO_DOWN, EgtMsg(MSG_MACHININGSDBPAGE + 157) & EgtMsg(MSG_MACHININGSDBPAGE + 155)), + New IdNameStruct(MCH_MIL_FU.ORTHO_TOP, EgtMsg(MSG_MACHININGSDBPAGE + 158) & EgtMsg(MSG_MACHININGSDBPAGE + 155)), + New IdNameStruct(MCH_MIL_FU.ORTHO_FRONT, EgtMsg(MSG_MACHININGSDBPAGE + 159) & EgtMsg(MSG_MACHININGSDBPAGE + 155)), + New IdNameStruct(MCH_MIL_FU.ORTHO_BACK, EgtMsg(MSG_MACHININGSDBPAGE + 160) & EgtMsg(MSG_MACHININGSDBPAGE + 155)), + New IdNameStruct(MCH_MIL_FU.ORTHO_LEFT, EgtMsg(MSG_MACHININGSDBPAGE + 161) & EgtMsg(MSG_MACHININGSDBPAGE + 155)), + New IdNameStruct(MCH_MIL_FU.ORTHO_RIGHT, EgtMsg(MSG_MACHININGSDBPAGE + 162) & EgtMsg(MSG_MACHININGSDBPAGE + 155)), + New IdNameStruct(MCH_MIL_FU.ORTHO_CONT, EgtMsg(MSG_MACHININGSDBPAGE + 163) & EgtMsg(MSG_MACHININGSDBPAGE + 155)), + New IdNameStruct(MCH_MIL_FU.ORTUP_DOWN, EgtMsg(MSG_MACHININGSDBPAGE + 157) & EgtMsg(MSG_MACHININGSDBPAGE + 156)), + New IdNameStruct(MCH_MIL_FU.ORTUP_TOP, EgtMsg(MSG_MACHININGSDBPAGE + 158) & EgtMsg(MSG_MACHININGSDBPAGE + 156)), + New IdNameStruct(MCH_MIL_FU.ORTUP_FRONT, EgtMsg(MSG_MACHININGSDBPAGE + 159) & EgtMsg(MSG_MACHININGSDBPAGE + 156)), + New IdNameStruct(MCH_MIL_FU.ORTUP_BACK, EgtMsg(MSG_MACHININGSDBPAGE + 160) & EgtMsg(MSG_MACHININGSDBPAGE + 156)), + New IdNameStruct(MCH_MIL_FU.ORTUP_LEFT, EgtMsg(MSG_MACHININGSDBPAGE + 161) & EgtMsg(MSG_MACHININGSDBPAGE + 156)), + New IdNameStruct(MCH_MIL_FU.ORTUP_RIGHT, EgtMsg(MSG_MACHININGSDBPAGE + 162) & EgtMsg(MSG_MACHININGSDBPAGE + 156)), + New IdNameStruct(MCH_MIL_FU.ORTUP_CONT, EgtMsg(MSG_MACHININGSDBPAGE + 163) & EgtMsg(MSG_MACHININGSDBPAGE + 156))}) + End Select + Return m_FaceUseTypeList + End Get + End Property + + Private m_IsModifiedSelectedFaceUseType As Boolean = False + Private m_SelectedFaceUseType As Integer = 0 + + ' Proprietà che indica il FaceUseType (MCH_MIL_FU) + Public Property SelectedFaceUseType As Integer + Get + If IsNothing(FaceUseTypeList) Then Return Nothing + Return m_SelectedFaceUseType + End Get + Set(value As Integer) + If value <> m_SelectedFaceUseType Then + If Not IsNothing(FaceUseTypeList) Then + m_SelectedFaceUseType = value + Dim OrigFaceUseType As Integer = 0 + EgtGetMachiningParam(MCH_MP.FACEUSE, OrigFaceUseType) + OrigFaceUseType = IdNameStruct.IndFromId(OrigFaceUseType, FaceUseTypeList) + m_IsModifiedSelectedFaceUseType = If(value <> OrigFaceUseType, True, False) + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End If + End Set + End Property + + 'ObservableCollection che contiene le variabili per il combobox SolChoiceType + Private m_SolChoiceTypeList As New ObservableCollection(Of IdNameStruct)( + {New IdNameStruct(MCH_SCC.NONE, EgtMsg(MSG_MACHININGSDBPAGE + 105)), + New IdNameStruct(MCH_SCC.STD, EgtMsg(MSG_MACHININGSDBPAGE + 106)), + New IdNameStruct(MCH_SCC.OPPOSITE, EgtMsg(MSG_MACHININGSDBPAGE + 107)), + New IdNameStruct(MCH_SCC.ADIR_XP, EgtMsg(MSG_MACHININGSDBPAGE + 108)), + New IdNameStruct(MCH_SCC.ADIR_XM, EgtMsg(MSG_MACHININGSDBPAGE + 109)), + New IdNameStruct(MCH_SCC.ADIR_YP, EgtMsg(MSG_MACHININGSDBPAGE + 110)), + New IdNameStruct(MCH_SCC.ADIR_YM, EgtMsg(MSG_MACHININGSDBPAGE + 111)), + New IdNameStruct(MCH_SCC.ADIR_ZP, EgtMsg(MSG_MACHININGSDBPAGE + 112)), + New IdNameStruct(MCH_SCC.ADIR_ZM, EgtMsg(MSG_MACHININGSDBPAGE + 113)), + New IdNameStruct(MCH_SCC.ADIR_NEAR, EgtMsg(MSG_MACHININGSDBPAGE + 114)), + New IdNameStruct(MCH_SCC.ADIR_FAR, EgtMsg(MSG_MACHININGSDBPAGE + 115))}) + Public ReadOnly Property SolChoiceTypeList As ObservableCollection(Of IdNameStruct) + Get + Return m_SolChoiceTypeList + End Get + End Property + + Private m_IsModifiedSelectedSolChoiceType As Boolean = False + Private m_SelectedSolChoiceType As Integer + ' Proprietà che indica il SolChoiceType (MCH_SCC) + Public Property SelectedSolChoiceType As Integer + Get + If IsNothing(SolChoiceTypeList) Then Return Nothing + Return m_SelectedSolChoiceType + End Get + Set(value As Integer) + If value <> m_SelectedSolChoiceType Then + If Not IsNothing(SolChoiceTypeList) Then + m_SelectedSolChoiceType = value + Dim OrigSolChoiceType As Integer = 0 + EgtGetMachiningParam(MCH_MP.SOLCHOICETYPE, OrigSolChoiceType) + OrigSolChoiceType = IdNameStruct.IndFromId(OrigSolChoiceType, SolChoiceTypeList) + m_IsModifiedSelectedSolChoiceType = If(value <> OrigSolChoiceType, True, False) + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End If + End Set + End Property + + Private m_IsModifiedSpeed As Boolean = False + Private m_Speed As String + ''' + ''' Property that read and write to the Machining's database the Speed + ''' + Public Property Speed As String + Get + Return m_Speed + End Get + Set(value As String) + If value <> m_Speed Then + m_Speed = value + Dim OrigSpeed As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.SPEED, OrigSpeed) + StringToDouble(value, dValue) + m_IsModifiedSpeed = Math.Abs(dValue - OrigSpeed) > 10 * EPS_ANG_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedFeed As Boolean = False + Private m_Feed As String + ''' + ''' Property that read and write to the Machining's database the Feed + ''' + Public Property Feed As String + Get + Return m_Feed + End Get + Set(value As String) + If value <> m_Feed Then + m_Feed = value + Dim OrigFeed As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.FEED, OrigFeed) + StringToLen(value, dValue) + m_IsModifiedFeed = Math.Abs(dValue - OrigFeed) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedStartFeed As Boolean = False + Private m_StartFeed As String + ''' + ''' Property that read and write to the Machining's database the Start Feed + ''' + Public Property StartFeed As String + Get + Return m_StartFeed + End Get + Set(value As String) + If value <> m_StartFeed Then + m_StartFeed = value + Dim OrigStartFeed As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.STARTFEED, OrigStartFeed) + StringToLen(value, dValue) + m_IsModifiedStartFeed = Math.Abs(dValue - OrigStartFeed) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedEndFeed As Boolean = False + Private m_EndFeed As String + ''' + ''' Property that read and write to the Machining's database the End Feed + ''' + Public Property EndFeed As String + Get + Return m_EndFeed + End Get + Set(value As String) + If value <> m_EndFeed Then + m_EndFeed = value + Dim OrigEndFeed As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.ENDFEED, OrigEndFeed) + StringToLen(value, dValue) + m_IsModifiedEndFeed = Math.Abs(dValue - OrigEndFeed) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedTipFeed As Boolean = False + Private m_TipFeed As String + ''' + ''' Property that read and write to the Machining's database the Tip Feed + ''' + Public Property TipFeed As String + Get + Return m_TipFeed + End Get + Set(value As String) + If value <> m_TipFeed Then + m_TipFeed = value + Dim OrigTipFeed As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.TIPFEED, OrigTipFeed) + StringToLen(value, dValue) + m_IsModifiedTipFeed = Math.Abs(dValue - OrigTipFeed) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedOffSr As Boolean = False + Private m_OffSr As String + ''' + ''' Property that read and write to the Machining's database the Offset Sr + ''' + Public Property OffSr As String + Get + Return m_OffSr + End Get + Set(value As String) + If value <> m_OffSr Then + m_OffSr = value + Dim OrigOffSr As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.OFFSR, OrigOffSr) + StringToLen(value, dValue) + m_IsModifiedOffSr = Math.Abs(dValue - OrigOffSr) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedOffSl As Boolean = False + Private m_OffSl As String + ''' + ''' Property that read and write to the Machining's database the Offset Sl + ''' + Public Property OffSl As String + Get + Return m_OffSl + End Get + Set(value As String) + If value <> m_OffSl Then + m_OffSl = value + Dim OrigOffSl As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.OFFSL, OrigOffSl) + StringToLen(value, dValue) + m_IsModifiedOffSl = Math.Abs(dValue - OrigOffSl) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedSideAngle As Boolean = False + Private m_SideAngle As String + ''' + ''' Property that read and write to the Machining's database the Side Angle + ''' + Public Property SideAngle As String + Get + Return m_SideAngle + End Get + Set(value As String) + If value <> m_SideAngle Then + m_SideAngle = value + Dim OrigSideAngle As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.SIDEANGLE, OrigSideAngle) + StringToLen(value, dValue) + m_IsModifiedSideAngle = Math.Abs(dValue - OrigSideAngle) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedApprox As Boolean = False + Private m_Approx As String + ''' + ''' Property that read and write to the Machining's database the Approx + ''' + Public Property Approx As String + Get + Return m_Approx + End Get + Set(value As String) + If value <> m_Approx Then + m_Approx = value + Dim OrigApprox As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.APPROX, OrigApprox) + StringToLen(value, dValue) + m_IsModifiedApprox = Math.Abs(dValue - OrigApprox) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedStartPos As Boolean = False + Private m_StartPos As String + ''' + ''' Property that read and write to the Machining's database the Start Position + ''' + Public Property StartPos As String + Get + Return m_StartPos + End Get + Set(value As String) + If value <> m_StartPos Then + m_StartPos = value + Dim OrigStartPos As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.STARTPOS, OrigStartPos) + StringToLen(value, dValue) + m_IsModifiedStartPos = Math.Abs(dValue - OrigStartPos) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedStartSlowLen As Boolean = False + Private m_StartSlowLen As String + ''' + ''' Property that read and write to the Machining's database the Start Slow Len + ''' + Public Property StartSlowLen As String + Get + Return m_StartSlowLen + End Get + Set(value As String) + If value <> m_StartSlowLen Then + m_StartSlowLen = value + Dim OrigStartSlowLen As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.STARTSLOWLEN, OrigStartSlowLen) + StringToLen(value, dValue) + m_IsModifiedStartSlowLen = Math.Abs(dValue - OrigStartSlowLen) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedEndSlowLen As Boolean = False + Private m_EndSlowLen As String + ''' + ''' Property that read and write to the Machining's database the End Slow Len + ''' + Public Property EndSlowLen As String + Get + Return m_EndSlowLen + End Get + Set(value As String) + If value <> m_EndSlowLen Then + m_EndSlowLen = value + Dim OrigEndSlowLen As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.ENDSLOWLEN, OrigEndSlowLen) + StringToLen(value, dValue) + m_IsModifiedEndSlowLen = Math.Abs(dValue - OrigEndSlowLen) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedThrouAddLen As Boolean = False + Private m_ThrouAddLen As String + ''' + ''' Property that read and write to the Machining's database the Throu Add Len + ''' + Public Property ThrouAddLen As String + Get + Return m_ThrouAddLen + End Get + Set(value As String) + If value <> m_ThrouAddLen Then + m_ThrouAddLen = value + Dim OrigThrouAddLen As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.THROUADDLEN, OrigThrouAddLen) + StringToLen(value, dValue) + m_IsModifiedThrouAddLen = Math.Abs(dValue - OrigThrouAddLen) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedStepPar As Boolean = False + Private m_StepPar As String + ''' + ''' Property that read and write to the Machining's database the Step Par + ''' + Public Property StepPar As String + Get + Return m_StepPar + End Get + Set(value As String) + If value <> m_StepPar Then + m_StepPar = value + Dim OrigStepPar As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.STEP_, OrigStepPar) + StringToLen(value, dValue) + m_IsModifiedStepPar = Math.Abs(dValue - OrigStepPar) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedReturnPos As Boolean = False + Private m_ReturnPos As String + ''' + ''' Property that read and write to the Machining's database the Return Position + ''' + Public Property ReturnPos As String + Get + Return m_ReturnPos + End Get + Set(value As String) + If value <> m_ReturnPos Then + m_ReturnPos = value + Dim OrigReturnPos As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.RETURNPOS, OrigReturnPos) + StringToLen(value, dValue) + m_IsModifiedReturnPos = Math.Abs(dValue - OrigReturnPos) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedOverLap As Boolean = False + Private m_OverLap As String + ''' + ''' Property that read and write to the Machining's database the Over Lap Str + ''' + Public Property OverLap As String + Get + Return m_OverLap + End Get + Set(value As String) + If value = String.Empty Or value <> m_OverLap Then + m_OverLap = value + Dim OrigOverLap As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.OVERL, OrigOverLap) + StringToLen(value, dValue) + m_IsModifiedOverLap = Math.Abs(dValue - OrigOverLap) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedTabLen As Boolean = False + Private m_TabLen As String + ''' + ''' Property that read and write to the Machining's database the Tab Len + ''' + Public Property TabLen As String + Get + Return m_TabLen + End Get + Set(value As String) + If value <> m_TabLen Then + m_TabLen = value + Dim OrigTabLen As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.TABLEN, OrigTabLen) + StringToLen(value, dValue) + m_IsModifiedTabLen = Math.Abs(dValue - OrigTabLen) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedTabDist As Boolean = False + Private m_TabDist As String + ''' + ''' Property that read and write to the Machining's database the Tab Dist + ''' + Public Property TabDist As String + Get + Return m_TabDist + End Get + Set(value As String) + If value <> m_TabDist Then + m_TabDist = value + Dim OrigTabDist As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.TABDIST, OrigTabDist) + StringToLen(value, dValue) + m_IsModifiedTabDist = Math.Abs(dValue - OrigTabDist) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedTabHeight As Boolean = False + Private m_TabHeight As String + ''' + ''' Property that read and write to the Machining's database the Tab Height + ''' + Public Property TabHeight As String + Get + Return m_TabHeight + End Get + Set(value As String) + If value <> m_TabHeight Then + m_TabHeight = value + Dim OrigTabHeight As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.TABHEIGHT, OrigTabHeight) + StringToLen(value, dValue) + m_IsModifiedTabHeight = Math.Abs(dValue - OrigTabHeight) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedTabAngle As Boolean = False + Private m_TabAngle As String + ''' + ''' Property that read and write to the Machining's database the Tab Angle + ''' + Public Property TabAngle As String + Get + Return m_TabAngle + End Get + Set(value As String) + If value <> m_TabAngle Then + m_TabAngle = value + Dim OrigTabAngle As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.TABANGLE, OrigTabAngle) + StringToLen(value, dValue) + m_IsModifiedTabAngle = Math.Abs(dValue - OrigTabAngle) > 10 * EPS_ANG_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedLiTang As Boolean = False + Private m_LiTang As String + ''' + ''' Property that read and write to the Machining's database the Li Tang + ''' + Public Property LiTang As String + Get + Return m_LiTang + End Get + Set(value As String) + If value <> m_LiTang Then + m_LiTang = value + Dim OrigLiTang As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.LITANG, OrigLiTang) + StringToLen(value, dValue) + m_IsModifiedLiTang = Math.Abs(dValue - OrigLiTang) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedLiPerp As Boolean = False + Private m_LiPerp As String + ''' + ''' Property that read and write to the Machining's database the Li Perp + ''' + Public Property LiPerp As String + Get + Return m_LiPerp + End Get + Set(value As String) + If value <> m_LiPerp Then + m_LiPerp = value + Dim OrigLiPerp As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.LIPERP, OrigLiPerp) + StringToLen(value, dValue) + m_IsModifiedLiPerp = Math.Abs(dValue - OrigLiPerp) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedLiElev As Boolean = False + Private m_LiElev As String + ''' + ''' Property that read and write to the Machining's database the Li Elev + ''' + Public Property LiElev As String + Get + Return m_LiElev + End Get + Set(value As String) + If value <> m_LiElev Then + m_LiElev = value + Dim OrigLiElev As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.LIELEV, OrigLiElev) + StringToLen(value, dValue) + m_IsModifiedLiElev = Math.Abs(dValue - OrigLiElev) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedLiCompLen As Boolean = False + Private m_LiCompLen As String + ''' + ''' Property that read and write to the Machining's database the Li Comp Len + ''' + Public Property LiCompLen As String + Get + Return m_LiCompLen + End Get + Set(value As String) + If value <> m_LiCompLen Then + m_LiCompLen = value + Dim OrigLiCompLen As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.LICOMPLEN, OrigLiCompLen) + StringToLen(value, dValue) + m_IsModifiedLiCompLen = Math.Abs(dValue - OrigLiCompLen) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedLoTang As Boolean = False + Private m_LoTang As String + ''' + ''' Property that read and write to the Machining's database the Lo Tang + ''' + Public Property LoTang As String + Get + Return m_LoTang + End Get + Set(value As String) + If value <> m_LoTang Then + m_LoTang = value + Dim OrigLoTang As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.LOTANG, OrigLoTang) + StringToLen(value, dValue) + m_IsModifiedLoTang = Math.Abs(dValue - OrigLoTang) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedLoPerp As Boolean = False + Private m_LoPerp As String + ''' + ''' Property that read and write to the Machining's database the Lo Perp + ''' + Public Property LoPerp As String + Get + Return m_LoPerp + End Get + Set(value As String) + If value <> m_LoPerp Then + m_LoPerp = value + Dim OrigLoPerp As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.LOPERP, OrigLoPerp) + StringToLen(value, dValue) + m_IsModifiedLoPerp = Math.Abs(dValue - OrigLoPerp) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedLoElev As Boolean = False + Private m_LoElev As String + ''' + ''' Property that read and write to the Machining's database the Lo Elev + ''' + Public Property LoElev As String + Get + Return m_LoElev + End Get + Set(value As String) + If value <> m_LoElev Then + m_LoElev = value + Dim OrigLoElev As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.LOELEV, OrigLoElev) + StringToLen(value, dValue) + m_IsModifiedLoElev = Math.Abs(dValue - OrigLoElev) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedLoCompLen As Boolean = False + Private m_LoCompLen As String + ''' + ''' Property that read and write to the Machining's database the Lo Comp Len + ''' + Public Property LoCompLen As String + Get + Return m_LoCompLen + End Get + Set(value As String) + If value <> m_LoCompLen Then + m_LoCompLen = value + Dim OrigLoCompLen As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.LOCOMPLEN, OrigLoCompLen) + StringToLen(value, dValue) + m_IsModifiedLoCompLen = Math.Abs(dValue - OrigLoCompLen) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedStartAddLen As Boolean = False + Private m_StartAddLen As String + ''' + ''' Property that read and write to the Machining's database the Start Add Len + ''' + Public Property StartAddLen As String + Get + Return m_StartAddLen + End Get + Set(value As String) + If value <> m_StartAddLen Then + m_StartAddLen = value + Dim OrigStartAddLen As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.STARTADDLEN, OrigStartAddLen) + StringToLen(value, dValue) + m_IsModifiedStartAddLen = Math.Abs(dValue - OrigStartAddLen) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedEndAddLen As Boolean = False + Private m_EndAddLen As String + ''' + ''' Property that read and write to the Machining's database the End Add Len + ''' + Public Property EndAddLen As String + Get + Return m_EndAddLen + End Get + Set(value As String) + If value <> m_EndAddLen Then + m_EndAddLen = value + Dim OrigEndAddLen As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.ENDADDLEN, OrigEndAddLen) + StringToLen(value, dValue) + m_IsModifiedEndAddLen = Math.Abs(dValue - OrigEndAddLen) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedStepExtArc As Boolean = False + Private m_StepExtArc As String + ''' + ''' Property that read and write to the Machining's database the Step Ext Arc + ''' + Public Property StepExtArc As String + Get + Return m_StepExtArc + End Get + Set(value As String) + If value <> m_StepExtArc Then + m_StepExtArc = value + Dim OrigStepExtArc As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.STEPEXTARC, OrigStepExtArc) + StringToLen(value, dValue) + m_IsModifiedStepExtArc = Math.Abs(dValue - OrigStepExtArc) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedStepIntArc As Boolean = False + Private m_StepIntArc As String + ''' + ''' Property that read and write to the Machining's database the Step Int Arc + ''' + Public Property StepIntArc As String + Get + Return m_StepIntArc + End Get + Set(value As String) + If value <> m_StepIntArc Then + m_StepIntArc = value + Dim OrigStepIntArc As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.STEPINTARC, OrigStepIntArc) + StringToLen(value, dValue) + m_IsModifiedStepIntArc = Math.Abs(dValue - OrigStepIntArc) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedSideStep As Boolean = False + Private m_SideStep As String + ''' + ''' Property that read and write to the Machining's database the Side Step + ''' + Public Property SideStep As String + Get + Return m_SideStep + End Get + Set(value As String) + If value <> m_SideStep Then + m_SideStep = value + Dim OrigSideStep As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.SIDESTEP, OrigSideStep) + StringToLen(value, dValue) + m_IsModifiedSideStep = Math.Abs(dValue - OrigSideStep) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedVertFeed As Boolean = False + Private m_VertFeed As String + ''' + ''' Property that read and write to the Machining's database the Vert Feed + ''' + Public Property VertFeed As String + Get + Return m_VertFeed + End Get + Set(value As String) + If value <> m_VertFeed Then + m_VertFeed = value + Dim OrigVertFeed As Double = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.VERTFEED, OrigVertFeed) + StringToLen(value, dValue) + m_IsModifiedVertFeed = Math.Abs(dValue - OrigVertFeed) > 10 * EPS_SMALL + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedDepthStr As Boolean = False + Private m_DepthStr As String + ''' + ''' Property that read and write to the Machining's database the Depth Str + ''' + Public Property DepthStr As String + Get + Return m_DepthStr + End Get + Set(value As String) + If value = String.Empty Or value <> m_DepthStr Then + m_DepthStr = value + Dim DbDepthStr As String = String.Empty + EgtGetMachiningParam(MCH_MP.DEPTH_STR, DbDepthStr) + m_IsModifiedDepthStr = If(value <> DbDepthStr, True, False) + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedUserNotes As Boolean = False + Private m_UserNotes As String + ''' + ''' Property that read and write to the Machining's database the User Notes + ''' + Public Property UserNotes As String + Get + Return m_UserNotes + End Get + Set(value As String) + If value = String.Empty Or value <> m_UserNotes Then + m_UserNotes = value + Dim OrigUserNotes As String = String.Empty + EgtGetMachiningParam(MCH_MP.USERNOTES, OrigUserNotes) + m_IsModifiedUserNotes = If(value <> OrigUserNotes, True, False) + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedInitAngs As Boolean = False + Private m_InitAngs As String + ''' + ''' Property that read and write to the Machining's database the Initial Angles + ''' + Public Property InitAngs As String + Get + Return m_InitAngs + End Get + Set(value As String) + If value = String.Empty Or value <> m_InitAngs Then + m_InitAngs = value + Dim OrigInitAngs As String = String.Empty + EgtGetMachiningParam(MCH_MP.INITANGS, OrigInitAngs) + m_IsModifiedInitAngs = If(value <> OrigInitAngs, True, False) + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_IsModifiedBlockedAxis As Boolean = False + Private m_BlockedAxis As String + ''' + ''' Property that read and write to the Machining's database the Initial Angles + ''' + Public Property BlockedAxis As String + Get + Return m_BlockedAxis + End Get + Set(value As String) + If value = String.Empty Or value <> m_BlockedAxis Then + m_BlockedAxis = value + Dim OrigBlockedAxis As String = String.Empty + EgtGetMachiningParam(MCH_MP.BLOCKEDAXIS, OrigBlockedAxis) + m_IsModifiedBlockedAxis = If(value <> OrigBlockedAxis, True, False) + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End If + End Set + End Property + + Private m_UpdateMachiningBtnIsEnabled As Boolean + Public ReadOnly Property UpdateMachiningBtnIsEnabled As Boolean + Get + Return m_IsModifiedInvert OrElse m_IsModifiedSelectedWorkSide OrElse m_IsModifiedSelectedHeadSide OrElse m_IsModifiedSelectedLeadInType OrElse m_IsModifiedSelectedExtLinkType _ + OrElse m_IsModifiedSelectedLeadOutType OrElse m_IsModifiedSelectedCurveUse OrElse m_IsModifiedSelectedStepType OrElse m_IsModifiedSelectedSubType OrElse m_IsModifiedSelectedLeadLinkType _ + OrElse m_IsModifiedSpeed OrElse m_IsModifiedFeed OrElse m_IsModifiedStartFeed OrElse m_IsModifiedEndFeed OrElse m_IsModifiedTipFeed OrElse m_IsModifiedOffSr OrElse m_IsModifiedOffSl _ + OrElse m_IsModifiedSideAngle OrElse m_IsModifiedApprox OrElse m_IsModifiedStartPos OrElse m_IsModifiedStartSlowLen OrElse m_IsModifiedEndSlowLen OrElse m_IsModifiedThrouAddLen _ + OrElse m_IsModifiedStepPar OrElse m_IsModifiedReturnPos OrElse m_IsModifiedOverLap OrElse m_IsModifiedTabLen OrElse m_IsModifiedTabDist OrElse m_IsModifiedTabHeight _ + OrElse m_IsModifiedTabAngle OrElse m_IsModifiedLiTang OrElse m_IsModifiedLiPerp OrElse m_IsModifiedLiElev OrElse m_IsModifiedLiCompLen OrElse m_IsModifiedLoTang OrElse m_IsModifiedLoPerp _ + OrElse m_IsModifiedLoElev OrElse m_IsModifiedLoCompLen OrElse m_IsModifiedStartAddLen OrElse m_IsModifiedEndAddLen OrElse m_IsModifiedStepExtArc OrElse m_IsModifiedStepIntArc _ + OrElse m_IsModifiedSideStep OrElse m_IsModifiedVertFeed OrElse m_IsModifiedDepthStr OrElse m_IsModifiedUserNotes + End Get + End Property + + Private m_bPreviewTool As Boolean = False + Private m_nPtEntId As Integer = GDB_ID.NULL + Public Property ViewTool As Boolean + Get + Return m_bPreviewTool + End Get + Set(value As Boolean) + If value Then + EgtPreparePreviewMachiningTool() + m_nPtEntId = EgtPreviewMachiningTool(GDB_ID.NULL, MCH_PTM.AFTER) + m_bPreviewTool = True + Else + EgtRemovePreviewMachiningTool() + m_bPreviewTool = False + End If + EgtDraw() + NotifyPropertyChanged("ViewTool") + End Set + End Property + +#Region "Messages" + + Public ReadOnly Property InvertMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 51) + End Get + End Property + + Public ReadOnly Property DepthMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 99) + End Get + End Property + + Public ReadOnly Property HeadSideMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 55) + End Get + End Property + + Public ReadOnly Property WorkSideMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 54) + End Get + End Property + + Public ReadOnly Property UserNotesMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 100) + End Get + End Property + + Private m_UserNotesTooltip As String + Public ReadOnly Property UserNotesTooltip As String + Get + Return UserNotes + End Get + End Property + + Public ReadOnly Property StartPosMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 73) + End Get + End Property + + Public ReadOnly Property ReturnPosMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 78) + End Get + End Property + + Public ReadOnly Property OverLapMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 101) + End Get + End Property + + Public ReadOnly Property ThrouAddLenMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 76) + End Get + End Property + + Public ReadOnly Property StepTypeMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 60) + End Get + End Property + + Public ReadOnly Property SubTypeMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 103) + End Get + End Property + + Public ReadOnly Property StepParMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 77) + End Get + End Property + + Public ReadOnly Property SideStepMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 95) + End Get + End Property + + Public ReadOnly Property StartSlowLenMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 74) + End Get + End Property + + Public ReadOnly Property EndSlowLenMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 75) + End Get + End Property + + Public ReadOnly Property SideAngleMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 71) + End Get + End Property + + Public ReadOnly Property OffsetSrMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 68) + End Get + End Property + + Public ReadOnly Property OffsetSlMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 69) + End Get + End Property + + Public ReadOnly Property AdvancedParamMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 150) + End Get + End Property + + Public ReadOnly Property InvertToolDirMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 151) + End Get + End Property + + Public ReadOnly Property FaceUseTypeMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 152) + End Get + End Property + + Public ReadOnly Property InitAngsMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 164) + End Get + End Property + + Public ReadOnly Property BlockedAxisMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 165) + End Get + End Property + + Public ReadOnly Property SolChoiceTypeMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 104) + End Get + End Property + + Public ReadOnly Property LeadInTypeMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 56) + End Get + End Property + + Public ReadOnly Property StartAddLenMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 91) + End Get + End Property + + Public ReadOnly Property LiTangMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 83) + End Get + End Property + + Public ReadOnly Property LiPerpMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 84) + End Get + End Property + + Public ReadOnly Property LiElevMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 85) + End Get + End Property + + Public ReadOnly Property LiCompLenMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 86) + End Get + End Property + + Public ReadOnly Property LeadOutTypeMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 58) + End Get + End Property + + Public ReadOnly Property EndAddLenMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 92) + End Get + End Property + + Public ReadOnly Property LoTangMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 87) + End Get + End Property + + Public ReadOnly Property LoPerpMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 88) + End Get + End Property + + Public ReadOnly Property LoElevMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 89) + End Get + End Property + + Public ReadOnly Property LoCompLenMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 90) + End Get + End Property + + Public ReadOnly Property ExtLinkTypeMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 57) + End Get + End Property + + Public ReadOnly Property LeaveTabMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 52) + End Get + End Property + + Public ReadOnly Property TabLenMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 79) + End Get + End Property + + Public ReadOnly Property TabHeightMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 80) + End Get + End Property + + Public ReadOnly Property TabAngleMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 81) + End Get + End Property + + Public ReadOnly Property TabDistMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 82) + End Get + End Property + + Public ReadOnly Property CurveUseMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 59) + End Get + End Property + + Public ReadOnly Property ApproxMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 72) + End Get + End Property + + Public ReadOnly Property StepExtArcMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 93) + End Get + End Property + + Public ReadOnly Property StepIntArcMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 94) + End Get + End Property + + Public ReadOnly Property SpeedMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 63) + End Get + End Property + + Public ReadOnly Property FeedMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 64) + End Get + End Property + + Public ReadOnly Property TipFeedMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 67) + End Get + End Property + + Public ReadOnly Property StartFeedMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 65) + End Get + End Property + + Public ReadOnly Property EndFeedMsg As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 66) + End Get + End Property + + Public ReadOnly Property OperationListHeader As String + Get + Return EgtMsg(MSG_OPERATION + 1) 'Lista Operazioni + End Get + End Property + + Public ReadOnly Property UpdateMachiningBtnMsg As String + Get + Return EgtMsg(MSG_OPERATION + 3) 'Applica Lavorazione + End Get + End Property + + Public ReadOnly Property GenericExpanderHeader As String + Get + Return EgtMsg(MSG_OPERATION + 7) 'Generici + End Get + End Property + + Public ReadOnly Property ToolExpanderHeader As String + Get + Return EgtMsg(MSG_MACHININGSDBPAGE + 98) & " (" & m_Tool & ")" + End Get + End Property + + Public ReadOnly Property ViewToolBtnMsg As String + Get + Return EgtMsg(MSG_OPERATION + 13) 'Anteprima Utensile + End Get + End Property + + Public ReadOnly Property NextStepToolBtnMsg As String + Get + Return EgtMsg(MSG_OPERATION + 14) 'Avanti + End Get + End Property + + Public ReadOnly Property PrevStepToolBtnMsg As String + Get + Return EgtMsg(MSG_OPERATION + 15) 'Indietro + End Get + End Property + +#End Region ' Messages + +#Region "METHODS" + + Private Sub ReadMachiningParam() + Dim nValue As Integer = 0 + Dim dValue As Double = 0 + EgtGetMachiningParam(MCH_MP.TYPE, m_Type) + NotifyPropertyChanged("Type") + EgtGetMachiningParam(MCH_MP.INVERT, m_Invert) + NotifyPropertyChanged("Invert") + m_IsModifiedInvert = False + EgtGetMachiningParam(MCH_MP.LEAVETAB, m_LeaveTab) + NotifyPropertyChanged("LeaveTab") + m_IsModifiedLeaveTab = False + EgtGetMachiningParam(MCH_MP.TOOLINVERT, m_ToolInvert) + NotifyPropertyChanged("ToolInvert") + m_IsModifiedToolInvert = False + NotifyPropertyChanged("WorkSideList") + EgtGetMachiningParam(MCH_MP.WORKSIDE, nValue) + m_SelectedWorkSide = If(IsNothing(WorkSideList), nValue, IdNameStruct.IndFromId(nValue, WorkSideList)) + NotifyPropertyChanged("SelectedWorkSide") + m_IsModifiedSelectedWorkSide = False + EgtGetMachiningParam(MCH_MP.HEADSIDE, nValue) + m_SelectedHeadSide = If(IsNothing(HeadSideList), nValue, IdNameStruct.IndFromId(nValue, HeadSideList)) + NotifyPropertyChanged("SelectedHeadSide") + m_IsModifiedSelectedHeadSide = False + NotifyPropertyChanged("LeadInTypeList") + EgtGetMachiningParam(MCH_MP.LEADINTYPE, m_SelectedLeadInType) + NotifyPropertyChanged("SelectedLeadInType") + m_IsModifiedSelectedLeadInType = False + EgtGetMachiningParam(MCH_MP.EXTLINKTYPE, m_SelectedExtLinkType) + NotifyPropertyChanged("SelectedExtLinkType") + m_IsModifiedSelectedExtLinkType = False + NotifyPropertyChanged("LeadOutTypeList") + EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, m_SelectedLeadOutType) + NotifyPropertyChanged("SelectedLeadOutType") + m_IsModifiedSelectedLeadOutType = False + NotifyPropertyChanged("CurveUseList") + EgtGetMachiningParam(MCH_MP.CURVEUSE, m_SelectedCurveUse) + NotifyPropertyChanged("SelectedCurveUse") + m_IsModifiedSelectedCurveUse = False + NotifyPropertyChanged("StepTypeList") + EgtGetMachiningParam(MCH_MP.STEPTYPE, nValue) + m_SelectedStepType = If(IsNothing(StepTypeList), nValue, IdNameStruct.IndFromId(nValue, StepTypeList)) + NotifyPropertyChanged("SelectedStepType") + m_IsModifiedSelectedStepType = False + NotifyPropertyChanged("SubTypeList") + EgtGetMachiningParam(MCH_MP.SUBTYPE, nValue) + m_SelectedSubType = If(IsNothing(SubTypeList), nValue, IdNameStruct.IndFromId(nValue, SubTypeList)) + NotifyPropertyChanged("SelectedSubType") + m_IsModifiedSelectedSubType = False + NotifyPropertyChanged("LeadLinkTypeList") + EgtGetMachiningParam(MCH_MP.LEADLINKTYPE, m_SelectedLeadLinkType) + NotifyPropertyChanged("SelectedLeadLinkType") + m_IsModifiedSelectedLeadLinkType = False + NotifyPropertyChanged("FaceUseTypeList") + EgtGetMachiningParam(MCH_MP.FACEUSE, nValue) + m_SelectedFaceUseType = If(IsNothing(FaceUseTypeList), nValue, IdNameStruct.IndFromId(nValue, FaceUseTypeList)) + NotifyPropertyChanged("SelectedFaceUseType") + m_IsModifiedSelectedFaceUseType = False + NotifyPropertyChanged("SolChoiceTypeList") + EgtGetMachiningParam(MCH_MP.SOLCHOICETYPE, nValue) + m_SelectedSolChoiceType = If(IsNothing(SolChoiceTypeList), nValue, IdNameStruct.IndFromId(nValue, SolChoiceTypeList)) + NotifyPropertyChanged("SelectedSolChoiceType") + m_IsModifiedSelectedSolChoiceType = False + EgtGetMachiningParam(MCH_MP.SPEED, dValue) + m_Speed = DoubleToString(dValue, 4) + NotifyPropertyChanged("Speed") + m_IsModifiedSpeed = False + EgtGetMachiningParam(MCH_MP.FEED, dValue) + m_Feed = LenToString(dValue, 4) + NotifyPropertyChanged("Feed") + m_IsModifiedFeed = False + EgtGetMachiningParam(MCH_MP.STARTFEED, dValue) + m_StartFeed = LenToString(dValue, 4) + NotifyPropertyChanged("StartFeed") + m_IsModifiedStartFeed = False + EgtGetMachiningParam(MCH_MP.ENDFEED, dValue) + m_EndFeed = LenToString(dValue, 4) + NotifyPropertyChanged("EndFeed") + m_IsModifiedEndFeed = False + EgtGetMachiningParam(MCH_MP.TIPFEED, dValue) + m_TipFeed = LenToString(dValue, 4) + NotifyPropertyChanged("TipFeed") + m_IsModifiedTipFeed = False + EgtGetMachiningParam(MCH_MP.OFFSR, dValue) + m_OffSr = LenToString(dValue, 4) + NotifyPropertyChanged("OffSr") + m_IsModifiedOffSr = False + EgtGetMachiningParam(MCH_MP.OFFSL, dValue) + m_OffSl = LenToString(dValue, 4) + NotifyPropertyChanged("OffSl") + m_IsModifiedOffSl = False + EgtGetMachiningParam(MCH_MP.SIDEANGLE, dValue) + m_SideAngle = DoubleToString(dValue, 4) + NotifyPropertyChanged("SideAngle") + m_IsModifiedSideAngle = False + EgtGetMachiningParam(MCH_MP.APPROX, dValue) + m_Approx = LenToString(dValue, 4) + NotifyPropertyChanged("Approx") + m_IsModifiedApprox = False + EgtGetMachiningParam(MCH_MP.STARTPOS, dValue) + m_StartPos = LenToString(dValue, 4) + NotifyPropertyChanged("StartPos") + m_IsModifiedStartPos = False + EgtGetMachiningParam(MCH_MP.STARTSLOWLEN, dValue) + m_StartSlowLen = LenToString(dValue, 4) + NotifyPropertyChanged("StartSlowLen") + m_IsModifiedStartSlowLen = False + EgtGetMachiningParam(MCH_MP.ENDSLOWLEN, dValue) + m_EndSlowLen = LenToString(dValue, 4) + NotifyPropertyChanged("EndSlowLen") + m_IsModifiedEndSlowLen = False + EgtGetMachiningParam(MCH_MP.THROUADDLEN, dValue) + m_ThrouAddLen = LenToString(dValue, 4) + NotifyPropertyChanged("ThrouAddLen") + m_IsModifiedThrouAddLen = False + EgtGetMachiningParam(MCH_MP.STEP_, dValue) + m_StepPar = LenToString(dValue, 4) + NotifyPropertyChanged("StepPar") + m_IsModifiedStepPar = False + EgtGetMachiningParam(MCH_MP.RETURNPOS, dValue) + m_ReturnPos = LenToString(dValue, 4) + NotifyPropertyChanged("ReturnPos") + m_IsModifiedReturnPos = False + EgtGetMachiningParam(MCH_MP.OVERL, dValue) + m_OverLap = LenToString(dValue, 4) + NotifyPropertyChanged("OverLap") + m_IsModifiedOverLap = False + EgtGetMachiningParam(MCH_MP.TABLEN, dValue) + m_TabLen = LenToString(dValue, 4) + NotifyPropertyChanged("TabLen") + m_IsModifiedTabLen = False + EgtGetMachiningParam(MCH_MP.TABDIST, dValue) + m_TabDist = LenToString(dValue, 4) + NotifyPropertyChanged("TabDist") + m_IsModifiedTabDist = False + EgtGetMachiningParam(MCH_MP.TABHEIGHT, dValue) + m_TabHeight = LenToString(dValue, 4) + NotifyPropertyChanged("TabHeight") + m_IsModifiedTabHeight = False + EgtGetMachiningParam(MCH_MP.TABANGLE, dValue) + m_TabAngle = LenToString(dValue, 4) + NotifyPropertyChanged("TabAngle") + m_IsModifiedTabAngle = False + EgtGetMachiningParam(MCH_MP.LITANG, dValue) + m_LiTang = LenToString(dValue, 4) + NotifyPropertyChanged("LiTang") + m_IsModifiedLiTang = False + EgtGetMachiningParam(MCH_MP.LIPERP, dValue) + m_LiPerp = LenToString(dValue, 4) + NotifyPropertyChanged("LiPerp") + m_IsModifiedLiPerp = False + EgtGetMachiningParam(MCH_MP.LIELEV, dValue) + m_LiElev = LenToString(dValue, 4) + NotifyPropertyChanged("LiElev") + m_IsModifiedLiElev = False + EgtGetMachiningParam(MCH_MP.LICOMPLEN, dValue) + m_LiCompLen = LenToString(dValue, 4) + NotifyPropertyChanged("LiCompLen") + m_IsModifiedLiCompLen = False + EgtGetMachiningParam(MCH_MP.LOTANG, dValue) + m_LoTang = LenToString(dValue, 4) + NotifyPropertyChanged("LoTang") + m_IsModifiedLoTang = False + EgtGetMachiningParam(MCH_MP.LOPERP, dValue) + m_LoPerp = LenToString(dValue, 4) + NotifyPropertyChanged("LoPerp") + m_IsModifiedLoPerp = False + EgtGetMachiningParam(MCH_MP.LOELEV, dValue) + m_LoElev = LenToString(dValue, 4) + NotifyPropertyChanged("LoElev") + m_IsModifiedLoElev = False + EgtGetMachiningParam(MCH_MP.LOCOMPLEN, dValue) + m_LoCompLen = LenToString(dValue, 4) + NotifyPropertyChanged("LoCompLen") + m_IsModifiedLoCompLen = False + EgtGetMachiningParam(MCH_MP.STARTADDLEN, dValue) + m_StartAddLen = LenToString(dValue, 4) + NotifyPropertyChanged("StartAddLen") + m_IsModifiedStartAddLen = False + EgtGetMachiningParam(MCH_MP.ENDADDLEN, dValue) + m_EndAddLen = LenToString(dValue, 4) + NotifyPropertyChanged("EndAddLen") + m_IsModifiedEndAddLen = False + EgtGetMachiningParam(MCH_MP.STEPEXTARC, dValue) + m_StepExtArc = LenToString(dValue, 4) + NotifyPropertyChanged("StepExtArc") + m_IsModifiedStepExtArc = False + EgtGetMachiningParam(MCH_MP.STEPEXTARC, dValue) + m_StepExtArc = LenToString(dValue, 4) + NotifyPropertyChanged("StepExtArc") + m_IsModifiedStepExtArc = False + EgtGetMachiningParam(MCH_MP.STEPINTARC, dValue) + m_StepIntArc = LenToString(dValue, 4) + NotifyPropertyChanged("StepIntArc") + m_IsModifiedStepIntArc = False + EgtGetMachiningParam(MCH_MP.SIDESTEP, dValue) + m_SideStep = LenToString(dValue, 4) + NotifyPropertyChanged("SideStep") + m_IsModifiedSideStep = False + EgtGetMachiningParam(MCH_MP.VERTFEED, dValue) + m_VertFeed = LenToString(dValue, 4) + NotifyPropertyChanged("VertFeed") + m_IsModifiedVertFeed = False + EgtGetMachiningParam(MCH_MP.TOOL, m_Tool) + NotifyPropertyChanged("ToolExpanderHeader") + EgtGetMachiningParam(MCH_MP.DEPTH_STR, m_DepthStr) + NotifyPropertyChanged("DepthStr") + m_IsModifiedDepthStr = False + EgtGetMachiningParam(MCH_MP.USERNOTES, m_UserNotes) + NotifyPropertyChanged("UserNotes") + m_IsModifiedUserNotes = False + EgtGetMachiningParam(MCH_MP.INITANGS, m_InitAngs) + NotifyPropertyChanged("InitAngs") + m_IsModifiedInitAngs = False + EgtGetMachiningParam(MCH_MP.BLOCKEDAXIS, m_BlockedAxis) + NotifyPropertyChanged("BlockedAxis") + m_IsModifiedBlockedAxis = False + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + End Sub + + Private Sub WriteMachiningParam() + Dim nValue As Integer = 0 + Dim dValue As Double = 0 + If m_IsModifiedInvert Then + If EgtSetMachiningParam(MCH_MP.INVERT, m_Invert) Then + m_IsModifiedInvert = False + End If + End If + If m_IsModifiedLeaveTab Then + If EgtSetMachiningParam(MCH_MP.LEAVETAB, m_LeaveTab) Then + m_IsModifiedLeaveTab = False + End If + End If + If m_IsModifiedToolInvert Then + If EgtSetMachiningParam(MCH_MP.TOOLINVERT, m_ToolInvert) Then + m_IsModifiedToolInvert = False + End If + End If + If m_IsModifiedSelectedWorkSide Then + nValue = If(IsNothing(WorkSideList), m_SelectedWorkSide, IdNameStruct.IdFromInd(m_SelectedWorkSide, WorkSideList)) + If EgtSetMachiningParam(MCH_MP.WORKSIDE, nValue) Then + m_IsModifiedSelectedWorkSide = False + End If + End If + If m_IsModifiedSelectedHeadSide Then + nValue = If(IsNothing(HeadSideList), m_SelectedHeadSide, IdNameStruct.IdFromInd(m_SelectedHeadSide, HeadSideList)) + If EgtSetMachiningParam(MCH_MP.HEADSIDE, nValue) Then + m_IsModifiedSelectedHeadSide = False + End If + End If + If m_IsModifiedSelectedLeadInType Then + If EgtSetMachiningParam(MCH_MP.LEADINTYPE, m_SelectedLeadInType) Then + m_IsModifiedSelectedLeadInType = False + End If + End If + If m_IsModifiedSelectedExtLinkType Then + If EgtSetMachiningParam(MCH_MP.EXTLINKTYPE, m_SelectedExtLinkType) Then + m_IsModifiedSelectedExtLinkType = False + End If + End If + If m_IsModifiedSelectedLeadOutType Then + If EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, m_SelectedLeadOutType) Then + m_IsModifiedSelectedLeadOutType = False + End If + End If + If m_IsModifiedSelectedCurveUse Then + If EgtSetMachiningParam(MCH_MP.CURVEUSE, m_SelectedCurveUse) Then + m_IsModifiedSelectedCurveUse = False + End If + End If + If m_IsModifiedSelectedStepType Then + nValue = If(IsNothing(StepTypeList), m_SelectedStepType, IdNameStruct.IdFromInd(m_SelectedStepType, StepTypeList)) + If EgtSetMachiningParam(MCH_MP.STEPTYPE, nValue) Then + m_IsModifiedSelectedStepType = False + End If + End If + If m_IsModifiedSelectedSubType Then + nValue = If(IsNothing(SubTypeList), m_SelectedSubType, IdNameStruct.IdFromInd(m_SelectedSubType, SubTypeList)) + If EgtSetMachiningParam(MCH_MP.SUBTYPE, nValue) Then + m_IsModifiedSelectedSubType = False + End If + End If + If m_IsModifiedSelectedLeadLinkType Then + If EgtSetMachiningParam(MCH_MP.LEADLINKTYPE, m_SelectedLeadLinkType) Then + m_IsModifiedSelectedLeadLinkType = False + End If + End If + If m_IsModifiedSelectedFaceUseType Then + nValue = If(IsNothing(FaceUseTypeList), m_SelectedFaceUseType, IdNameStruct.IdFromInd(m_SelectedFaceUseType, FaceUseTypeList)) + If EgtSetMachiningParam(MCH_MP.FACEUSE, nValue) Then + m_IsModifiedSelectedFaceUseType = False + End If + End If + If m_IsModifiedSelectedSolChoiceType Then + nValue = If(IsNothing(SolChoiceTypeList), m_SelectedSolChoiceType, IdNameStruct.IdFromInd(m_SelectedSolChoiceType, SolChoiceTypeList)) + If EgtSetMachiningParam(MCH_MP.SOLCHOICETYPE, nValue) Then + m_IsModifiedSelectedSolChoiceType = False + End If + End If + If m_IsModifiedSpeed Then + StringToDouble(m_Speed, dValue) + If EgtSetMachiningParam(MCH_MP.SPEED, dValue) Then + m_IsModifiedSpeed = False + End If + End If + If m_IsModifiedFeed Then + StringToLen(m_Feed, dValue) + If EgtSetMachiningParam(MCH_MP.FEED, dValue) Then + m_IsModifiedFeed = False + End If + End If + If m_IsModifiedStartFeed Then + StringToLen(m_StartFeed, dValue) + If EgtSetMachiningParam(MCH_MP.STARTFEED, dValue) Then + m_IsModifiedStartFeed = False + End If + End If + If m_IsModifiedEndFeed Then + StringToLen(m_EndFeed, dValue) + If EgtSetMachiningParam(MCH_MP.ENDFEED, dValue) Then + m_IsModifiedEndFeed = False + End If + End If + If m_IsModifiedTipFeed Then + StringToLen(m_TipFeed, dValue) + If EgtSetMachiningParam(MCH_MP.TIPFEED, dValue) Then + m_IsModifiedTipFeed = False + End If + End If + If m_IsModifiedOffSr Then + StringToLen(m_OffSr, dValue) + If EgtSetMachiningParam(MCH_MP.OFFSR, dValue) Then + m_IsModifiedOffSr = False + End If + End If + If m_IsModifiedOffSl Then + StringToLen(m_OffSl, dValue) + If EgtSetMachiningParam(MCH_MP.OFFSL, dValue) Then + m_IsModifiedOffSl = False + End If + End If + If m_IsModifiedSideAngle Then + StringToDouble(m_SideAngle, dValue) + If EgtSetMachiningParam(MCH_MP.SIDEANGLE, dValue) Then + m_IsModifiedSideAngle = False + End If + End If + If m_IsModifiedApprox Then + StringToLen(m_Approx, dValue) + If EgtSetMachiningParam(MCH_MP.APPROX, dValue) Then + m_IsModifiedApprox = False + End If + End If + If m_IsModifiedStartPos Then + StringToLen(m_StartPos, dValue) + If EgtSetMachiningParam(MCH_MP.STARTPOS, dValue) Then + m_IsModifiedStartPos = False + End If + End If + If m_IsModifiedStartSlowLen Then + StringToLen(m_StartSlowLen, dValue) + If EgtSetMachiningParam(MCH_MP.STARTSLOWLEN, dValue) Then + m_IsModifiedStartSlowLen = False + End If + End If + If m_IsModifiedEndSlowLen Then + StringToLen(m_EndSlowLen, dValue) + If EgtSetMachiningParam(MCH_MP.ENDSLOWLEN, dValue) Then + m_IsModifiedEndSlowLen = False + End If + End If + If m_IsModifiedThrouAddLen Then + StringToLen(m_ThrouAddLen, dValue) + If EgtSetMachiningParam(MCH_MP.THROUADDLEN, dValue) Then + m_IsModifiedThrouAddLen = False + End If + End If + If m_IsModifiedStepPar Then + StringToLen(m_StepPar, dValue) + If EgtSetMachiningParam(MCH_MP.STEP_, dValue) Then + m_IsModifiedStepPar = False + End If + End If + If m_IsModifiedReturnPos Then + StringToLen(m_ReturnPos, dValue) + If EgtSetMachiningParam(MCH_MP.RETURNPOS, dValue) Then + m_IsModifiedReturnPos = False + End If + End If + If m_IsModifiedOverLap Then + StringToLen(m_OverLap, dValue) + If EgtSetMachiningParam(MCH_MP.OVERL, dValue) Then + m_IsModifiedOverLap = False + End If + End If + If m_IsModifiedTabLen Then + StringToLen(m_TabLen, dValue) + If EgtSetMachiningParam(MCH_MP.TABLEN, dValue) Then + m_IsModifiedTabLen = False + End If + End If + If m_IsModifiedTabDist Then + StringToLen(m_TabDist, dValue) + If EgtSetMachiningParam(MCH_MP.TABDIST, dValue) Then + m_IsModifiedTabDist = False + End If + End If + If m_IsModifiedTabHeight Then + StringToLen(m_TabHeight, dValue) + If EgtSetMachiningParam(MCH_MP.TABHEIGHT, dValue) Then + m_IsModifiedTabHeight = False + End If + End If + If m_IsModifiedTabAngle Then + StringToLen(m_TabAngle, dValue) + If EgtSetMachiningParam(MCH_MP.TABANGLE, dValue) Then + m_IsModifiedTabAngle = False + End If + End If + If m_IsModifiedLiTang Then + StringToLen(m_LiTang, dValue) + If EgtSetMachiningParam(MCH_MP.LITANG, dValue) Then + m_IsModifiedLiTang = False + End If + End If + If m_IsModifiedLiPerp Then + StringToLen(m_LiPerp, dValue) + If EgtSetMachiningParam(MCH_MP.LIPERP, dValue) Then + m_IsModifiedLiPerp = False + End If + End If + If m_IsModifiedLiElev Then + StringToLen(m_LiElev, dValue) + If EgtSetMachiningParam(MCH_MP.LIELEV, dValue) Then + m_IsModifiedLiElev = False + End If + End If + If m_IsModifiedLiCompLen Then + StringToLen(m_LiCompLen, dValue) + If EgtSetMachiningParam(MCH_MP.LICOMPLEN, dValue) Then + m_IsModifiedLiCompLen = False + End If + End If + If m_IsModifiedLoTang Then + StringToLen(m_LoTang, dValue) + If EgtSetMachiningParam(MCH_MP.LOTANG, dValue) Then + m_IsModifiedLoTang = False + End If + End If + If m_IsModifiedLoPerp Then + StringToLen(m_LoPerp, dValue) + If EgtSetMachiningParam(MCH_MP.LOPERP, dValue) Then + m_IsModifiedLoPerp = False + End If + End If + If m_IsModifiedLoElev Then + StringToLen(m_LoElev, dValue) + If EgtSetMachiningParam(MCH_MP.LOELEV, dValue) Then + m_IsModifiedLoElev = False + End If + End If + If m_IsModifiedLoCompLen Then + StringToLen(m_LoCompLen, dValue) + If EgtSetMachiningParam(MCH_MP.LOCOMPLEN, dValue) Then + m_IsModifiedLoCompLen = False + End If + End If + If m_IsModifiedStartAddLen Then + StringToLen(m_StartAddLen, dValue) + If EgtSetMachiningParam(MCH_MP.STARTADDLEN, dValue) Then + m_IsModifiedStartAddLen = False + End If + End If + If m_IsModifiedEndAddLen Then + StringToLen(m_EndAddLen, dValue) + If EgtSetMachiningParam(MCH_MP.ENDADDLEN, dValue) Then + m_IsModifiedEndAddLen = False + End If + End If + If m_IsModifiedStepExtArc Then + StringToLen(m_StepExtArc, dValue) + If EgtSetMachiningParam(MCH_MP.STEPEXTARC, dValue) Then + m_IsModifiedEndAddLen = False + End If + End If + If m_IsModifiedStepIntArc Then + StringToLen(m_StepIntArc, dValue) + If EgtSetMachiningParam(MCH_MP.STEPINTARC, dValue) Then + m_IsModifiedStepIntArc = False + End If + End If + If m_IsModifiedSideStep Then + StringToLen(m_SideStep, dValue) + If EgtSetMachiningParam(MCH_MP.SIDESTEP, dValue) Then + m_IsModifiedSideStep = False + End If + End If + If m_IsModifiedVertFeed Then + StringToLen(m_VertFeed, dValue) + If EgtSetMachiningParam(MCH_MP.VERTFEED, dValue) Then + m_IsModifiedVertFeed = False + End If + End If + If m_IsModifiedDepthStr Then + If EgtSetMachiningParam(MCH_MP.DEPTH_STR, m_DepthStr) Then + m_IsModifiedDepthStr = False + End If + End If + If m_IsModifiedUserNotes Then + If EgtSetMachiningParam(MCH_MP.USERNOTES, m_UserNotes) Then + m_IsModifiedUserNotes = False + End If + End If + If m_IsModifiedInitAngs Then + If EgtSetMachiningParam(MCH_MP.INITANGS, m_InitAngs) Then + m_IsModifiedInitAngs = False + End If + End If + If m_IsModifiedBlockedAxis Then + If EgtSetMachiningParam(MCH_MP.BLOCKEDAXIS, m_BlockedAxis) Then + m_IsModifiedBlockedAxis = False + End If + End If + End Sub + +#End Region ' Commands + + ' Definizione comando + Private m_cmdNextStepTool As ICommand + Private m_cmdPrevStepTool As ICommand + Private m_cmdUpdateMachining As ICommand + +#Region "CONSTRUCTOR" + + Sub New(ByRef m_UpdateParamValues As Action) + m_UpdateParamValues = AddressOf ReadMachiningParam + End Sub + +#End Region ' Constructor + +#Region "COMMANDS" + +#Region "NextStepToolCommand" + + ''' + ''' Restituisce funzione per ricalcolo lavorazione. + ''' + Public ReadOnly Property NextStepToolCommand As ICommand + Get + If m_cmdNextStepTool Is Nothing Then + m_cmdNextStepTool = New RelayCommand(AddressOf NextStepTool) + End If + Return m_cmdNextStepTool + End Get + End Property + + ''' + ''' Ricalcola una lavorazione. + ''' + Public Sub NextStepTool(ByVal param As Object) + If m_bPreviewTool Then + Dim nNextId = EgtPreviewMachiningTool(m_nPtEntId, MCH_PTM.AFTER) + If nNextId <> GDB_ID.NULL Then m_nPtEntId = nNextId + EgtDraw() + End If + End Sub + +#End Region ' NextStepToolCommand + +#Region "PrevStepToolCommand" + + ''' + ''' Restituisce funzione per ricalcolo lavorazione. + ''' + Public ReadOnly Property PrevStepToolCommand As ICommand + Get + If m_cmdPrevStepTool Is Nothing Then + m_cmdPrevStepTool = New RelayCommand(AddressOf PrevStepTool) + End If + Return m_cmdPrevStepTool + End Get + End Property + + ''' + ''' Ricalcola una lavorazione. + ''' + Public Sub PrevStepTool(ByVal param As Object) + If m_bPreviewTool Then + Dim nPrevId = EgtPreviewMachiningTool(m_nPtEntId, MCH_PTM.BEFORE) + If nPrevId <> GDB_ID.NULL Then m_nPtEntId = nPrevId + EgtDraw() + End If + End Sub + +#End Region ' PrevStepToolCommand + +#Region "UpdateMachiningCommand" + + ''' + ''' Restituisce funzione per ricalcolo lavorazione. + ''' + Public ReadOnly Property UpdateMachiningCommand As ICommand + Get + If m_cmdUpdateMachining Is Nothing Then + m_cmdUpdateMachining = New RelayCommand(AddressOf UpdateMachining) + End If + Return m_cmdUpdateMachining + End Get + End Property + + ''' + ''' Ricalcola una lavorazione. + ''' + Public Sub UpdateMachining(ByVal param As Object) + ' La modifica di alcuni parametri forza il ricalcolo della geometria + Dim ModifiedGeometry As Boolean = m_IsModifiedSelectedFaceUseType + ' aggiorno valori modificati + WriteMachiningParam() + ' Carico tutta la geometria selezionata in una lista + Dim SelectedGeometry As New List(Of Integer) + Dim EntityIndex As Integer = EgtGetFirstSelectedObj() + While EntityIndex <> GDB_ID.NULL + SelectedGeometry.Add(EntityIndex) + EntityIndex = EgtGetNextSelectedObj() + End While + ' Gestione speciale provvisoria per una sola superficie con identificazione faccia + If SelectedGeometry.Count = 1 AndAlso EgtGetType(SelectedGeometry(0)) = GDB_TY.SRF_MESH Then + ' Verifico se la superficie è cambiata + Dim SubEntityIndex As Integer = 0 + If Not (EgtGetMachiningGeometry(0, EntityIndex, SubEntityIndex) And + EntityIndex = SelectedGeometry(0) And + SubEntityIndex = IniFile.m_LastSubEntityId And + Not EgtGetMachiningGeometry(1, EntityIndex, SubEntityIndex)) Then + Dim nF As Integer = EgtSurfTmFacetFromTria(SelectedGeometry(0), IniFile.m_LastSubEntityId) + If nF < 0 Then nF = 0 + Dim SubEntityArray As Integer() = {nF} + ModifiedGeometry = True + EgtSetMachiningGeometry(SelectedGeometry.ToArray, SubEntityArray) + End If + ' Gestione standard per curve + Else + ' Verifico se la geometria è cambiata, confrontando selezione attuale con geometria di lavorazione + Dim CountIndex As Integer = 0 + EntityIndex = 0 + Dim SubEntityIndex As Integer = 0 ' Sottocomponente, per ora non usato ma necessario + While EgtGetMachiningGeometry(CountIndex, EntityIndex, SubEntityIndex) + If CountIndex < SelectedGeometry.Count() Then + If SelectedGeometry(CountIndex) <> EntityIndex Then + ModifiedGeometry = True + Exit While + End If + Else + ModifiedGeometry = True + Exit While + End If + CountIndex += 1 + End While + If SelectedGeometry.Count <> CountIndex Then + ModifiedGeometry = True + End If + ' Imposto geometria selezionata come geometria di lavorazione + If ModifiedGeometry Then EgtSetMachiningGeometry(SelectedGeometry.ToArray) + End If + ' Ricalcolo la lavorazione + If Not EgtApplyMachining(ModifiedGeometry) Then + If EgtGetLastMachMgrErrorId() <> 0 Then + Dim sErr As String = EgtGetLastMachMgrErrorString() + Dim sInfo As String = String.Empty + EgtGetOutstrokeInfo(sInfo) + If Not String.IsNullOrEmpty(sInfo) Then sErr &= " " & sInfo + 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 + End If + ' Restart visualizzazione utensile + If m_bPreviewTool Then + m_nPtEntId = EgtPreviewMachiningTool(GDB_ID.NULL, MCH_PTM.AFTER) + End If + NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") + EgtDraw() + Application.Msn.NotifyColleagues(Application.EMITTITLE) + End Sub + +#End Region ' UpdateMachiningCommand + +#End Region ' Commands + + Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged + + Public Sub NotifyPropertyChanged(propName As String) + RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) + End Sub + +End Class + +''' +''' Class that represent a Converter that use machining type and param type, to set the visibility state of the param type. +''' +Public Class OperationParamVisibilityConverter + Implements IValueConverter + + Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert + Select Case CInt(value) + Case MCH_OY.NONE + Return Visibility.Hidden + Case MCH_OY.DISP + Return TMDbParamVisibility.OperationDisposition(CInt(parameter)) + Case MCH_OY.DRILLING + Return TMDbParamVisibility.Drilling(CInt(parameter)) + Case MCH_OY.SAWING + Return TMDbParamVisibility.Sawing(CInt(parameter)) + Case MCH_OY.MILLING + Return TMDbParamVisibility.Milling(CInt(parameter)) + Case MCH_OY.POCKETING + Return TMDbParamVisibility.Pocketing(CInt(parameter)) + Case MCH_OY.MORTISING + Return TMDbParamVisibility.Mortising(CInt(parameter)) + Case MCH_OY.SAWROUGHING + Return TMDbParamVisibility.Sawroughing(CInt(parameter)) + Case MCH_OY.SAWFINISHING + Return TMDbParamVisibility.Sawfinishing(CInt(parameter)) + Case MCH_OY.GENMACHINING + Return TMDbParamVisibility.GenMachining(CInt(parameter)) + Case MCH_OY.CHISELING + Return TMDbParamVisibility.Chiseling(CInt(parameter)) + Case Else + Return Visibility.Hidden + End Select + End Function + + Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack + Throw New NotImplementedException + End Function + +End Class + +''' +''' Class that represent a Converter that convert mm in inch if necessary for the param depth. +''' +Public Class DepthUnitConverter + Implements IValueConverter + + Friend Const INCHTOMM As String = "*25.4" + Friend Const INCHSYMBOL As String = """" + + + Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert + If Not IsNothing(value) Then + value = CStr(value).Replace(INCHTOMM, INCHSYMBOL) + End If + Return value + End Function + + Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack + If Not IsNothing(value) Then + value = CStr(value).Replace(INCHSYMBOL, INCHTOMM) + End If + Return value + End Function + +End Class \ No newline at end of file diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderViewModel.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderViewModel.vb deleted file mode 100644 index 2927182..0000000 --- a/OptionPanel/MachiningOptionPanel/OperationExpander/MachiningParameterExpander/MachiningParameterExpanderViewModel.vb +++ /dev/null @@ -1,2572 +0,0 @@ -Imports System.ComponentModel -Imports System.Collections.ObjectModel -Imports EgtUILib - -Namespace EgtCAM5 - - Public Class MachiningParameterExpanderViewModel - Implements INotifyPropertyChanged - - Private m_bUpdating As Boolean = True - - Private m_Tool As String - Public ReadOnly Property Tool As String - Get - Return m_Tool - End Get - End Property - - Private m_IsModifiedInvert As Boolean = False - Private m_Invert As Boolean - ''' - ''' Property that read and write to the Machining's database the Invert - ''' - Public Property Invert As Boolean - Get - Return m_Invert - End Get - Set(value As Boolean) - If value <> m_Invert Then - m_Invert = value - Dim OrigInvert As Boolean = False - EgtGetMachiningParam(MCH_MP.INVERT, OrigInvert) - m_IsModifiedInvert = If(value <> OrigInvert, True, False) - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedLeaveTab As Boolean = False - Private m_LeaveTab As Boolean - ''' - ''' Property that read and write to the Machining's database the Leave Tab - ''' - Public Property LeaveTab As Boolean - Get - Return m_LeaveTab - End Get - Set(value As Boolean) - If value <> m_LeaveTab Then - m_LeaveTab = value - Dim OrigLeaveTab As Boolean = False - EgtGetMachiningParam(MCH_MP.LEAVETAB, OrigLeaveTab) - m_IsModifiedLeaveTab = If(value <> OrigLeaveTab, True, False) - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedToolInvert As Boolean = False - Private m_ToolInvert As Boolean = False - ''' - ''' Property that read and write to the Machining's database the Invert - ''' - Public Property ToolInvert As Boolean - Get - Return m_ToolInvert - End Get - Set(value As Boolean) - If value <> m_ToolInvert Then - m_ToolInvert = value - Dim OrigToolInvert As Boolean = False - EgtGetMachiningParam(MCH_MP.TOOLINVERT, OrigToolInvert) - m_IsModifiedToolInvert = If(value <> OrigToolInvert, True, False) - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_Type As Integer - ''' - ''' Property that read from the Machining's database the Type - ''' - Public ReadOnly Property Type As Integer - Get - Return m_Type - End Get - End Property - - 'ObservableCollection che contiene le variabili per il combobox WorkSide - Private m_WorkSideList As ObservableCollection(Of IdNameStruct) - Public ReadOnly Property WorkSideList As ObservableCollection(Of IdNameStruct) - Get - Select Case m_Type - Case MCH_MY.MORTISING - m_WorkSideList = New ObservableCollection(Of IdNameStruct)( - {New IdNameStruct(MCH_MORTISE_WS.LEFT, EgtMsg(MSG_MACHININGSDBPAGE + 121)), - New IdNameStruct(MCH_MORTISE_WS.RIGHT, EgtMsg(MSG_MACHININGSDBPAGE + 122))}) - Case MCH_MY.CHISELING - m_WorkSideList = New ObservableCollection(Of IdNameStruct)( - {New IdNameStruct(MCH_CHISEL_WS.LEFT, EgtMsg(MSG_MACHININGSDBPAGE + 121)), - New IdNameStruct(MCH_CHISEL_WS.RIGHT, EgtMsg(MSG_MACHININGSDBPAGE + 122))}) - Case Else - m_WorkSideList = New ObservableCollection(Of IdNameStruct)( - {New IdNameStruct(MCH_SAW_WS.CENTER, EgtMsg(MSG_MACHININGSDBPAGE + 120)), - New IdNameStruct(MCH_SAW_WS.LEFT, EgtMsg(MSG_MACHININGSDBPAGE + 121)), - New IdNameStruct(MCH_SAW_WS.RIGHT, EgtMsg(MSG_MACHININGSDBPAGE + 122))}) - End Select - Return m_WorkSideList - End Get - End Property - - Private m_IsModifiedSelectedWorkSide As Boolean = False - Private m_SelectedWorkSide As Integer - ' Proprietà che indica il WorkSide (MCH_SAW_WS) - Public Property SelectedWorkSide As Integer - Get - If IsNothing(WorkSideList) Then Return Nothing - Return m_SelectedWorkSide - End Get - Set(value As Integer) - If value <> m_SelectedWorkSide Then - If Not IsNothing(WorkSideList) Then - m_SelectedWorkSide = value - Dim OrigWorkSide As Integer = 0 - EgtGetMachiningParam(MCH_MP.WORKSIDE, OrigWorkSide) - OrigWorkSide = IdNameStruct.IndFromId(OrigWorkSide, WorkSideList) - m_IsModifiedSelectedWorkSide = (value <> OrigWorkSide) - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End If - End Set - End Property - - 'ObservableCollection che contiene le variabili per il combobox HeadSide - Private m_HeadSideList As New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAW_HS.LEFT, EgtMsg(MSG_MACHININGSDBPAGE + 121)), - New IdNameStruct(MCH_SAW_HS.RIGHT, EgtMsg(MSG_MACHININGSDBPAGE + 122))}) - Public ReadOnly Property HeadSideList As ObservableCollection(Of IdNameStruct) - Get - Return m_HeadSideList - End Get - End Property - - Private m_IsModifiedSelectedHeadSide As Boolean = False - Private m_SelectedHeadSide As Integer - ' Proprietà che indica il HeadSide (MCH_SAW_HS) - Public Property SelectedHeadSide As Integer - Get - If IsNothing(HeadSideList) Then Return Nothing - Return m_SelectedHeadSide - End Get - Set(value As Integer) - If value <> m_SelectedHeadSide Then - If Not IsNothing(HeadSideList) Then - m_SelectedHeadSide = value - Dim OrigHeadSide As Integer = 0 - EgtGetMachiningParam(MCH_MP.HEADSIDE, OrigHeadSide) - OrigHeadSide = IdNameStruct.IndFromId(OrigHeadSide, HeadSideList) - m_IsModifiedSelectedHeadSide = If(value <> OrigHeadSide, True, False) - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End If - End Set - End Property - - 'ObservableCollection che contiene le variabili per il combobox LeadInType - Private m_LeadInTypeList As ObservableCollection(Of IdNameStruct) - Public ReadOnly Property LeadInTypeList As ObservableCollection(Of IdNameStruct) - Get - Select Case m_Type - Case MCH_MY.SAWING - m_LeadInTypeList = New ObservableCollection(Of IdNameStruct)( - {New IdNameStruct(MCH_SAW_LI.CENT, EgtMsg(MSG_MACHININGSDBPAGE + 120)), - New IdNameStruct(MCH_SAW_LI.STRICT, EgtMsg(MSG_MACHININGSDBPAGE + 125)), - New IdNameStruct(MCH_SAW_LI.OUT, EgtMsg(MSG_MACHININGSDBPAGE + 126)), - New IdNameStruct(MCH_SAW_LI.EXT_CENT, EgtMsg(MSG_MACHININGSDBPAGE + 127)), - New IdNameStruct(MCH_SAW_LI.EXT_OUT, EgtMsg(MSG_MACHININGSDBPAGE + 128))}) - Case MCH_MY.MILLING - m_LeadInTypeList = New ObservableCollection(Of IdNameStruct)( - {New IdNameStruct(MCH_MIL_LI.NONE, EgtMsg(MSG_MACHININGSDBPAGE + 129)), - New IdNameStruct(MCH_MIL_LI.LINEAR, EgtMsg(MSG_MACHININGSDBPAGE + 130)), - New IdNameStruct(MCH_MIL_LI.TANGENT, EgtMsg(MSG_MACHININGSDBPAGE + 131)), - New IdNameStruct(MCH_MIL_LI.GLIDE, EgtMsg(MSG_MACHININGSDBPAGE + 132)), - New IdNameStruct(MCH_MIL_LI.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), - New IdNameStruct(MCH_MIL_LI.HELIX, EgtMsg(MSG_MACHININGSDBPAGE + 133))}) - Case MCH_MY.POCKETING - m_LeadInTypeList = New ObservableCollection(Of IdNameStruct)( - {New IdNameStruct(MCH_POCK_LI.NONE, EgtMsg(MSG_MACHININGSDBPAGE + 129)), - New IdNameStruct(MCH_POCK_LI.GLIDE, EgtMsg(MSG_MACHININGSDBPAGE + 132)), - New IdNameStruct(MCH_POCK_LI.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), - New IdNameStruct(MCH_POCK_LI.HELIX, EgtMsg(MSG_MACHININGSDBPAGE + 133))}) - Case Else - m_LeadInTypeList = Nothing - End Select - Return m_LeadInTypeList - End Get - End Property - - Private m_IsModifiedSelectedLeadInType As Boolean = False - Private m_SelectedLeadInType As Integer - ' Proprietà che indica il LeadInType - Public Property SelectedLeadInType As Integer - Get - If IsNothing(LeadInTypeList) Then Return Nothing - Return IdNameStruct.IdFromInd(m_SelectedLeadInType, LeadInTypeList) - End Get - Set(value As Integer) - If value <> m_SelectedLeadInType Then - If Not IsNothing(LeadInTypeList) Then - m_SelectedLeadInType = IdNameStruct.IndFromId(value, LeadInTypeList) - Dim OrigLeadInType As Integer = 0 - EgtGetMachiningParam(MCH_MP.LEADINTYPE, OrigLeadInType) - m_IsModifiedSelectedLeadInType = If(value <> OrigLeadInType, True, False) - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End If - End Set - End Property - - 'ObservableCollection che contiene le variabili per il combobox ExtLinkType - Private m_ExtLinkTypeList As New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAW_EL.CENT, EgtMsg(MSG_MACHININGSDBPAGE + 120)), New IdNameStruct(MCH_SAW_EL.EXT_PREV, EgtMsg(MSG_MACHININGSDBPAGE + 134)), New IdNameStruct(MCH_SAW_EL.EXT_NEXT, EgtMsg(MSG_MACHININGSDBPAGE + 135)), New IdNameStruct(MCH_SAW_EL.EXT_BOTH, EgtMsg(MSG_MACHININGSDBPAGE + 136))}) - Public ReadOnly Property ExtLinkTypeList As ObservableCollection(Of IdNameStruct) - Get - Return m_ExtLinkTypeList - End Get - End Property - - Private m_IsModifiedSelectedExtLinkType As Boolean = False - Private m_SelectedExtLinkType As Integer - ' Proprietà che indica il ExtLinkType (MCH_SAW_EL) - Public Property SelectedExtLinkType As Integer - Get - If IsNothing(ExtLinkTypeList) Then Return Nothing - Return IdNameStruct.IdFromInd(m_SelectedExtLinkType, ExtLinkTypeList) - End Get - Set(value As Integer) - If value <> m_SelectedExtLinkType Then - If Not IsNothing(ExtLinkTypeList) Then - m_SelectedExtLinkType = IdNameStruct.IndFromId(value, ExtLinkTypeList) - Dim OrigExtLinkType As Integer = 0 - EgtGetMachiningParam(MCH_MP.EXTLINKTYPE, OrigExtLinkType) - m_IsModifiedSelectedExtLinkType = If(value <> OrigExtLinkType, True, False) - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End If - End Set - End Property - - 'ObservableCollection che contiene le variabili per il combobox LeadOutType - Private m_LeadOutTypeList As ObservableCollection(Of IdNameStruct) - Public ReadOnly Property LeadOutTypeList As ObservableCollection(Of IdNameStruct) - Get - Select Case m_Type - Case MCH_MY.SAWING - m_LeadOutTypeList = New ObservableCollection(Of IdNameStruct)( - {New IdNameStruct(MCH_SAW_LO.CENT, EgtMsg(MSG_MACHININGSDBPAGE + 120)), - New IdNameStruct(MCH_SAW_LO.STRICT, EgtMsg(MSG_MACHININGSDBPAGE + 125)), - New IdNameStruct(MCH_SAW_LO.EXT_CENT, EgtMsg(MSG_MACHININGSDBPAGE + 127)), - New IdNameStruct(MCH_SAW_LO.OUT, EgtMsg(MSG_MACHININGSDBPAGE + 126)), - New IdNameStruct(MCH_SAW_LO.EXT_OUT, EgtMsg(MSG_MACHININGSDBPAGE + 128))}) - Case MCH_MY.MILLING - m_LeadOutTypeList = New ObservableCollection(Of IdNameStruct)( - {New IdNameStruct(MCH_MIL_LO.NONE, EgtMsg(MSG_MACHININGSDBPAGE + 129)), - New IdNameStruct(MCH_MIL_LO.LINEAR, EgtMsg(MSG_MACHININGSDBPAGE + 130)), - New IdNameStruct(MCH_MIL_LO.TANGENT, EgtMsg(MSG_MACHININGSDBPAGE + 131)), - New IdNameStruct(MCH_MIL_LO.GLIDE, EgtMsg(MSG_MACHININGSDBPAGE + 132)), - New IdNameStruct(MCH_MIL_LO.AS_LI, EgtMsg(MSG_MACHININGSDBPAGE + 137))}) - Case MCH_MY.POCKETING - m_LeadOutTypeList = New ObservableCollection(Of IdNameStruct)( - {New IdNameStruct(MCH_POCK_LO.NONE, EgtMsg(MSG_MACHININGSDBPAGE + 129)), - New IdNameStruct(MCH_POCK_LO.GLIDE, EgtMsg(MSG_MACHININGSDBPAGE + 132))}) - Case Else - m_LeadOutTypeList = Nothing - End Select - Return m_LeadOutTypeList - End Get - End Property - - Private m_IsModifiedSelectedLeadOutType As Boolean = False - Private m_SelectedLeadOutType As Integer - ' Proprietà che indica il LeadOutType - Public Property SelectedLeadOutType As Integer - Get - If IsNothing(LeadOutTypeList) Then Return Nothing - Return IdNameStruct.IdFromInd(m_SelectedLeadOutType, LeadOutTypeList) - End Get - Set(value As Integer) - If value <> m_SelectedLeadOutType Then - If Not IsNothing(LeadOutTypeList) Then - m_SelectedLeadOutType = IdNameStruct.IndFromId(value, LeadOutTypeList) - Dim OrigLeadOutType As Integer = 0 - EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, OrigLeadOutType) - m_IsModifiedSelectedLeadOutType = If(value <> OrigLeadOutType, True, False) - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End If - End Set - End Property - - 'ObservableCollection che contiene le variabili per il combobox CurveUse - Private m_CurveUseList As ObservableCollection(Of IdNameStruct) - Public ReadOnly Property CurveUseList As ObservableCollection(Of IdNameStruct) - Get - If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_SAWINGONARCS, 0, IniFile.m_sCurrMachIniFilePath) <> 0 Then - m_CurveUseList = New ObservableCollection(Of IdNameStruct)( - {New IdNameStruct(MCH_SAW_CU.SKIP, EgtMsg(MSG_MACHININGSDBPAGE + 138)), - New IdNameStruct(MCH_SAW_CU.APPROX, EgtMsg(MSG_MACHININGSDBPAGE + 139)), - New IdNameStruct(MCH_SAW_CU.CONVEX, EgtMsg(MSG_MACHININGSDBPAGE + 140)), - New IdNameStruct(MCH_SAW_CU.KEEP, EgtMsg(MSG_MACHININGSDBPAGE + 141))}) - Else - m_CurveUseList = New ObservableCollection(Of IdNameStruct)( - {New IdNameStruct(MCH_SAW_CU.SKIP, EgtMsg(MSG_MACHININGSDBPAGE + 138)), - New IdNameStruct(MCH_SAW_CU.APPROX, EgtMsg(MSG_MACHININGSDBPAGE + 139)), - New IdNameStruct(MCH_SAW_CU.CONVEX, EgtMsg(MSG_MACHININGSDBPAGE + 140))}) - End If - Return m_CurveUseList - End Get - End Property - - Private m_IsModifiedSelectedCurveUse As Boolean = False - Private m_SelectedCurveUse As Integer - ' Proprietà che indica il CurveUse (MCH_SAW_CU) - Public Property SelectedCurveUse As Integer - Get - If IsNothing(CurveUseList) Then Return Nothing - Return IdNameStruct.IdFromInd(m_SelectedCurveUse, CurveUseList) - End Get - Set(value As Integer) - If value <> m_SelectedCurveUse Then - If Not IsNothing(CurveUseList) Then - m_SelectedCurveUse = IdNameStruct.IndFromId(value, CurveUseList) - Dim OrigCurveUse As Integer = 0 - EgtGetMachiningParam(MCH_MP.CURVEUSE, OrigCurveUse) - m_IsModifiedSelectedCurveUse = If(value <> OrigCurveUse, True, False) - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End If - End Set - End Property - - 'ObservableCollection che contiene le variabili per il combobox StepType - Private m_StepTypeList As ObservableCollection(Of IdNameStruct) - Public ReadOnly Property StepTypeList As ObservableCollection(Of IdNameStruct) - Get - Select Case m_Type - Case MCH_MY.SAWING - m_StepTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAW_ST.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), - New IdNameStruct(MCH_SAW_ST.ONEWAY, EgtMsg(MSG_MACHININGSDBPAGE + 143)), - New IdNameStruct(MCH_SAW_ST.TOANDFROM, EgtMsg(MSG_MACHININGSDBPAGE + 145))}) - Case MCH_MY.MILLING - m_StepTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_MIL_ST.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), - New IdNameStruct(MCH_MIL_ST.ONEWAY, EgtMsg(MSG_MACHININGSDBPAGE + 143)), - New IdNameStruct(MCH_MIL_ST.SPIRAL, EgtMsg(MSG_MACHININGSDBPAGE + 144))}) - Case MCH_MY.MORTISING - m_StepTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_MORTISE_ST.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), - New IdNameStruct(MCH_MORTISE_ST.ONEWAY, EgtMsg(MSG_MACHININGSDBPAGE + 143))}) - Case MCH_MY.SAWROUGHING, MCH_MY.SAWFINISHING - m_StepTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAWROU_ST.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), - New IdNameStruct(MCH_SAWROU_ST.ONEWAY, EgtMsg(MSG_MACHININGSDBPAGE + 143))}) - Case Else - m_StepTypeList = Nothing - End Select - Return m_StepTypeList - End Get - End Property - - Private m_IsModifiedSelectedStepType As Boolean = False - Private m_SelectedStepType As Integer - ' Proprietà che indica lo StepType - Public Property SelectedStepType As Integer - Get - If IsNothing(StepTypeList) Then Return Nothing - Return IdNameStruct.IdFromInd(m_SelectedStepType, StepTypeList) - End Get - Set(value As Integer) - If value <> m_SelectedStepType Then - If Not IsNothing(StepTypeList) Then - m_SelectedStepType = value - Dim OrigStepType As Integer = 0 - EgtGetMachiningParam(MCH_MP.STEPTYPE, OrigStepType) - OrigStepType = IdNameStruct.IndFromId(OrigStepType, StepTypeList) - m_IsModifiedSelectedStepType = (value <> OrigStepType) - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End If - End Set - End Property - - 'ObservableCollection che contiene le variabili per il combobox SubType - Private m_SubTypeList As ObservableCollection(Of IdNameStruct) - Public ReadOnly Property SubTypeList As ObservableCollection(Of IdNameStruct) - Get - Select Case m_Type - Case MCH_MY.POCKETING - m_SubTypeList = New ObservableCollection(Of IdNameStruct)( - {New IdNameStruct(MCH_POCK_SUB.ZIGZAG, EgtMsg(MSG_MACHININGSDBPAGE + 142)), - New IdNameStruct(MCH_POCK_SUB.ONEWAY, EgtMsg(MSG_MACHININGSDBPAGE + 143)), - New IdNameStruct(MCH_POCK_SUB.SPIRALIN, EgtMsg(MSG_MACHININGSDBPAGE + 148)), - New IdNameStruct(MCH_POCK_SUB.SPIRALOUT, EgtMsg(MSG_MACHININGSDBPAGE + 149))}) - Case MCH_MY.SAWFINISHING - m_SubTypeList = New ObservableCollection(Of IdNameStruct)( - {New IdNameStruct(MCH_SAWFIN_SUB.ALONG, EgtMsg(MSG_MACHININGSDBPAGE + 146)), - New IdNameStruct(MCH_SAWFIN_SUB.ACROSS, EgtMsg(MSG_MACHININGSDBPAGE + 147))}) - Case MCH_MY.GENMACHINING - Dim Index = 1 - Dim sGenScript As String = String.Empty - m_SubTypeList = New ObservableCollection(Of IdNameStruct) - While EgtUILib.GetPrivateProfileString(S_GENMACHINING, K_GENSCRIPT & Index, "", sGenScript, IniFile.m_sCurrMachIniFilePath) > 0 - m_SubTypeList.Add(New IdNameStruct(Index, sGenScript)) - Index += 1 - End While - If m_SubTypeList.Count = 0 Then - m_SubTypeList.Add(New IdNameStruct(0, "")) - End If - Case Else - m_SubTypeList = Nothing - End Select - Return m_SubTypeList - End Get - End Property - - Private m_IsModifiedSelectedSubType As Boolean = False - Private m_SelectedSubType As Integer - ' Proprietà che indica il SubType - Public Property SelectedSubType As Integer - Get - If IsNothing(SubTypeList) Then Return Nothing - Return m_SelectedSubType - End Get - Set(value As Integer) - If value <> m_SelectedSubType Then - If Not IsNothing(SubTypeList) Then - m_SelectedSubType = value - Dim OrigSubType As Integer = 0 - EgtGetMachiningParam(MCH_MP.SUBTYPE, OrigSubType) - OrigSubType = IdNameStruct.IndFromId(OrigSubType, SubTypeList) - m_IsModifiedSelectedSubType = If(value <> OrigSubType, True, False) - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End If - End Set - End Property - - 'ObservableCollection che contiene le variabili per il combobox LeadLinkType - Private m_LeadLinkTypeList As ObservableCollection(Of IdNameStruct) - Public ReadOnly Property LeadLinkTypeList As ObservableCollection(Of IdNameStruct) - Get - Select Case m_Type - Case MCH_MY.SAWROUGHING - m_LeadLinkTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAWROU_LL.CENT, EgtMsg(MSG_MACHININGSDBPAGE + 120)), New IdNameStruct(MCH_SAWROU_LL.EXT, EgtMsg(MSG_MACHININGSDBPAGE + 123))}) - Case MCH_MY.SAWFINISHING - m_LeadLinkTypeList = New ObservableCollection(Of IdNameStruct)({New IdNameStruct(MCH_SAWFIN_LL.STD, EgtMsg(MSG_MACHININGSDBPAGE + 124)), New IdNameStruct(MCH_SAWFIN_LL.CENT, EgtMsg(MSG_MACHININGSDBPAGE + 120)), New IdNameStruct(MCH_SAWFIN_LL.EXT, EgtMsg(MSG_MACHININGSDBPAGE + 123))}) - Case Else - m_LeadLinkTypeList = Nothing - End Select - Return m_LeadLinkTypeList - End Get - End Property - - Private m_IsModifiedSelectedLeadLinkType As Boolean = False - Private m_SelectedLeadLinkType As Integer - ' Proprietà che indica il LeadLinkType - Public Property SelectedLeadLinkType As Integer - Get - If IsNothing(LeadLinkTypeList) Then Return Nothing - Return IdNameStruct.IdFromInd(m_SelectedLeadLinkType, LeadLinkTypeList) - End Get - Set(value As Integer) - If value <> m_SelectedLeadLinkType Then - If Not IsNothing(LeadLinkTypeList) Then - m_SelectedLeadLinkType = IdNameStruct.IndFromId(value, LeadLinkTypeList) - Dim OrigLeadLinkType As Integer = 0 - EgtGetMachiningParam(MCH_MP.LEADLINKTYPE, OrigLeadLinkType) - m_IsModifiedSelectedLeadLinkType = If(value <> OrigLeadLinkType, True, False) - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End If - End Set - End Property - - 'ObservableCollection che contiene le variabili per il combobox FaceUseType - Private m_FaceUseTypeList As ObservableCollection(Of IdNameStruct) - Public ReadOnly Property FaceUseTypeList As ObservableCollection(Of IdNameStruct) - Get - Select Case m_Type - Case MCH_MY.MORTISING - m_FaceUseTypeList = New ObservableCollection(Of IdNameStruct)( - {New IdNameStruct(MCH_MIL_FU.NONE, EgtMsg(MSG_MACHININGSDBPAGE + 153)), - New IdNameStruct(MCH_MIL_FU.PARAL_DOWN, EgtMsg(MSG_MACHININGSDBPAGE + 157) & EgtMsg(MSG_MACHININGSDBPAGE + 154)), - New IdNameStruct(MCH_MIL_FU.PARAL_TOP, EgtMsg(MSG_MACHININGSDBPAGE + 158) & EgtMsg(MSG_MACHININGSDBPAGE + 154)), - New IdNameStruct(MCH_MIL_FU.PARAL_FRONT, EgtMsg(MSG_MACHININGSDBPAGE + 159) & EgtMsg(MSG_MACHININGSDBPAGE + 154)), - New IdNameStruct(MCH_MIL_FU.PARAL_BACK, EgtMsg(MSG_MACHININGSDBPAGE + 160) & EgtMsg(MSG_MACHININGSDBPAGE + 154)), - New IdNameStruct(MCH_MIL_FU.PARAL_LEFT, EgtMsg(MSG_MACHININGSDBPAGE + 161) & EgtMsg(MSG_MACHININGSDBPAGE + 154)), - New IdNameStruct(MCH_MIL_FU.PARAL_RIGHT, EgtMsg(MSG_MACHININGSDBPAGE + 162) & EgtMsg(MSG_MACHININGSDBPAGE + 154))}) - Case Else - m_FaceUseTypeList = New ObservableCollection(Of IdNameStruct)( - {New IdNameStruct(MCH_MIL_FU.NONE, EgtMsg(MSG_MACHININGSDBPAGE + 153)), - New IdNameStruct(MCH_MIL_FU.PARAL_DOWN, EgtMsg(MSG_MACHININGSDBPAGE + 157) & EgtMsg(MSG_MACHININGSDBPAGE + 154)), - New IdNameStruct(MCH_MIL_FU.PARAL_TOP, EgtMsg(MSG_MACHININGSDBPAGE + 158) & EgtMsg(MSG_MACHININGSDBPAGE + 154)), - New IdNameStruct(MCH_MIL_FU.PARAL_FRONT, EgtMsg(MSG_MACHININGSDBPAGE + 159) & EgtMsg(MSG_MACHININGSDBPAGE + 154)), - New IdNameStruct(MCH_MIL_FU.PARAL_BACK, EgtMsg(MSG_MACHININGSDBPAGE + 160) & EgtMsg(MSG_MACHININGSDBPAGE + 154)), - New IdNameStruct(MCH_MIL_FU.PARAL_LEFT, EgtMsg(MSG_MACHININGSDBPAGE + 161) & EgtMsg(MSG_MACHININGSDBPAGE + 154)), - New IdNameStruct(MCH_MIL_FU.PARAL_RIGHT, EgtMsg(MSG_MACHININGSDBPAGE + 162) & EgtMsg(MSG_MACHININGSDBPAGE + 154)), - New IdNameStruct(MCH_MIL_FU.ORTHO_DOWN, EgtMsg(MSG_MACHININGSDBPAGE + 157) & EgtMsg(MSG_MACHININGSDBPAGE + 155)), - New IdNameStruct(MCH_MIL_FU.ORTHO_TOP, EgtMsg(MSG_MACHININGSDBPAGE + 158) & EgtMsg(MSG_MACHININGSDBPAGE + 155)), - New IdNameStruct(MCH_MIL_FU.ORTHO_FRONT, EgtMsg(MSG_MACHININGSDBPAGE + 159) & EgtMsg(MSG_MACHININGSDBPAGE + 155)), - New IdNameStruct(MCH_MIL_FU.ORTHO_BACK, EgtMsg(MSG_MACHININGSDBPAGE + 160) & EgtMsg(MSG_MACHININGSDBPAGE + 155)), - New IdNameStruct(MCH_MIL_FU.ORTHO_LEFT, EgtMsg(MSG_MACHININGSDBPAGE + 161) & EgtMsg(MSG_MACHININGSDBPAGE + 155)), - New IdNameStruct(MCH_MIL_FU.ORTHO_RIGHT, EgtMsg(MSG_MACHININGSDBPAGE + 162) & EgtMsg(MSG_MACHININGSDBPAGE + 155)), - New IdNameStruct(MCH_MIL_FU.ORTHO_CONT, EgtMsg(MSG_MACHININGSDBPAGE + 163) & EgtMsg(MSG_MACHININGSDBPAGE + 155)), - New IdNameStruct(MCH_MIL_FU.ORTUP_DOWN, EgtMsg(MSG_MACHININGSDBPAGE + 157) & EgtMsg(MSG_MACHININGSDBPAGE + 156)), - New IdNameStruct(MCH_MIL_FU.ORTUP_TOP, EgtMsg(MSG_MACHININGSDBPAGE + 158) & EgtMsg(MSG_MACHININGSDBPAGE + 156)), - New IdNameStruct(MCH_MIL_FU.ORTUP_FRONT, EgtMsg(MSG_MACHININGSDBPAGE + 159) & EgtMsg(MSG_MACHININGSDBPAGE + 156)), - New IdNameStruct(MCH_MIL_FU.ORTUP_BACK, EgtMsg(MSG_MACHININGSDBPAGE + 160) & EgtMsg(MSG_MACHININGSDBPAGE + 156)), - New IdNameStruct(MCH_MIL_FU.ORTUP_LEFT, EgtMsg(MSG_MACHININGSDBPAGE + 161) & EgtMsg(MSG_MACHININGSDBPAGE + 156)), - New IdNameStruct(MCH_MIL_FU.ORTUP_RIGHT, EgtMsg(MSG_MACHININGSDBPAGE + 162) & EgtMsg(MSG_MACHININGSDBPAGE + 156)), - New IdNameStruct(MCH_MIL_FU.ORTUP_CONT, EgtMsg(MSG_MACHININGSDBPAGE + 163) & EgtMsg(MSG_MACHININGSDBPAGE + 156))}) - End Select - Return m_FaceUseTypeList - End Get - End Property - - Private m_IsModifiedSelectedFaceUseType As Boolean = False - Private m_SelectedFaceUseType As Integer = 0 - - ' Proprietà che indica il FaceUseType (MCH_MIL_FU) - Public Property SelectedFaceUseType As Integer - Get - If IsNothing(FaceUseTypeList) Then Return Nothing - Return m_SelectedFaceUseType - End Get - Set(value As Integer) - If value <> m_SelectedFaceUseType Then - If Not IsNothing(FaceUseTypeList) Then - m_SelectedFaceUseType = value - Dim OrigFaceUseType As Integer = 0 - EgtGetMachiningParam(MCH_MP.FACEUSE, OrigFaceUseType) - OrigFaceUseType = IdNameStruct.IndFromId(OrigFaceUseType, FaceUseTypeList) - m_IsModifiedSelectedFaceUseType = If(value <> OrigFaceUseType, True, False) - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End If - End Set - End Property - - 'ObservableCollection che contiene le variabili per il combobox SolChoiceType - Private m_SolChoiceTypeList As New ObservableCollection(Of IdNameStruct)( - {New IdNameStruct(MCH_SCC.NONE, EgtMsg(MSG_MACHININGSDBPAGE + 105)), - New IdNameStruct(MCH_SCC.STD, EgtMsg(MSG_MACHININGSDBPAGE + 106)), - New IdNameStruct(MCH_SCC.OPPOSITE, EgtMsg(MSG_MACHININGSDBPAGE + 107)), - New IdNameStruct(MCH_SCC.ADIR_XP, EgtMsg(MSG_MACHININGSDBPAGE + 108)), - New IdNameStruct(MCH_SCC.ADIR_XM, EgtMsg(MSG_MACHININGSDBPAGE + 109)), - New IdNameStruct(MCH_SCC.ADIR_YP, EgtMsg(MSG_MACHININGSDBPAGE + 110)), - New IdNameStruct(MCH_SCC.ADIR_YM, EgtMsg(MSG_MACHININGSDBPAGE + 111)), - New IdNameStruct(MCH_SCC.ADIR_ZP, EgtMsg(MSG_MACHININGSDBPAGE + 112)), - New IdNameStruct(MCH_SCC.ADIR_ZM, EgtMsg(MSG_MACHININGSDBPAGE + 113)), - New IdNameStruct(MCH_SCC.ADIR_NEAR, EgtMsg(MSG_MACHININGSDBPAGE + 114)), - New IdNameStruct(MCH_SCC.ADIR_FAR, EgtMsg(MSG_MACHININGSDBPAGE + 115))}) - Public ReadOnly Property SolChoiceTypeList As ObservableCollection(Of IdNameStruct) - Get - Return m_SolChoiceTypeList - End Get - End Property - - Private m_IsModifiedSelectedSolChoiceType As Boolean = False - Private m_SelectedSolChoiceType As Integer - ' Proprietà che indica il SolChoiceType (MCH_SCC) - Public Property SelectedSolChoiceType As Integer - Get - If IsNothing(SolChoiceTypeList) Then Return Nothing - Return m_SelectedSolChoiceType - End Get - Set(value As Integer) - If value <> m_SelectedSolChoiceType Then - If Not IsNothing(SolChoiceTypeList) Then - m_SelectedSolChoiceType = value - Dim OrigSolChoiceType As Integer = 0 - EgtGetMachiningParam(MCH_MP.SOLCHOICETYPE, OrigSolChoiceType) - OrigSolChoiceType = IdNameStruct.IndFromId(OrigSolChoiceType, SolChoiceTypeList) - m_IsModifiedSelectedSolChoiceType = If(value <> OrigSolChoiceType, True, False) - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End If - End Set - End Property - - Private m_IsModifiedSpeed As Boolean = False - Private m_Speed As String - ''' - ''' Property that read and write to the Machining's database the Speed - ''' - Public Property Speed As String - Get - Return m_Speed - End Get - Set(value As String) - If value <> m_Speed Then - m_Speed = value - Dim OrigSpeed As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.SPEED, OrigSpeed) - StringToDouble(value, dValue) - m_IsModifiedSpeed = Math.Abs(dValue - OrigSpeed) > 10 * EPS_ANG_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedFeed As Boolean = False - Private m_Feed As String - ''' - ''' Property that read and write to the Machining's database the Feed - ''' - Public Property Feed As String - Get - Return m_Feed - End Get - Set(value As String) - If value <> m_Feed Then - m_Feed = value - Dim OrigFeed As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.FEED, OrigFeed) - StringToLen(value, dValue) - m_IsModifiedFeed = Math.Abs(dValue - OrigFeed) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedStartFeed As Boolean = False - Private m_StartFeed As String - ''' - ''' Property that read and write to the Machining's database the Start Feed - ''' - Public Property StartFeed As String - Get - Return m_StartFeed - End Get - Set(value As String) - If value <> m_StartFeed Then - m_StartFeed = value - Dim OrigStartFeed As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.STARTFEED, OrigStartFeed) - StringToLen(value, dValue) - m_IsModifiedStartFeed = Math.Abs(dValue - OrigStartFeed) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedEndFeed As Boolean = False - Private m_EndFeed As String - ''' - ''' Property that read and write to the Machining's database the End Feed - ''' - Public Property EndFeed As String - Get - Return m_EndFeed - End Get - Set(value As String) - If value <> m_EndFeed Then - m_EndFeed = value - Dim OrigEndFeed As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.ENDFEED, OrigEndFeed) - StringToLen(value, dValue) - m_IsModifiedEndFeed = Math.Abs(dValue - OrigEndFeed) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedTipFeed As Boolean = False - Private m_TipFeed As String - ''' - ''' Property that read and write to the Machining's database the Tip Feed - ''' - Public Property TipFeed As String - Get - Return m_TipFeed - End Get - Set(value As String) - If value <> m_TipFeed Then - m_TipFeed = value - Dim OrigTipFeed As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.TIPFEED, OrigTipFeed) - StringToLen(value, dValue) - m_IsModifiedTipFeed = Math.Abs(dValue - OrigTipFeed) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedOffSr As Boolean = False - Private m_OffSr As String - ''' - ''' Property that read and write to the Machining's database the Offset Sr - ''' - Public Property OffSr As String - Get - Return m_OffSr - End Get - Set(value As String) - If value <> m_OffSr Then - m_OffSr = value - Dim OrigOffSr As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.OFFSR, OrigOffSr) - StringToLen(value, dValue) - m_IsModifiedOffSr = Math.Abs(dValue - OrigOffSr) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedOffSl As Boolean = False - Private m_OffSl As String - ''' - ''' Property that read and write to the Machining's database the Offset Sl - ''' - Public Property OffSl As String - Get - Return m_OffSl - End Get - Set(value As String) - If value <> m_OffSl Then - m_OffSl = value - Dim OrigOffSl As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.OFFSL, OrigOffSl) - StringToLen(value, dValue) - m_IsModifiedOffSl = Math.Abs(dValue - OrigOffSl) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedSideAngle As Boolean = False - Private m_SideAngle As String - ''' - ''' Property that read and write to the Machining's database the Side Angle - ''' - Public Property SideAngle As String - Get - Return m_SideAngle - End Get - Set(value As String) - If value <> m_SideAngle Then - m_SideAngle = value - Dim OrigSideAngle As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.SIDEANGLE, OrigSideAngle) - StringToLen(value, dValue) - m_IsModifiedSideAngle = Math.Abs(dValue - OrigSideAngle) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedApprox As Boolean = False - Private m_Approx As String - ''' - ''' Property that read and write to the Machining's database the Approx - ''' - Public Property Approx As String - Get - Return m_Approx - End Get - Set(value As String) - If value <> m_Approx Then - m_Approx = value - Dim OrigApprox As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.APPROX, OrigApprox) - StringToLen(value, dValue) - m_IsModifiedApprox = Math.Abs(dValue - OrigApprox) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedStartPos As Boolean = False - Private m_StartPos As String - ''' - ''' Property that read and write to the Machining's database the Start Position - ''' - Public Property StartPos As String - Get - Return m_StartPos - End Get - Set(value As String) - If value <> m_StartPos Then - m_StartPos = value - Dim OrigStartPos As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.STARTPOS, OrigStartPos) - StringToLen(value, dValue) - m_IsModifiedStartPos = Math.Abs(dValue - OrigStartPos) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedStartSlowLen As Boolean = False - Private m_StartSlowLen As String - ''' - ''' Property that read and write to the Machining's database the Start Slow Len - ''' - Public Property StartSlowLen As String - Get - Return m_StartSlowLen - End Get - Set(value As String) - If value <> m_StartSlowLen Then - m_StartSlowLen = value - Dim OrigStartSlowLen As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.STARTSLOWLEN, OrigStartSlowLen) - StringToLen(value, dValue) - m_IsModifiedStartSlowLen = Math.Abs(dValue - OrigStartSlowLen) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedEndSlowLen As Boolean = False - Private m_EndSlowLen As String - ''' - ''' Property that read and write to the Machining's database the End Slow Len - ''' - Public Property EndSlowLen As String - Get - Return m_EndSlowLen - End Get - Set(value As String) - If value <> m_EndSlowLen Then - m_EndSlowLen = value - Dim OrigEndSlowLen As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.ENDSLOWLEN, OrigEndSlowLen) - StringToLen(value, dValue) - m_IsModifiedEndSlowLen = Math.Abs(dValue - OrigEndSlowLen) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedThrouAddLen As Boolean = False - Private m_ThrouAddLen As String - ''' - ''' Property that read and write to the Machining's database the Throu Add Len - ''' - Public Property ThrouAddLen As String - Get - Return m_ThrouAddLen - End Get - Set(value As String) - If value <> m_ThrouAddLen Then - m_ThrouAddLen = value - Dim OrigThrouAddLen As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.THROUADDLEN, OrigThrouAddLen) - StringToLen(value, dValue) - m_IsModifiedThrouAddLen = Math.Abs(dValue - OrigThrouAddLen) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedStepPar As Boolean = False - Private m_StepPar As String - ''' - ''' Property that read and write to the Machining's database the Step Par - ''' - Public Property StepPar As String - Get - Return m_StepPar - End Get - Set(value As String) - If value <> m_StepPar Then - m_StepPar = value - Dim OrigStepPar As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.STEP_, OrigStepPar) - StringToLen(value, dValue) - m_IsModifiedStepPar = Math.Abs(dValue - OrigStepPar) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedReturnPos As Boolean = False - Private m_ReturnPos As String - ''' - ''' Property that read and write to the Machining's database the Return Position - ''' - Public Property ReturnPos As String - Get - Return m_ReturnPos - End Get - Set(value As String) - If value <> m_ReturnPos Then - m_ReturnPos = value - Dim OrigReturnPos As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.RETURNPOS, OrigReturnPos) - StringToLen(value, dValue) - m_IsModifiedReturnPos = Math.Abs(dValue - OrigReturnPos) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedOverLap As Boolean = False - Private m_OverLap As String - ''' - ''' Property that read and write to the Machining's database the Over Lap Str - ''' - Public Property OverLap As String - Get - Return m_OverLap - End Get - Set(value As String) - If value = String.Empty Or value <> m_OverLap Then - m_OverLap = value - Dim OrigOverLap As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.OVERL, OrigOverLap) - StringToLen(value, dValue) - m_IsModifiedOverLap = Math.Abs(dValue - OrigOverLap) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedTabLen As Boolean = False - Private m_TabLen As String - ''' - ''' Property that read and write to the Machining's database the Tab Len - ''' - Public Property TabLen As String - Get - Return m_TabLen - End Get - Set(value As String) - If value <> m_TabLen Then - m_TabLen = value - Dim OrigTabLen As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.TABLEN, OrigTabLen) - StringToLen(value, dValue) - m_IsModifiedTabLen = Math.Abs(dValue - OrigTabLen) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedTabDist As Boolean = False - Private m_TabDist As String - ''' - ''' Property that read and write to the Machining's database the Tab Dist - ''' - Public Property TabDist As String - Get - Return m_TabDist - End Get - Set(value As String) - If value <> m_TabDist Then - m_TabDist = value - Dim OrigTabDist As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.TABDIST, OrigTabDist) - StringToLen(value, dValue) - m_IsModifiedTabDist = Math.Abs(dValue - OrigTabDist) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedTabHeight As Boolean = False - Private m_TabHeight As String - ''' - ''' Property that read and write to the Machining's database the Tab Height - ''' - Public Property TabHeight As String - Get - Return m_TabHeight - End Get - Set(value As String) - If value <> m_TabHeight Then - m_TabHeight = value - Dim OrigTabHeight As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.TABHEIGHT, OrigTabHeight) - StringToLen(value, dValue) - m_IsModifiedTabHeight = Math.Abs(dValue - OrigTabHeight) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedTabAngle As Boolean = False - Private m_TabAngle As String - ''' - ''' Property that read and write to the Machining's database the Tab Angle - ''' - Public Property TabAngle As String - Get - Return m_TabAngle - End Get - Set(value As String) - If value <> m_TabAngle Then - m_TabAngle = value - Dim OrigTabAngle As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.TABANGLE, OrigTabAngle) - StringToLen(value, dValue) - m_IsModifiedTabAngle = Math.Abs(dValue - OrigTabAngle) > 10 * EPS_ANG_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedLiTang As Boolean = False - Private m_LiTang As String - ''' - ''' Property that read and write to the Machining's database the Li Tang - ''' - Public Property LiTang As String - Get - Return m_LiTang - End Get - Set(value As String) - If value <> m_LiTang Then - m_LiTang = value - Dim OrigLiTang As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.LITANG, OrigLiTang) - StringToLen(value, dValue) - m_IsModifiedLiTang = Math.Abs(dValue - OrigLiTang) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedLiPerp As Boolean = False - Private m_LiPerp As String - ''' - ''' Property that read and write to the Machining's database the Li Perp - ''' - Public Property LiPerp As String - Get - Return m_LiPerp - End Get - Set(value As String) - If value <> m_LiPerp Then - m_LiPerp = value - Dim OrigLiPerp As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.LIPERP, OrigLiPerp) - StringToLen(value, dValue) - m_IsModifiedLiPerp = Math.Abs(dValue - OrigLiPerp) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedLiElev As Boolean = False - Private m_LiElev As String - ''' - ''' Property that read and write to the Machining's database the Li Elev - ''' - Public Property LiElev As String - Get - Return m_LiElev - End Get - Set(value As String) - If value <> m_LiElev Then - m_LiElev = value - Dim OrigLiElev As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.LIELEV, OrigLiElev) - StringToLen(value, dValue) - m_IsModifiedLiElev = Math.Abs(dValue - OrigLiElev) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedLiCompLen As Boolean = False - Private m_LiCompLen As String - ''' - ''' Property that read and write to the Machining's database the Li Comp Len - ''' - Public Property LiCompLen As String - Get - Return m_LiCompLen - End Get - Set(value As String) - If value <> m_LiCompLen Then - m_LiCompLen = value - Dim OrigLiCompLen As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.LICOMPLEN, OrigLiCompLen) - StringToLen(value, dValue) - m_IsModifiedLiCompLen = Math.Abs(dValue - OrigLiCompLen) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedLoTang As Boolean = False - Private m_LoTang As String - ''' - ''' Property that read and write to the Machining's database the Lo Tang - ''' - Public Property LoTang As String - Get - Return m_LoTang - End Get - Set(value As String) - If value <> m_LoTang Then - m_LoTang = value - Dim OrigLoTang As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.LOTANG, OrigLoTang) - StringToLen(value, dValue) - m_IsModifiedLoTang = Math.Abs(dValue - OrigLoTang) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedLoPerp As Boolean = False - Private m_LoPerp As String - ''' - ''' Property that read and write to the Machining's database the Lo Perp - ''' - Public Property LoPerp As String - Get - Return m_LoPerp - End Get - Set(value As String) - If value <> m_LoPerp Then - m_LoPerp = value - Dim OrigLoPerp As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.LOPERP, OrigLoPerp) - StringToLen(value, dValue) - m_IsModifiedLoPerp = Math.Abs(dValue - OrigLoPerp) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedLoElev As Boolean = False - Private m_LoElev As String - ''' - ''' Property that read and write to the Machining's database the Lo Elev - ''' - Public Property LoElev As String - Get - Return m_LoElev - End Get - Set(value As String) - If value <> m_LoElev Then - m_LoElev = value - Dim OrigLoElev As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.LOELEV, OrigLoElev) - StringToLen(value, dValue) - m_IsModifiedLoElev = Math.Abs(dValue - OrigLoElev) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedLoCompLen As Boolean = False - Private m_LoCompLen As String - ''' - ''' Property that read and write to the Machining's database the Lo Comp Len - ''' - Public Property LoCompLen As String - Get - Return m_LoCompLen - End Get - Set(value As String) - If value <> m_LoCompLen Then - m_LoCompLen = value - Dim OrigLoCompLen As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.LOCOMPLEN, OrigLoCompLen) - StringToLen(value, dValue) - m_IsModifiedLoCompLen = Math.Abs(dValue - OrigLoCompLen) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedStartAddLen As Boolean = False - Private m_StartAddLen As String - ''' - ''' Property that read and write to the Machining's database the Start Add Len - ''' - Public Property StartAddLen As String - Get - Return m_StartAddLen - End Get - Set(value As String) - If value <> m_StartAddLen Then - m_StartAddLen = value - Dim OrigStartAddLen As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.STARTADDLEN, OrigStartAddLen) - StringToLen(value, dValue) - m_IsModifiedStartAddLen = Math.Abs(dValue - OrigStartAddLen) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedEndAddLen As Boolean = False - Private m_EndAddLen As String - ''' - ''' Property that read and write to the Machining's database the End Add Len - ''' - Public Property EndAddLen As String - Get - Return m_EndAddLen - End Get - Set(value As String) - If value <> m_EndAddLen Then - m_EndAddLen = value - Dim OrigEndAddLen As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.ENDADDLEN, OrigEndAddLen) - StringToLen(value, dValue) - m_IsModifiedEndAddLen = Math.Abs(dValue - OrigEndAddLen) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedStepExtArc As Boolean = False - Private m_StepExtArc As String - ''' - ''' Property that read and write to the Machining's database the Step Ext Arc - ''' - Public Property StepExtArc As String - Get - Return m_StepExtArc - End Get - Set(value As String) - If value <> m_StepExtArc Then - m_StepExtArc = value - Dim OrigStepExtArc As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.STEPEXTARC, OrigStepExtArc) - StringToLen(value, dValue) - m_IsModifiedStepExtArc = Math.Abs(dValue - OrigStepExtArc) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedStepIntArc As Boolean = False - Private m_StepIntArc As String - ''' - ''' Property that read and write to the Machining's database the Step Int Arc - ''' - Public Property StepIntArc As String - Get - Return m_StepIntArc - End Get - Set(value As String) - If value <> m_StepIntArc Then - m_StepIntArc = value - Dim OrigStepIntArc As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.STEPINTARC, OrigStepIntArc) - StringToLen(value, dValue) - m_IsModifiedStepIntArc = Math.Abs(dValue - OrigStepIntArc) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedSideStep As Boolean = False - Private m_SideStep As String - ''' - ''' Property that read and write to the Machining's database the Side Step - ''' - Public Property SideStep As String - Get - Return m_SideStep - End Get - Set(value As String) - If value <> m_SideStep Then - m_SideStep = value - Dim OrigSideStep As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.SIDESTEP, OrigSideStep) - StringToLen(value, dValue) - m_IsModifiedSideStep = Math.Abs(dValue - OrigSideStep) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedVertFeed As Boolean = False - Private m_VertFeed As String - ''' - ''' Property that read and write to the Machining's database the Vert Feed - ''' - Public Property VertFeed As String - Get - Return m_VertFeed - End Get - Set(value As String) - If value <> m_VertFeed Then - m_VertFeed = value - Dim OrigVertFeed As Double = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.VERTFEED, OrigVertFeed) - StringToLen(value, dValue) - m_IsModifiedVertFeed = Math.Abs(dValue - OrigVertFeed) > 10 * EPS_SMALL - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedDepthStr As Boolean = False - Private m_DepthStr As String - ''' - ''' Property that read and write to the Machining's database the Depth Str - ''' - Public Property DepthStr As String - Get - Return m_DepthStr - End Get - Set(value As String) - If value = String.Empty Or value <> m_DepthStr Then - m_DepthStr = value - Dim DbDepthStr As String = String.Empty - EgtGetMachiningParam(MCH_MP.DEPTH_STR, DbDepthStr) - m_IsModifiedDepthStr = If(value <> DbDepthStr, True, False) - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedUserNotes As Boolean = False - Private m_UserNotes As String - ''' - ''' Property that read and write to the Machining's database the User Notes - ''' - Public Property UserNotes As String - Get - Return m_UserNotes - End Get - Set(value As String) - If value = String.Empty Or value <> m_UserNotes Then - m_UserNotes = value - Dim OrigUserNotes As String = String.Empty - EgtGetMachiningParam(MCH_MP.USERNOTES, OrigUserNotes) - m_IsModifiedUserNotes = If(value <> OrigUserNotes, True, False) - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedInitAngs As Boolean = False - Private m_InitAngs As String - ''' - ''' Property that read and write to the Machining's database the Initial Angles - ''' - Public Property InitAngs As String - Get - Return m_InitAngs - End Get - Set(value As String) - If value = String.Empty Or value <> m_InitAngs Then - m_InitAngs = value - Dim OrigInitAngs As String = String.Empty - EgtGetMachiningParam(MCH_MP.INITANGS, OrigInitAngs) - m_IsModifiedInitAngs = If(value <> OrigInitAngs, True, False) - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_IsModifiedBlockedAxis As Boolean = False - Private m_BlockedAxis As String - ''' - ''' Property that read and write to the Machining's database the Initial Angles - ''' - Public Property BlockedAxis As String - Get - Return m_BlockedAxis - End Get - Set(value As String) - If value = String.Empty Or value <> m_BlockedAxis Then - m_BlockedAxis = value - Dim OrigBlockedAxis As String = String.Empty - EgtGetMachiningParam(MCH_MP.BLOCKEDAXIS, OrigBlockedAxis) - m_IsModifiedBlockedAxis = If(value <> OrigBlockedAxis, True, False) - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End If - End Set - End Property - - Private m_UpdateMachiningBtnIsEnabled As Boolean - Public ReadOnly Property UpdateMachiningBtnIsEnabled As Boolean - Get - Return m_IsModifiedInvert OrElse m_IsModifiedSelectedWorkSide OrElse m_IsModifiedSelectedHeadSide OrElse m_IsModifiedSelectedLeadInType OrElse m_IsModifiedSelectedExtLinkType _ - OrElse m_IsModifiedSelectedLeadOutType OrElse m_IsModifiedSelectedCurveUse OrElse m_IsModifiedSelectedStepType OrElse m_IsModifiedSelectedSubType OrElse m_IsModifiedSelectedLeadLinkType _ - OrElse m_IsModifiedSpeed OrElse m_IsModifiedFeed OrElse m_IsModifiedStartFeed OrElse m_IsModifiedEndFeed OrElse m_IsModifiedTipFeed OrElse m_IsModifiedOffSr OrElse m_IsModifiedOffSl _ - OrElse m_IsModifiedSideAngle OrElse m_IsModifiedApprox OrElse m_IsModifiedStartPos OrElse m_IsModifiedStartSlowLen OrElse m_IsModifiedEndSlowLen OrElse m_IsModifiedThrouAddLen _ - OrElse m_IsModifiedStepPar OrElse m_IsModifiedReturnPos OrElse m_IsModifiedOverLap OrElse m_IsModifiedTabLen OrElse m_IsModifiedTabDist OrElse m_IsModifiedTabHeight _ - OrElse m_IsModifiedTabAngle OrElse m_IsModifiedLiTang OrElse m_IsModifiedLiPerp OrElse m_IsModifiedLiElev OrElse m_IsModifiedLiCompLen OrElse m_IsModifiedLoTang OrElse m_IsModifiedLoPerp _ - OrElse m_IsModifiedLoElev OrElse m_IsModifiedLoCompLen OrElse m_IsModifiedStartAddLen OrElse m_IsModifiedEndAddLen OrElse m_IsModifiedStepExtArc OrElse m_IsModifiedStepIntArc _ - OrElse m_IsModifiedSideStep OrElse m_IsModifiedVertFeed OrElse m_IsModifiedDepthStr OrElse m_IsModifiedUserNotes - End Get - End Property - - Private m_bPreviewTool As Boolean = False - Private m_nPtEntId As Integer = GDB_ID.NULL - Public Property ViewTool As Boolean - Get - Return m_bPreviewTool - End Get - Set(value As Boolean) - If value Then - EgtPreparePreviewMachiningTool() - m_nPtEntId = EgtPreviewMachiningTool(GDB_ID.NULL, MCH_PTM.AFTER) - m_bPreviewTool = True - Else - EgtRemovePreviewMachiningTool() - m_bPreviewTool = False - End If - EgtDraw() - NotifyPropertyChanged("ViewTool") - End Set - End Property - -#Region "Messages" - - Public ReadOnly Property InvertMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 51) - End Get - End Property - - Public ReadOnly Property DepthMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 99) - End Get - End Property - - Public ReadOnly Property HeadSideMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 55) - End Get - End Property - - Public ReadOnly Property WorkSideMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 54) - End Get - End Property - - Public ReadOnly Property UserNotesMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 100) - End Get - End Property - - Private m_UserNotesTooltip As String - Public ReadOnly Property UserNotesTooltip As String - Get - Return UserNotes - End Get - End Property - - Public ReadOnly Property StartPosMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 73) - End Get - End Property - - Public ReadOnly Property ReturnPosMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 78) - End Get - End Property - - Public ReadOnly Property OverLapMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 101) - End Get - End Property - - Public ReadOnly Property ThrouAddLenMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 76) - End Get - End Property - - Public ReadOnly Property StepTypeMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 60) - End Get - End Property - - Public ReadOnly Property SubTypeMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 103) - End Get - End Property - - Public ReadOnly Property StepParMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 77) - End Get - End Property - - Public ReadOnly Property SideStepMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 95) - End Get - End Property - - Public ReadOnly Property StartSlowLenMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 74) - End Get - End Property - - Public ReadOnly Property EndSlowLenMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 75) - End Get - End Property - - Public ReadOnly Property SideAngleMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 71) - End Get - End Property - - Public ReadOnly Property OffsetSrMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 68) - End Get - End Property - - Public ReadOnly Property OffsetSlMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 69) - End Get - End Property - - Public ReadOnly Property AdvancedParamMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 150) - End Get - End Property - - Public ReadOnly Property InvertToolDirMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 151) - End Get - End Property - - Public ReadOnly Property FaceUseTypeMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 152) - End Get - End Property - - Public ReadOnly Property InitAngsMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 164) - End Get - End Property - - Public ReadOnly Property BlockedAxisMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 165) - End Get - End Property - - Public ReadOnly Property SolChoiceTypeMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 104) - End Get - End Property - - Public ReadOnly Property LeadInTypeMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 56) - End Get - End Property - - Public ReadOnly Property StartAddLenMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 91) - End Get - End Property - - Public ReadOnly Property LiTangMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 83) - End Get - End Property - - Public ReadOnly Property LiPerpMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 84) - End Get - End Property - - Public ReadOnly Property LiElevMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 85) - End Get - End Property - - Public ReadOnly Property LiCompLenMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 86) - End Get - End Property - - Public ReadOnly Property LeadOutTypeMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 58) - End Get - End Property - - Public ReadOnly Property EndAddLenMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 92) - End Get - End Property - - Public ReadOnly Property LoTangMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 87) - End Get - End Property - - Public ReadOnly Property LoPerpMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 88) - End Get - End Property - - Public ReadOnly Property LoElevMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 89) - End Get - End Property - - Public ReadOnly Property LoCompLenMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 90) - End Get - End Property - - Public ReadOnly Property ExtLinkTypeMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 57) - End Get - End Property - - Public ReadOnly Property LeaveTabMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 52) - End Get - End Property - - Public ReadOnly Property TabLenMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 79) - End Get - End Property - - Public ReadOnly Property TabHeightMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 80) - End Get - End Property - - Public ReadOnly Property TabAngleMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 81) - End Get - End Property - - Public ReadOnly Property TabDistMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 82) - End Get - End Property - - Public ReadOnly Property CurveUseMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 59) - End Get - End Property - - Public ReadOnly Property ApproxMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 72) - End Get - End Property - - Public ReadOnly Property StepExtArcMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 93) - End Get - End Property - - Public ReadOnly Property StepIntArcMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 94) - End Get - End Property - - Public ReadOnly Property SpeedMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 63) - End Get - End Property - - Public ReadOnly Property FeedMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 64) - End Get - End Property - - Public ReadOnly Property TipFeedMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 67) - End Get - End Property - - Public ReadOnly Property StartFeedMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 65) - End Get - End Property - - Public ReadOnly Property EndFeedMsg As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 66) - End Get - End Property - - Public ReadOnly Property OperationListHeader As String - Get - Return EgtMsg(MSG_OPERATION + 1) 'Lista Operazioni - End Get - End Property - - Public ReadOnly Property UpdateMachiningBtnMsg As String - Get - Return EgtMsg(MSG_OPERATION + 3) 'Applica Lavorazione - End Get - End Property - - Public ReadOnly Property GenericExpanderHeader As String - Get - Return EgtMsg(MSG_OPERATION + 7) 'Generici - End Get - End Property - - Public ReadOnly Property ToolExpanderHeader As String - Get - Return EgtMsg(MSG_MACHININGSDBPAGE + 98) & " (" & m_Tool & ")" - End Get - End Property - - Public ReadOnly Property ViewToolBtnMsg As String - Get - Return EgtMsg(MSG_OPERATION + 13) 'Anteprima Utensile - End Get - End Property - - Public ReadOnly Property NextStepToolBtnMsg As String - Get - Return EgtMsg(MSG_OPERATION + 14) 'Avanti - End Get - End Property - - Public ReadOnly Property PrevStepToolBtnMsg As String - Get - Return EgtMsg(MSG_OPERATION + 15) 'Indietro - End Get - End Property - -#End Region ' Messages - -#Region "METHODS" - - Private Sub ReadMachiningParam() - Dim nValue As Integer = 0 - Dim dValue As Double = 0 - EgtGetMachiningParam(MCH_MP.TYPE, m_Type) - NotifyPropertyChanged("Type") - EgtGetMachiningParam(MCH_MP.INVERT, m_Invert) - NotifyPropertyChanged("Invert") - m_IsModifiedInvert = False - EgtGetMachiningParam(MCH_MP.LEAVETAB, m_LeaveTab) - NotifyPropertyChanged("LeaveTab") - m_IsModifiedLeaveTab = False - EgtGetMachiningParam(MCH_MP.TOOLINVERT, m_ToolInvert) - NotifyPropertyChanged("ToolInvert") - m_IsModifiedToolInvert = False - NotifyPropertyChanged("WorkSideList") - EgtGetMachiningParam(MCH_MP.WORKSIDE, nValue) - m_SelectedWorkSide = If(IsNothing(WorkSideList), nValue, IdNameStruct.IndFromId(nValue, WorkSideList)) - NotifyPropertyChanged("SelectedWorkSide") - m_IsModifiedSelectedWorkSide = False - EgtGetMachiningParam(MCH_MP.HEADSIDE, nValue) - m_SelectedHeadSide = If(IsNothing(HeadSideList), nValue, IdNameStruct.IndFromId(nValue, HeadSideList)) - NotifyPropertyChanged("SelectedHeadSide") - m_IsModifiedSelectedHeadSide = False - NotifyPropertyChanged("LeadInTypeList") - EgtGetMachiningParam(MCH_MP.LEADINTYPE, m_SelectedLeadInType) - NotifyPropertyChanged("SelectedLeadInType") - m_IsModifiedSelectedLeadInType = False - EgtGetMachiningParam(MCH_MP.EXTLINKTYPE, m_SelectedExtLinkType) - NotifyPropertyChanged("SelectedExtLinkType") - m_IsModifiedSelectedExtLinkType = False - NotifyPropertyChanged("LeadOutTypeList") - EgtGetMachiningParam(MCH_MP.LEADOUTTYPE, m_SelectedLeadOutType) - NotifyPropertyChanged("SelectedLeadOutType") - m_IsModifiedSelectedLeadOutType = False - NotifyPropertyChanged("CurveUseList") - EgtGetMachiningParam(MCH_MP.CURVEUSE, m_SelectedCurveUse) - NotifyPropertyChanged("SelectedCurveUse") - m_IsModifiedSelectedCurveUse = False - NotifyPropertyChanged("StepTypeList") - EgtGetMachiningParam(MCH_MP.STEPTYPE, nValue) - m_SelectedStepType = If(IsNothing(StepTypeList), nValue, IdNameStruct.IndFromId(nValue, StepTypeList)) - NotifyPropertyChanged("SelectedStepType") - m_IsModifiedSelectedStepType = False - NotifyPropertyChanged("SubTypeList") - EgtGetMachiningParam(MCH_MP.SUBTYPE, nValue) - m_SelectedSubType = If(IsNothing(SubTypeList), nValue, IdNameStruct.IndFromId(nValue, SubTypeList)) - NotifyPropertyChanged("SelectedSubType") - m_IsModifiedSelectedSubType = False - NotifyPropertyChanged("LeadLinkTypeList") - EgtGetMachiningParam(MCH_MP.LEADLINKTYPE, m_SelectedLeadLinkType) - NotifyPropertyChanged("SelectedLeadLinkType") - m_IsModifiedSelectedLeadLinkType = False - NotifyPropertyChanged("FaceUseTypeList") - EgtGetMachiningParam(MCH_MP.FACEUSE, nValue) - m_SelectedFaceUseType = If(IsNothing(FaceUseTypeList), nValue, IdNameStruct.IndFromId(nValue, FaceUseTypeList)) - NotifyPropertyChanged("SelectedFaceUseType") - m_IsModifiedSelectedFaceUseType = False - NotifyPropertyChanged("SolChoiceTypeList") - EgtGetMachiningParam(MCH_MP.SOLCHOICETYPE, nValue) - m_SelectedSolChoiceType = If(IsNothing(SolChoiceTypeList), nValue, IdNameStruct.IndFromId(nValue, SolChoiceTypeList)) - NotifyPropertyChanged("SelectedSolChoiceType") - m_IsModifiedSelectedSolChoiceType = False - EgtGetMachiningParam(MCH_MP.SPEED, dValue) - m_Speed = DoubleToString(dValue, 4) - NotifyPropertyChanged("Speed") - m_IsModifiedSpeed = False - EgtGetMachiningParam(MCH_MP.FEED, dValue) - m_Feed = LenToString(dValue, 4) - NotifyPropertyChanged("Feed") - m_IsModifiedFeed = False - EgtGetMachiningParam(MCH_MP.STARTFEED, dValue) - m_StartFeed = LenToString(dValue, 4) - NotifyPropertyChanged("StartFeed") - m_IsModifiedStartFeed = False - EgtGetMachiningParam(MCH_MP.ENDFEED, dValue) - m_EndFeed = LenToString(dValue, 4) - NotifyPropertyChanged("EndFeed") - m_IsModifiedEndFeed = False - EgtGetMachiningParam(MCH_MP.TIPFEED, dValue) - m_TipFeed = LenToString(dValue, 4) - NotifyPropertyChanged("TipFeed") - m_IsModifiedTipFeed = False - EgtGetMachiningParam(MCH_MP.OFFSR, dValue) - m_OffSr = LenToString(dValue, 4) - NotifyPropertyChanged("OffSr") - m_IsModifiedOffSr = False - EgtGetMachiningParam(MCH_MP.OFFSL, dValue) - m_OffSl = LenToString(dValue, 4) - NotifyPropertyChanged("OffSl") - m_IsModifiedOffSl = False - EgtGetMachiningParam(MCH_MP.SIDEANGLE, dValue) - m_SideAngle = DoubleToString(dValue, 4) - NotifyPropertyChanged("SideAngle") - m_IsModifiedSideAngle = False - EgtGetMachiningParam(MCH_MP.APPROX, dValue) - m_Approx = LenToString(dValue, 4) - NotifyPropertyChanged("Approx") - m_IsModifiedApprox = False - EgtGetMachiningParam(MCH_MP.STARTPOS, dValue) - m_StartPos = LenToString(dValue, 4) - NotifyPropertyChanged("StartPos") - m_IsModifiedStartPos = False - EgtGetMachiningParam(MCH_MP.STARTSLOWLEN, dValue) - m_StartSlowLen = LenToString(dValue, 4) - NotifyPropertyChanged("StartSlowLen") - m_IsModifiedStartSlowLen = False - EgtGetMachiningParam(MCH_MP.ENDSLOWLEN, dValue) - m_EndSlowLen = LenToString(dValue, 4) - NotifyPropertyChanged("EndSlowLen") - m_IsModifiedEndSlowLen = False - EgtGetMachiningParam(MCH_MP.THROUADDLEN, dValue) - m_ThrouAddLen = LenToString(dValue, 4) - NotifyPropertyChanged("ThrouAddLen") - m_IsModifiedThrouAddLen = False - EgtGetMachiningParam(MCH_MP.STEP_, dValue) - m_StepPar = LenToString(dValue, 4) - NotifyPropertyChanged("StepPar") - m_IsModifiedStepPar = False - EgtGetMachiningParam(MCH_MP.RETURNPOS, dValue) - m_ReturnPos = LenToString(dValue, 4) - NotifyPropertyChanged("ReturnPos") - m_IsModifiedReturnPos = False - EgtGetMachiningParam(MCH_MP.OVERL, dValue) - m_OverLap = LenToString(dValue, 4) - NotifyPropertyChanged("OverLap") - m_IsModifiedOverLap = False - EgtGetMachiningParam(MCH_MP.TABLEN, dValue) - m_TabLen = LenToString(dValue, 4) - NotifyPropertyChanged("TabLen") - m_IsModifiedTabLen = False - EgtGetMachiningParam(MCH_MP.TABDIST, dValue) - m_TabDist = LenToString(dValue, 4) - NotifyPropertyChanged("TabDist") - m_IsModifiedTabDist = False - EgtGetMachiningParam(MCH_MP.TABHEIGHT, dValue) - m_TabHeight = LenToString(dValue, 4) - NotifyPropertyChanged("TabHeight") - m_IsModifiedTabHeight = False - EgtGetMachiningParam(MCH_MP.TABANGLE, dValue) - m_TabAngle = LenToString(dValue, 4) - NotifyPropertyChanged("TabAngle") - m_IsModifiedTabAngle = False - EgtGetMachiningParam(MCH_MP.LITANG, dValue) - m_LiTang = LenToString(dValue, 4) - NotifyPropertyChanged("LiTang") - m_IsModifiedLiTang = False - EgtGetMachiningParam(MCH_MP.LIPERP, dValue) - m_LiPerp = LenToString(dValue, 4) - NotifyPropertyChanged("LiPerp") - m_IsModifiedLiPerp = False - EgtGetMachiningParam(MCH_MP.LIELEV, dValue) - m_LiElev = LenToString(dValue, 4) - NotifyPropertyChanged("LiElev") - m_IsModifiedLiElev = False - EgtGetMachiningParam(MCH_MP.LICOMPLEN, dValue) - m_LiCompLen = LenToString(dValue, 4) - NotifyPropertyChanged("LiCompLen") - m_IsModifiedLiCompLen = False - EgtGetMachiningParam(MCH_MP.LOTANG, dValue) - m_LoTang = LenToString(dValue, 4) - NotifyPropertyChanged("LoTang") - m_IsModifiedLoTang = False - EgtGetMachiningParam(MCH_MP.LOPERP, dValue) - m_LoPerp = LenToString(dValue, 4) - NotifyPropertyChanged("LoPerp") - m_IsModifiedLoPerp = False - EgtGetMachiningParam(MCH_MP.LOELEV, dValue) - m_LoElev = LenToString(dValue, 4) - NotifyPropertyChanged("LoElev") - m_IsModifiedLoElev = False - EgtGetMachiningParam(MCH_MP.LOCOMPLEN, dValue) - m_LoCompLen = LenToString(dValue, 4) - NotifyPropertyChanged("LoCompLen") - m_IsModifiedLoCompLen = False - EgtGetMachiningParam(MCH_MP.STARTADDLEN, dValue) - m_StartAddLen = LenToString(dValue, 4) - NotifyPropertyChanged("StartAddLen") - m_IsModifiedStartAddLen = False - EgtGetMachiningParam(MCH_MP.ENDADDLEN, dValue) - m_EndAddLen = LenToString(dValue, 4) - NotifyPropertyChanged("EndAddLen") - m_IsModifiedEndAddLen = False - EgtGetMachiningParam(MCH_MP.STEPEXTARC, dValue) - m_StepExtArc = LenToString(dValue, 4) - NotifyPropertyChanged("StepExtArc") - m_IsModifiedStepExtArc = False - EgtGetMachiningParam(MCH_MP.STEPEXTARC, dValue) - m_StepExtArc = LenToString(dValue, 4) - NotifyPropertyChanged("StepExtArc") - m_IsModifiedStepExtArc = False - EgtGetMachiningParam(MCH_MP.STEPINTARC, dValue) - m_StepIntArc = LenToString(dValue, 4) - NotifyPropertyChanged("StepIntArc") - m_IsModifiedStepIntArc = False - EgtGetMachiningParam(MCH_MP.SIDESTEP, dValue) - m_SideStep = LenToString(dValue, 4) - NotifyPropertyChanged("SideStep") - m_IsModifiedSideStep = False - EgtGetMachiningParam(MCH_MP.VERTFEED, dValue) - m_VertFeed = LenToString(dValue, 4) - NotifyPropertyChanged("VertFeed") - m_IsModifiedVertFeed = False - EgtGetMachiningParam(MCH_MP.TOOL, m_Tool) - NotifyPropertyChanged("ToolExpanderHeader") - EgtGetMachiningParam(MCH_MP.DEPTH_STR, m_DepthStr) - NotifyPropertyChanged("DepthStr") - m_IsModifiedDepthStr = False - EgtGetMachiningParam(MCH_MP.USERNOTES, m_UserNotes) - NotifyPropertyChanged("UserNotes") - m_IsModifiedUserNotes = False - EgtGetMachiningParam(MCH_MP.INITANGS, m_InitAngs) - NotifyPropertyChanged("InitAngs") - m_IsModifiedInitAngs = False - EgtGetMachiningParam(MCH_MP.BLOCKEDAXIS, m_BlockedAxis) - NotifyPropertyChanged("BlockedAxis") - m_IsModifiedBlockedAxis = False - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - End Sub - - Private Sub WriteMachiningParam() - Dim nValue As Integer = 0 - Dim dValue As Double = 0 - If m_IsModifiedInvert Then - If EgtSetMachiningParam(MCH_MP.INVERT, m_Invert) Then - m_IsModifiedInvert = False - End If - End If - If m_IsModifiedLeaveTab Then - If EgtSetMachiningParam(MCH_MP.LEAVETAB, m_LeaveTab) Then - m_IsModifiedLeaveTab = False - End If - End If - If m_IsModifiedToolInvert Then - If EgtSetMachiningParam(MCH_MP.TOOLINVERT, m_ToolInvert) Then - m_IsModifiedToolInvert = False - End If - End If - If m_IsModifiedSelectedWorkSide Then - nValue = If(IsNothing(WorkSideList), m_SelectedWorkSide, IdNameStruct.IdFromInd(m_SelectedWorkSide, WorkSideList)) - If EgtSetMachiningParam(MCH_MP.WORKSIDE, nValue) Then - m_IsModifiedSelectedWorkSide = False - End If - End If - If m_IsModifiedSelectedHeadSide Then - nValue = If(IsNothing(HeadSideList), m_SelectedHeadSide, IdNameStruct.IdFromInd(m_SelectedHeadSide, HeadSideList)) - If EgtSetMachiningParam(MCH_MP.HEADSIDE, nValue) Then - m_IsModifiedSelectedHeadSide = False - End If - End If - If m_IsModifiedSelectedLeadInType Then - If EgtSetMachiningParam(MCH_MP.LEADINTYPE, m_SelectedLeadInType) Then - m_IsModifiedSelectedLeadInType = False - End If - End If - If m_IsModifiedSelectedExtLinkType Then - If EgtSetMachiningParam(MCH_MP.EXTLINKTYPE, m_SelectedExtLinkType) Then - m_IsModifiedSelectedExtLinkType = False - End If - End If - If m_IsModifiedSelectedLeadOutType Then - If EgtSetMachiningParam(MCH_MP.LEADOUTTYPE, m_SelectedLeadOutType) Then - m_IsModifiedSelectedLeadOutType = False - End If - End If - If m_IsModifiedSelectedCurveUse Then - If EgtSetMachiningParam(MCH_MP.CURVEUSE, m_SelectedCurveUse) Then - m_IsModifiedSelectedCurveUse = False - End If - End If - If m_IsModifiedSelectedStepType Then - nValue = If(IsNothing(StepTypeList), m_SelectedStepType, IdNameStruct.IdFromInd(m_SelectedStepType, StepTypeList)) - If EgtSetMachiningParam(MCH_MP.STEPTYPE, nValue) Then - m_IsModifiedSelectedStepType = False - End If - End If - If m_IsModifiedSelectedSubType Then - nValue = If(IsNothing(SubTypeList), m_SelectedSubType, IdNameStruct.IdFromInd(m_SelectedSubType, SubTypeList)) - If EgtSetMachiningParam(MCH_MP.SUBTYPE, nValue) Then - m_IsModifiedSelectedSubType = False - End If - End If - If m_IsModifiedSelectedLeadLinkType Then - If EgtSetMachiningParam(MCH_MP.LEADLINKTYPE, m_SelectedLeadLinkType) Then - m_IsModifiedSelectedLeadLinkType = False - End If - End If - If m_IsModifiedSelectedFaceUseType Then - nValue = If(IsNothing(FaceUseTypeList), m_SelectedFaceUseType, IdNameStruct.IdFromInd(m_SelectedFaceUseType, FaceUseTypeList)) - If EgtSetMachiningParam(MCH_MP.FACEUSE, nValue) Then - m_IsModifiedSelectedFaceUseType = False - End If - End If - If m_IsModifiedSelectedSolChoiceType Then - nValue = If(IsNothing(SolChoiceTypeList), m_SelectedSolChoiceType, IdNameStruct.IdFromInd(m_SelectedSolChoiceType, SolChoiceTypeList)) - If EgtSetMachiningParam(MCH_MP.SOLCHOICETYPE, nValue) Then - m_IsModifiedSelectedSolChoiceType = False - End If - End If - If m_IsModifiedSpeed Then - StringToDouble(m_Speed, dValue) - If EgtSetMachiningParam(MCH_MP.SPEED, dValue) Then - m_IsModifiedSpeed = False - End If - End If - If m_IsModifiedFeed Then - StringToLen(m_Feed, dValue) - If EgtSetMachiningParam(MCH_MP.FEED, dValue) Then - m_IsModifiedFeed = False - End If - End If - If m_IsModifiedStartFeed Then - StringToLen(m_StartFeed, dValue) - If EgtSetMachiningParam(MCH_MP.STARTFEED, dValue) Then - m_IsModifiedStartFeed = False - End If - End If - If m_IsModifiedEndFeed Then - StringToLen(m_EndFeed, dValue) - If EgtSetMachiningParam(MCH_MP.ENDFEED, dValue) Then - m_IsModifiedEndFeed = False - End If - End If - If m_IsModifiedTipFeed Then - StringToLen(m_TipFeed, dValue) - If EgtSetMachiningParam(MCH_MP.TIPFEED, dValue) Then - m_IsModifiedTipFeed = False - End If - End If - If m_IsModifiedOffSr Then - StringToLen(m_OffSr, dValue) - If EgtSetMachiningParam(MCH_MP.OFFSR, dValue) Then - m_IsModifiedOffSr = False - End If - End If - If m_IsModifiedOffSl Then - StringToLen(m_OffSl, dValue) - If EgtSetMachiningParam(MCH_MP.OFFSL, dValue) Then - m_IsModifiedOffSl = False - End If - End If - If m_IsModifiedSideAngle Then - StringToDouble(m_SideAngle, dValue) - If EgtSetMachiningParam(MCH_MP.SIDEANGLE, dValue) Then - m_IsModifiedSideAngle = False - End If - End If - If m_IsModifiedApprox Then - StringToLen(m_Approx, dValue) - If EgtSetMachiningParam(MCH_MP.APPROX, dValue) Then - m_IsModifiedApprox = False - End If - End If - If m_IsModifiedStartPos Then - StringToLen(m_StartPos, dValue) - If EgtSetMachiningParam(MCH_MP.STARTPOS, dValue) Then - m_IsModifiedStartPos = False - End If - End If - If m_IsModifiedStartSlowLen Then - StringToLen(m_StartSlowLen, dValue) - If EgtSetMachiningParam(MCH_MP.STARTSLOWLEN, dValue) Then - m_IsModifiedStartSlowLen = False - End If - End If - If m_IsModifiedEndSlowLen Then - StringToLen(m_EndSlowLen, dValue) - If EgtSetMachiningParam(MCH_MP.ENDSLOWLEN, dValue) Then - m_IsModifiedEndSlowLen = False - End If - End If - If m_IsModifiedThrouAddLen Then - StringToLen(m_ThrouAddLen, dValue) - If EgtSetMachiningParam(MCH_MP.THROUADDLEN, dValue) Then - m_IsModifiedThrouAddLen = False - End If - End If - If m_IsModifiedStepPar Then - StringToLen(m_StepPar, dValue) - If EgtSetMachiningParam(MCH_MP.STEP_, dValue) Then - m_IsModifiedStepPar = False - End If - End If - If m_IsModifiedReturnPos Then - StringToLen(m_ReturnPos, dValue) - If EgtSetMachiningParam(MCH_MP.RETURNPOS, dValue) Then - m_IsModifiedReturnPos = False - End If - End If - If m_IsModifiedOverLap Then - StringToLen(m_OverLap, dValue) - If EgtSetMachiningParam(MCH_MP.OVERL, dValue) Then - m_IsModifiedOverLap = False - End If - End If - If m_IsModifiedTabLen Then - StringToLen(m_TabLen, dValue) - If EgtSetMachiningParam(MCH_MP.TABLEN, dValue) Then - m_IsModifiedTabLen = False - End If - End If - If m_IsModifiedTabDist Then - StringToLen(m_TabDist, dValue) - If EgtSetMachiningParam(MCH_MP.TABDIST, dValue) Then - m_IsModifiedTabDist = False - End If - End If - If m_IsModifiedTabHeight Then - StringToLen(m_TabHeight, dValue) - If EgtSetMachiningParam(MCH_MP.TABHEIGHT, dValue) Then - m_IsModifiedTabHeight = False - End If - End If - If m_IsModifiedTabAngle Then - StringToLen(m_TabAngle, dValue) - If EgtSetMachiningParam(MCH_MP.TABANGLE, dValue) Then - m_IsModifiedTabAngle = False - End If - End If - If m_IsModifiedLiTang Then - StringToLen(m_LiTang, dValue) - If EgtSetMachiningParam(MCH_MP.LITANG, dValue) Then - m_IsModifiedLiTang = False - End If - End If - If m_IsModifiedLiPerp Then - StringToLen(m_LiPerp, dValue) - If EgtSetMachiningParam(MCH_MP.LIPERP, dValue) Then - m_IsModifiedLiPerp = False - End If - End If - If m_IsModifiedLiElev Then - StringToLen(m_LiElev, dValue) - If EgtSetMachiningParam(MCH_MP.LIELEV, dValue) Then - m_IsModifiedLiElev = False - End If - End If - If m_IsModifiedLiCompLen Then - StringToLen(m_LiCompLen, dValue) - If EgtSetMachiningParam(MCH_MP.LICOMPLEN, dValue) Then - m_IsModifiedLiCompLen = False - End If - End If - If m_IsModifiedLoTang Then - StringToLen(m_LoTang, dValue) - If EgtSetMachiningParam(MCH_MP.LOTANG, dValue) Then - m_IsModifiedLoTang = False - End If - End If - If m_IsModifiedLoPerp Then - StringToLen(m_LoPerp, dValue) - If EgtSetMachiningParam(MCH_MP.LOPERP, dValue) Then - m_IsModifiedLoPerp = False - End If - End If - If m_IsModifiedLoElev Then - StringToLen(m_LoElev, dValue) - If EgtSetMachiningParam(MCH_MP.LOELEV, dValue) Then - m_IsModifiedLoElev = False - End If - End If - If m_IsModifiedLoCompLen Then - StringToLen(m_LoCompLen, dValue) - If EgtSetMachiningParam(MCH_MP.LOCOMPLEN, dValue) Then - m_IsModifiedLoCompLen = False - End If - End If - If m_IsModifiedStartAddLen Then - StringToLen(m_StartAddLen, dValue) - If EgtSetMachiningParam(MCH_MP.STARTADDLEN, dValue) Then - m_IsModifiedStartAddLen = False - End If - End If - If m_IsModifiedEndAddLen Then - StringToLen(m_EndAddLen, dValue) - If EgtSetMachiningParam(MCH_MP.ENDADDLEN, dValue) Then - m_IsModifiedEndAddLen = False - End If - End If - If m_IsModifiedStepExtArc Then - StringToLen(m_StepExtArc, dValue) - If EgtSetMachiningParam(MCH_MP.STEPEXTARC, dValue) Then - m_IsModifiedEndAddLen = False - End If - End If - If m_IsModifiedStepIntArc Then - StringToLen(m_StepIntArc, dValue) - If EgtSetMachiningParam(MCH_MP.STEPINTARC, dValue) Then - m_IsModifiedStepIntArc = False - End If - End If - If m_IsModifiedSideStep Then - StringToLen(m_SideStep, dValue) - If EgtSetMachiningParam(MCH_MP.SIDESTEP, dValue) Then - m_IsModifiedSideStep = False - End If - End If - If m_IsModifiedVertFeed Then - StringToLen(m_VertFeed, dValue) - If EgtSetMachiningParam(MCH_MP.VERTFEED, dValue) Then - m_IsModifiedVertFeed = False - End If - End If - If m_IsModifiedDepthStr Then - If EgtSetMachiningParam(MCH_MP.DEPTH_STR, m_DepthStr) Then - m_IsModifiedDepthStr = False - End If - End If - If m_IsModifiedUserNotes Then - If EgtSetMachiningParam(MCH_MP.USERNOTES, m_UserNotes) Then - m_IsModifiedUserNotes = False - End If - End If - If m_IsModifiedInitAngs Then - If EgtSetMachiningParam(MCH_MP.INITANGS, m_InitAngs) Then - m_IsModifiedInitAngs = False - End If - End If - If m_IsModifiedBlockedAxis Then - If EgtSetMachiningParam(MCH_MP.BLOCKEDAXIS, m_BlockedAxis) Then - m_IsModifiedBlockedAxis = False - End If - End If - End Sub - -#End Region ' Commands - - ' Definizione comando - Private m_cmdNextStepTool As ICommand - Private m_cmdPrevStepTool As ICommand - Private m_cmdUpdateMachining As ICommand - -#Region "CONSTRUCTOR" - - Sub New(ByRef m_UpdateParamValues As Action) - m_UpdateParamValues = AddressOf ReadMachiningParam - End Sub - -#End Region ' Constructor - -#Region "COMMANDS" - -#Region "NextStepToolCommand" - - ''' - ''' Restituisce funzione per ricalcolo lavorazione. - ''' - Public ReadOnly Property NextStepToolCommand As ICommand - Get - If m_cmdNextStepTool Is Nothing Then - m_cmdNextStepTool = New RelayCommand(AddressOf NextStepTool) - End If - Return m_cmdNextStepTool - End Get - End Property - - ''' - ''' Ricalcola una lavorazione. - ''' - Public Sub NextStepTool(ByVal param As Object) - If m_bPreviewTool Then - Dim nNextId = EgtPreviewMachiningTool(m_nPtEntId, MCH_PTM.AFTER) - If nNextId <> GDB_ID.NULL Then m_nPtEntId = nNextId - EgtDraw() - End If - End Sub - -#End Region ' NextStepToolCommand - -#Region "PrevStepToolCommand" - - ''' - ''' Restituisce funzione per ricalcolo lavorazione. - ''' - Public ReadOnly Property PrevStepToolCommand As ICommand - Get - If m_cmdPrevStepTool Is Nothing Then - m_cmdPrevStepTool = New RelayCommand(AddressOf PrevStepTool) - End If - Return m_cmdPrevStepTool - End Get - End Property - - ''' - ''' Ricalcola una lavorazione. - ''' - Public Sub PrevStepTool(ByVal param As Object) - If m_bPreviewTool Then - Dim nPrevId = EgtPreviewMachiningTool(m_nPtEntId, MCH_PTM.BEFORE) - If nPrevId <> GDB_ID.NULL Then m_nPtEntId = nPrevId - EgtDraw() - End If - End Sub - -#End Region ' PrevStepToolCommand - -#Region "UpdateMachiningCommand" - - ''' - ''' Restituisce funzione per ricalcolo lavorazione. - ''' - Public ReadOnly Property UpdateMachiningCommand As ICommand - Get - If m_cmdUpdateMachining Is Nothing Then - m_cmdUpdateMachining = New RelayCommand(AddressOf UpdateMachining) - End If - Return m_cmdUpdateMachining - End Get - End Property - - ''' - ''' Ricalcola una lavorazione. - ''' - Public Sub UpdateMachining(ByVal param As Object) - ' La modifica di alcuni parametri forza il ricalcolo della geometria - Dim ModifiedGeometry As Boolean = m_IsModifiedSelectedFaceUseType - ' aggiorno valori modificati - WriteMachiningParam() - ' Carico tutta la geometria selezionata in una lista - Dim SelectedGeometry As New List(Of Integer) - Dim EntityIndex As Integer = EgtGetFirstSelectedObj() - While EntityIndex <> GDB_ID.NULL - SelectedGeometry.Add(EntityIndex) - EntityIndex = EgtGetNextSelectedObj() - End While - ' Gestione speciale provvisoria per una sola superficie con identificazione faccia - If SelectedGeometry.Count = 1 AndAlso EgtGetType(SelectedGeometry(0)) = GDB_TY.SRF_MESH Then - ' Verifico se la superficie è cambiata - Dim SubEntityIndex As Integer = 0 - If Not (EgtGetMachiningGeometry(0, EntityIndex, SubEntityIndex) And - EntityIndex = SelectedGeometry(0) And - SubEntityIndex = IniFile.m_LastSubEntityId And - Not EgtGetMachiningGeometry(1, EntityIndex, SubEntityIndex)) Then - Dim nF As Integer = EgtSurfTmFacetFromTria(SelectedGeometry(0), IniFile.m_LastSubEntityId) - If nF < 0 Then nF = 0 - Dim SubEntityArray As Integer() = {nF} - ModifiedGeometry = True - EgtSetMachiningGeometry(SelectedGeometry.ToArray, SubEntityArray) - End If - ' Gestione standard per curve - Else - ' Verifico se la geometria è cambiata, confrontando selezione attuale con geometria di lavorazione - Dim CountIndex As Integer = 0 - EntityIndex = 0 - Dim SubEntityIndex As Integer = 0 ' Sottocomponente, per ora non usato ma necessario - While EgtGetMachiningGeometry(CountIndex, EntityIndex, SubEntityIndex) - If CountIndex < SelectedGeometry.Count() Then - If SelectedGeometry(CountIndex) <> EntityIndex Then - ModifiedGeometry = True - Exit While - End If - Else - ModifiedGeometry = True - Exit While - End If - CountIndex += 1 - End While - If SelectedGeometry.Count <> CountIndex Then - ModifiedGeometry = True - End If - ' Imposto geometria selezionata come geometria di lavorazione - If ModifiedGeometry Then EgtSetMachiningGeometry(SelectedGeometry.ToArray) - End If - ' Ricalcolo la lavorazione - If Not EgtApplyMachining(ModifiedGeometry) Then - If EgtGetLastMachMgrErrorId() <> 0 Then - Dim sErr As String = EgtGetLastMachMgrErrorString() - Dim sInfo As String = String.Empty - EgtGetOutstrokeInfo(sInfo) - If Not String.IsNullOrEmpty(sInfo) Then sErr &= " " & sInfo - 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 - End If - ' Restart visualizzazione utensile - If m_bPreviewTool Then - m_nPtEntId = EgtPreviewMachiningTool(GDB_ID.NULL, MCH_PTM.AFTER) - End If - NotifyPropertyChanged("UpdateMachiningBtnIsEnabled") - EgtDraw() - Application.Msn.NotifyColleagues(Application.EMITTITLE) - End Sub - -#End Region ' UpdateMachiningCommand - -#End Region ' Commands - - Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged - - Public Sub NotifyPropertyChanged(propName As String) - RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) - End Sub - - End Class - -End Namespace - - -''' -''' Class that represent a Converter that use machining type and param type, to set the visibility state of the param type. -''' -Public Class OperationParamVisibilityConverter - Implements IValueConverter - - Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert - Select Case CInt(value) - Case MCH_OY.NONE - Return Visibility.Hidden - Case MCH_OY.DISP - Return TMDbParamVisibility.OperationDisposition(CInt(parameter)) - Case MCH_OY.DRILLING - Return TMDbParamVisibility.Drilling(CInt(parameter)) - Case MCH_OY.SAWING - Return TMDbParamVisibility.Sawing(CInt(parameter)) - Case MCH_OY.MILLING - Return TMDbParamVisibility.Milling(CInt(parameter)) - Case MCH_OY.POCKETING - Return TMDbParamVisibility.Pocketing(CInt(parameter)) - Case MCH_OY.MORTISING - Return TMDbParamVisibility.Mortising(CInt(parameter)) - Case MCH_OY.SAWROUGHING - Return TMDbParamVisibility.Sawroughing(CInt(parameter)) - Case MCH_OY.SAWFINISHING - Return TMDbParamVisibility.Sawfinishing(CInt(parameter)) - Case MCH_OY.GENMACHINING - Return TMDbParamVisibility.GenMachining(CInt(parameter)) - Case MCH_OY.CHISELING - Return TMDbParamVisibility.Chiseling(CInt(parameter)) - Case Else - Return Visibility.Hidden - End Select - End Function - - Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack - Throw New NotImplementedException - End Function - -End Class - -''' -''' Class that represent a Converter that convert mm in inch if necessary for the param depth. -''' -Public Class DepthUnitConverter - Implements IValueConverter - - Friend Const INCHTOMM As String = "*25.4" - Friend Const INCHSYMBOL As String = """" - - - Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert - If Not IsNothing(value) Then - value = CStr(value).Replace(INCHTOMM, INCHSYMBOL) - End If - Return value - End Function - - Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack - If Not IsNothing(value) Then - value = CStr(value).Replace(INCHSYMBOL, INCHTOMM) - End If - Return value - End Function - -End Class \ No newline at end of file diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderView.xaml b/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderV.xaml similarity index 97% rename from OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderView.xaml rename to OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderV.xaml index 7131dbd..b4f75d3 100644 --- a/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderView.xaml +++ b/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderV.xaml @@ -1,4 +1,4 @@ - 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" + + ''' + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + Public Sub NewMachiningCmd(ByVal param As Object) + StartNewMachining() + End Sub + +#End Region ' NewMachiningCommand + +#Region "NewPositioningCommand" + + ''' + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + 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" + + ''' + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + 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" + + ''' + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + Public Sub OperationListDoubleClick() + If EgtGetOperationMode(SelectedOperation.Id) Then + ParametersIsExpanded = True + End If + End Sub + +#End Region ' OperationListDoubleClickCommand + +#Region "MoveUpCommand" + + ''' + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + 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" + + ''' + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + 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" + + ''' + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + 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" + + ''' + ''' Returns a command that do Point. + ''' + 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 + + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + 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 \ No newline at end of file diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderViewModel.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderViewModel.vb deleted file mode 100644 index 809817a..0000000 --- a/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderViewModel.vb +++ /dev/null @@ -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" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - Public Sub NewMachiningCmd(ByVal param As Object) - StartNewMachining() - End Sub - -#End Region ' NewMachiningCommand - -#Region "NewPositioningCommand" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - 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" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - 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" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - Public Sub OperationListDoubleClick() - If EgtGetOperationMode(SelectedOperation.Id) Then - ParametersIsExpanded = True - End If - End Sub - -#End Region ' OperationListDoubleClickCommand - -#Region "MoveUpCommand" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - 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" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - 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" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - 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" - - ''' - ''' Returns a command that do Point. - ''' - 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 - - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - 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 \ No newline at end of file diff --git a/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderView.xaml b/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderView.xaml index 648152e..6ee513d 100644 --- a/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderView.xaml +++ b/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderView.xaml @@ -1,4 +1,4 @@ -= 5 AndAlso (value = SIM_ST.ST_PAUSE OrElse value = SIM_ST.ST_STOP) Then - For Index = 0 To m_MachineAxisList.Count - 1 - m_MachineAxisList(Index).IsReadOnlyAxesValue = False - Next - Else - For Index = 0 To m_MachineAxisList.Count - 1 - m_MachineAxisList(Index).IsReadOnlyAxesValue = True - Next - End If - EgtSimSetUiStatus(m_nStatus) - End Set - End Property + 'EGT PROPERTIES + ' Stato di visualizzazione della macchina + Private m_nMachLook As Integer = MCH_LOOK.ALL + ' Utensile corrente + Private m_sCurrTool As String = String.Empty + ' Stato e comando correnti + Public Enum SIM_ST As Integer + ST_STOP = 1 + ST_PLAY = 2 + ST_STEP = 3 + ST_PAUSE = 4 + End Enum + Private m_nStatus As SIM_ST = SIM_ST.ST_STOP + Private Property SimulationStatus As SIM_ST + Get + Return m_nStatus + End Get + Set(value As SIM_ST) + m_nStatus = value + If IniFile.m_nUserLevel >= 5 AndAlso (value = SIM_ST.ST_PAUSE OrElse value = SIM_ST.ST_STOP) Then + For Index = 0 To m_MachineAxisList.Count - 1 + m_MachineAxisList(Index).IsReadOnlyAxesValue = False + Next + Else + For Index = 0 To m_MachineAxisList.Count - 1 + m_MachineAxisList(Index).IsReadOnlyAxesValue = True + Next + End If + EgtSimSetUiStatus(m_nStatus) + End Set + End Property - ' Stato bottone Play - Private m_bShowPlay As Boolean = True - ' Coefficiente per valore Slider - Private m_SliderX As Double = 1 + ' Stato bottone Play + Private m_bShowPlay As Boolean = True + ' Coefficiente per valore Slider + Private m_SliderX As Double = 1 - ' Flag di esecuzione in corso - Private m_bSimExecuting As Boolean = False + ' Flag di esecuzione in corso + Private m_bSimExecuting As Boolean = False - 'GRAPHICAL PROPERTIES + 'GRAPHICAL PROPERTIES - Private m_IsExpanded As Boolean - Public Property IsExpanded As Boolean - Get - Return m_IsExpanded - End Get - Set(value As Boolean) - If value <> m_IsExpanded Then - If value Then - EgtDeselectAll() - Application.Msn.NotifyColleagues(Application.REMOVEMARKFROMLASTOPERATION) - Application.Msn.NotifyColleagues(Application.GETDISTANCE_ISCHECKED, False) - Map.refTopCommandBarVM.SaveIsEnabled = False - If IniFile.m_bShowOnlyTable Then - EgtShowOnlyTable(False) - EgtZoom(ZM.ALL, False) - End If - InitializeSimulation() - EgtDraw() - Else - If m_bSimExecuting Then Return - CloseSimulation() - If IniFile.m_bShowOnlyTable Then - EgtShowOnlyTable(True) - EgtZoom(ZM.ALL) - End If - Map.refTopCommandBarVM.SaveIsEnabled = True + Private m_IsExpanded As Boolean + Public Property IsExpanded As Boolean + Get + Return m_IsExpanded + End Get + Set(value As Boolean) + If value <> m_IsExpanded Then + If value Then + EgtDeselectAll() + Application.Msn.NotifyColleagues(Application.REMOVEMARKFROMLASTOPERATION) + Application.Msn.NotifyColleagues(Application.GETDISTANCE_ISCHECKED, False) + Map.refTopCommandBarVM.SaveIsEnabled = False + If IniFile.m_bShowOnlyTable Then + EgtShowOnlyTable(False) + EgtZoom(ZM.ALL, False) End If - m_IsExpanded = value - Application.Msn.NotifyColleagues(Application.SIMULATIONEXPANDER_GET_ISEXPANDED, value) - OnPropertyChanged("IsExpanded") - OnPropertyChanged("GenerateIsEnabled") - End If - End Set - End Property - Public ReadOnly Property GenerateIsEnabled As Boolean - Get - Return Not m_IsExpanded - End Get - End Property - - ' lista degli assi - Private m_MachineAxisList As New ObservableCollection(Of MachineAxis) - Public ReadOnly Property MachineAxisList As ObservableCollection(Of MachineAxis) - Get - Return m_MachineAxisList - End Get - End Property - - Private m_GCode As String - Public Property GCode As String - Get - Return m_GCode - End Get - Set(value As String) - If value <> m_GCode Then - m_GCode = value - OnPropertyChanged("GCode") - End If - End Set - End Property - - Private m_FValue As String - Public Property FValue As String - Get - Return m_FValue - End Get - Set(value As String) - If value <> m_FValue Then - m_FValue = value - OnPropertyChanged("FValue") - End If - End Set - End Property - - Private m_TName As String - Public Property TName As String - Get - Return m_TName - End Get - Set(value As String) - If value <> m_TName Then - m_TName = value - OnPropertyChanged("TName") - End If - End Set - End Property - - Private m_SValue As String - Public Property SValue As String - Get - Return m_SValue - End Get - Set(value As String) - If value <> m_SValue Then - m_SValue = value - OnPropertyChanged("SValue") - End If - End Set - End Property - - Private m_OpeName As String - Public Property OpeName As String - Get - Return m_OpeName - End Get - Set(value As String) - If value <> m_OpeName Then - m_OpeName = value - OnPropertyChanged("OpeName") - End If - End Set - End Property - - Private m_PlayPauseImage As String - Public ReadOnly Property PlayPauseImage As String - Get - If m_bShowPlay Then - Return "/Resources/OptionPanel/MachiningOptionPanel/SimulationExpander/Play.png" + InitializeSimulation() + EgtDraw() Else - Return "/Resources/OptionPanel/MachiningOptionPanel/SimulationExpander/Pause.png" + If m_bSimExecuting Then Return + CloseSimulation() + If IniFile.m_bShowOnlyTable Then + EgtShowOnlyTable(True) + EgtZoom(ZM.ALL) + End If + Map.refTopCommandBarVM.SaveIsEnabled = True End If - End Get - End Property + m_IsExpanded = value + Application.Msn.NotifyColleagues(Application.SIMULATIONEXPANDER_GET_ISEXPANDED, value) + OnPropertyChanged("IsExpanded") + OnPropertyChanged("GenerateIsEnabled") + End If + End Set + End Property + Public ReadOnly Property GenerateIsEnabled As Boolean + Get + Return Not m_IsExpanded + End Get + End Property - Private m_StatusMsg As String - Public Property StatusMsg As String - Get - Return m_StatusMsg - End Get - Set(value As String) - m_StatusMsg = value - OnPropertyChanged("StatusMsg") - End Set - End Property + ' lista degli assi + Private m_MachineAxisList As New ObservableCollection(Of MachineAxis) + Public ReadOnly Property MachineAxisList As ObservableCollection(Of MachineAxis) + Get + Return m_MachineAxisList + End Get + End Property - Private m_SliderValue As Double - Public Property SliderValue As Double - Get - Return m_SliderValue - End Get - Set(value As Double) - If value <> m_SliderValue Then - m_SliderValue = value - EgtSimSetStep(value * m_SliderX) - OnPropertyChanged("SliderValue") - End If - End Set - End Property + Private m_GCode As String + Public Property GCode As String + Get + Return m_GCode + End Get + Set(value As String) + If value <> m_GCode Then + m_GCode = value + OnPropertyChanged("GCode") + End If + End Set + End Property - Private m_VMillActive As Boolean = False - Public Property VMillActive As Boolean - Get - Return m_VMillActive - End Get - Set(value As Boolean) - m_VMillActive = value - OnPropertyChanged("VMillActive") - If m_VMillActive Then - EgtSetInfo(EgtGetCurrMachGroup(), KEY_MCHGRP_VM, m_VMillActive) - Else - EgtRemoveInfo(EgtGetCurrMachGroup(), KEY_MCHGRP_VM) - End If - Application.Msn.NotifyColleagues(Application.EMITTITLE) - End Set - End Property - Public Sub SetVMillActive(value As Boolean) + Private m_FValue As String + Public Property FValue As String + Get + Return m_FValue + End Get + Set(value As String) + If value <> m_FValue Then + m_FValue = value + OnPropertyChanged("FValue") + End If + End Set + End Property + + Private m_TName As String + Public Property TName As String + Get + Return m_TName + End Get + Set(value As String) + If value <> m_TName Then + m_TName = value + OnPropertyChanged("TName") + End If + End Set + End Property + + Private m_SValue As String + Public Property SValue As String + Get + Return m_SValue + End Get + Set(value As String) + If value <> m_SValue Then + m_SValue = value + OnPropertyChanged("SValue") + End If + End Set + End Property + + Private m_OpeName As String + Public Property OpeName As String + Get + Return m_OpeName + End Get + Set(value As String) + If value <> m_OpeName Then + m_OpeName = value + OnPropertyChanged("OpeName") + End If + End Set + End Property + + Private m_PlayPauseImage As String + Public ReadOnly Property PlayPauseImage As String + Get + If m_bShowPlay Then + Return "/Resources/OptionPanel/MachiningOptionPanel/SimulationExpander/Play.png" + Else + Return "/Resources/OptionPanel/MachiningOptionPanel/SimulationExpander/Pause.png" + End If + End Get + End Property + + Private m_StatusMsg As String + Public Property StatusMsg As String + Get + Return m_StatusMsg + End Get + Set(value As String) + m_StatusMsg = value + OnPropertyChanged("StatusMsg") + End Set + End Property + + Private m_SliderValue As Double + Public Property SliderValue As Double + Get + Return m_SliderValue + End Get + Set(value As Double) + If value <> m_SliderValue Then + m_SliderValue = value + EgtSimSetStep(value * m_SliderX) + OnPropertyChanged("SliderValue") + End If + End Set + End Property + + Private m_VMillActive As Boolean = False + Public Property VMillActive As Boolean + Get + Return m_VMillActive + End Get + Set(value As Boolean) m_VMillActive = value OnPropertyChanged("VMillActive") - End Sub + If m_VMillActive Then + EgtSetInfo(EgtGetCurrMachGroup(), KEY_MCHGRP_VM, m_VMillActive) + Else + EgtRemoveInfo(EgtGetCurrMachGroup(), KEY_MCHGRP_VM) + End If + Application.Msn.NotifyColleagues(Application.EMITTITLE) + End Set + End Property + Public Sub SetVMillActive(value As Boolean) + m_VMillActive = value + OnPropertyChanged("VMillActive") + End Sub - Private m_VMill_Visibility As Visibility = Visibility.Collapsed - Public Property VMill_Visibility As Visibility - Get - Return m_VMill_Visibility - End Get - Set(value As Visibility) - m_VMill_Visibility = value - OnPropertyChanged("VMill_Visibility") - End Set - End Property + Private m_VMill_Visibility As Visibility = Visibility.Collapsed + Public Property VMill_Visibility As Visibility + Get + Return m_VMill_Visibility + End Get + Set(value As Visibility) + m_VMill_Visibility = value + OnPropertyChanged("VMill_Visibility") + End Set + End Property - Private m_VMill_IsEnabled As Boolean = False - Public Property VMill_IsEnabled As Boolean - Get - Return m_VMill_IsEnabled - End Get - Set(value As Boolean) - m_VMill_IsEnabled = value - OnPropertyChanged("VMill_IsEnabled") - End Set - End Property + Private m_VMill_IsEnabled As Boolean = False + Public Property VMill_IsEnabled As Boolean + Get + Return m_VMill_IsEnabled + End Get + Set(value As Boolean) + m_VMill_IsEnabled = value + OnPropertyChanged("VMill_IsEnabled") + End Set + End Property - ' Definizione comandi - Private m_cmdStep As ICommand - Private m_cmdPlayPause As ICommand - Private m_cmdStop As ICommand - Private m_cmdGenerate As ICommand + ' Definizione comandi + Private m_cmdStep As ICommand + Private m_cmdPlayPause As ICommand + Private m_cmdStop As ICommand + Private m_cmdGenerate As ICommand #Region "Messages" - Public ReadOnly Property SimulationMsg As String - Get - Return EgtMsg(MSG_SIMULATION + 7) 'Simulazione - End Get - End Property + Public ReadOnly Property SimulationMsg As String + Get + Return EgtMsg(MSG_SIMULATION + 7) 'Simulazione + End Get + End Property - Public ReadOnly Property GenerateMsg As String - Get - Return EgtMsg(MSG_SIMULATION + 30) 'GENERA - End Get - End Property + Public ReadOnly Property GenerateMsg As String + Get + Return EgtMsg(MSG_SIMULATION + 30) 'GENERA + End Get + End Property - Public ReadOnly Property VMillMsg As String - Get - Return EgtMsg(MSG_SIMULATION + 16) 'Virtual Milling - End Get - End Property + Public ReadOnly Property VMillMsg As String + Get + Return EgtMsg(MSG_SIMULATION + 16) 'Virtual Milling + End Get + End Property #End Region #Region "ToolTip" - Public ReadOnly Property OneStepToolTip As String - Get - Return EgtMsg(MSG_SIMULATION + 8) - End Get - End Property - Public ReadOnly Property PlayPauseToolTip As String - Get - Return EgtMsg(MSG_SIMULATION + 9) - End Get - End Property - Public ReadOnly Property StopHomeToolTip As String - Get - Return EgtMsg(MSG_SIMULATION + 10) - End Get - End Property + Public ReadOnly Property OneStepToolTip As String + Get + Return EgtMsg(MSG_SIMULATION + 8) + End Get + End Property + Public ReadOnly Property PlayPauseToolTip As String + Get + Return EgtMsg(MSG_SIMULATION + 9) + End Get + End Property + Public ReadOnly Property StopHomeToolTip As String + Get + Return EgtMsg(MSG_SIMULATION + 10) + End Get + End Property #End Region @@ -295,21 +293,21 @@ Namespace EgtCAM5 #Region "CONSTRUCTOR" - Sub New() - Application.Msn.Register(Application.CLOSEAPPLICATION, Sub() - If IsExpanded Then - ResetSimulation() - End If - End Sub) - Application.Msn.Register(Application.SIMULATIONEXPANDER_SET_ISEXPANDED, Sub(bValue As Boolean) - IsExpanded = bValue - End Sub) - Application.Msn.Register(Application.SIMULATIONEXPANDER_UPDATE_CNCDATA, Sub() - If IsExpanded Then - ShowCncData() - End If - End Sub) - End Sub + Sub New() + Application.Msn.Register(Application.CLOSEAPPLICATION, Sub() + If IsExpanded Then + ResetSimulation() + End If + End Sub) + Application.Msn.Register(Application.SIMULATIONEXPANDER_SET_ISEXPANDED, Sub(bValue As Boolean) + IsExpanded = bValue + End Sub) + Application.Msn.Register(Application.SIMULATIONEXPANDER_UPDATE_CNCDATA, Sub() + If IsExpanded Then + ShowCncData() + End If + End Sub) + End Sub #End Region @@ -317,203 +315,203 @@ Namespace EgtCAM5 #Region "StepCommand" - ''' - ''' Returns a command that create a new tool. - ''' - Public ReadOnly Property StepCommand As ICommand - Get - If m_cmdStep Is Nothing Then - m_cmdStep = New RelayCommand(AddressOf StepCmd) - End If - Return m_cmdStep - End Get - End Property - - ''' - ''' Creata the new tool. This method is invoked by the NewCommand. - ''' - Public Sub StepCmd(ByVal param As Object) - StatusMsg = "" - ' Disabilito check VMill - VMill_IsEnabled = False - ' Se stato stop, devo avviare simulazione - If m_nStatus = SIM_ST.ST_STOP Then - SimulationStatus = SIM_ST.ST_STEP - ' Aggiorno bottone - m_bShowPlay = False - OnPropertyChanged("PlayPauseImage") - ExecSim() - ' Aggiorno bottone - m_bShowPlay = True - OnPropertyChanged("PlayPauseImage") - ' Alrimenti imposto solo il nuovo stato - Else - SimulationStatus = SIM_ST.ST_STEP - ' Aggiornamenti per bottone Play/Pause - m_bShowPlay = False - OnPropertyChanged("PlayPauseImage") + ''' + ''' Returns a command that create a new tool. + ''' + Public ReadOnly Property StepCommand As ICommand + Get + If m_cmdStep Is Nothing Then + m_cmdStep = New RelayCommand(AddressOf StepCmd) End If - End Sub + Return m_cmdStep + End Get + End Property + + ''' + ''' Creata the new tool. This method is invoked by the NewCommand. + ''' + Public Sub StepCmd(ByVal param As Object) + StatusMsg = "" + ' Disabilito check VMill + VMill_IsEnabled = False + ' Se stato stop, devo avviare simulazione + If m_nStatus = SIM_ST.ST_STOP Then + SimulationStatus = SIM_ST.ST_STEP + ' Aggiorno bottone + m_bShowPlay = False + OnPropertyChanged("PlayPauseImage") + ExecSim() + ' Aggiorno bottone + m_bShowPlay = True + OnPropertyChanged("PlayPauseImage") + ' Alrimenti imposto solo il nuovo stato + Else + SimulationStatus = SIM_ST.ST_STEP + ' Aggiornamenti per bottone Play/Pause + m_bShowPlay = False + OnPropertyChanged("PlayPauseImage") + End If + End Sub #End Region ' StepCommand #Region "PlayPauseCommand" - ''' - ''' Returns a command that create a new tool. - ''' - Public ReadOnly Property PlayPauseCommand As ICommand - Get - If m_cmdPlayPause Is Nothing Then - m_cmdPlayPause = New RelayCommand(AddressOf PlayPause) - End If - Return m_cmdPlayPause - End Get - End Property + ''' + ''' Returns a command that create a new tool. + ''' + Public ReadOnly Property PlayPauseCommand As ICommand + Get + If m_cmdPlayPause Is Nothing Then + m_cmdPlayPause = New RelayCommand(AddressOf PlayPause) + End If + Return m_cmdPlayPause + End Get + End Property - ''' - ''' Creata the new tool. This method is invoked by the NewCommand. - ''' - Public Sub PlayPause(ByVal param As Object) - StatusMsg = "" - If m_bShowPlay Then - ' Disabilito check VMill - VMill_IsEnabled = False - ' Aggiorno bottone - m_bShowPlay = False - OnPropertyChanged("PlayPauseImage") - ' Eseguo - If m_nStatus = SIM_ST.ST_STOP Then - ' Lancio simulazione - SimulationStatus = SIM_ST.ST_PLAY - ExecSim() - ' Aggiorno bottone - m_bShowPlay = True - OnPropertyChanged("PlayPauseImage") - ElseIf m_nStatus = SIM_ST.ST_PAUSE Then - SimulationStatus = SIM_ST.ST_PLAY - End If - Else + ''' + ''' Creata the new tool. This method is invoked by the NewCommand. + ''' + Public Sub PlayPause(ByVal param As Object) + StatusMsg = "" + If m_bShowPlay Then + ' Disabilito check VMill + VMill_IsEnabled = False + ' Aggiorno bottone + m_bShowPlay = False + OnPropertyChanged("PlayPauseImage") + ' Eseguo + If m_nStatus = SIM_ST.ST_STOP Then + ' Lancio simulazione + SimulationStatus = SIM_ST.ST_PLAY + ExecSim() ' Aggiorno bottone m_bShowPlay = True OnPropertyChanged("PlayPauseImage") - ' Se play o step, imposto stato pausa - If m_nStatus = SIM_ST.ST_PLAY Or m_nStatus = SIM_ST.ST_STEP Then - SimulationStatus = SIM_ST.ST_PAUSE - StatusMsg = EgtMsg(MSG_SIMULATION + 11) ' Pausa - End If + ElseIf m_nStatus = SIM_ST.ST_PAUSE Then + SimulationStatus = SIM_ST.ST_PLAY End If - End Sub + Else + ' Aggiorno bottone + m_bShowPlay = True + OnPropertyChanged("PlayPauseImage") + ' Se play o step, imposto stato pausa + If m_nStatus = SIM_ST.ST_PLAY Or m_nStatus = SIM_ST.ST_STEP Then + SimulationStatus = SIM_ST.ST_PAUSE + StatusMsg = EgtMsg(MSG_SIMULATION + 11) ' Pausa + End If + End If + End Sub #End Region ' PlayPauseCommand #Region "StopCommand" - ''' - ''' Returns a command that create a new tool. - ''' - Public ReadOnly Property StopCommand As ICommand - Get - If m_cmdStop Is Nothing Then - m_cmdStop = New RelayCommand(AddressOf StopCmd) - End If - Return m_cmdStop - End Get - End Property - - ''' - ''' Creata the new tool. This method is invoked by the NewCommand. - ''' - Public Sub StopCmd(ByVal param As Object) - StatusMsg = "" - ' Abilito check VMill - VMill_IsEnabled = True - ' Se stato già stop, porto in home - If m_nStatus = SIM_ST.ST_STOP Then - ' Mi riporto all'inizio - EgtSimStart() - EgtDraw() - ' Aggiorno dati CNC - ShowCncData() - StatusMsg = EgtMsg(MSG_SIMULATION + 14) ' Home - Else - StatusMsg = EgtMsg(MSG_SIMULATION + 12) ' Stop + ''' + ''' Returns a command that create a new tool. + ''' + Public ReadOnly Property StopCommand As ICommand + Get + If m_cmdStop Is Nothing Then + m_cmdStop = New RelayCommand(AddressOf StopCmd) End If - ' Aggiorno bottone - m_bShowPlay = True - OnPropertyChanged("PlayPauseImage") - ' Imposto il nuovo stato - SimulationStatus = SIM_ST.ST_STOP - End Sub + Return m_cmdStop + End Get + End Property + + ''' + ''' Creata the new tool. This method is invoked by the NewCommand. + ''' + Public Sub StopCmd(ByVal param As Object) + StatusMsg = "" + ' Abilito check VMill + VMill_IsEnabled = True + ' Se stato già stop, porto in home + If m_nStatus = SIM_ST.ST_STOP Then + ' Mi riporto all'inizio + EgtSimStart() + EgtDraw() + ' Aggiorno dati CNC + ShowCncData() + StatusMsg = EgtMsg(MSG_SIMULATION + 14) ' Home + Else + StatusMsg = EgtMsg(MSG_SIMULATION + 12) ' Stop + End If + ' Aggiorno bottone + m_bShowPlay = True + OnPropertyChanged("PlayPauseImage") + ' Imposto il nuovo stato + SimulationStatus = SIM_ST.ST_STOP + End Sub #End Region ' StopCommand #Region "GenerateCommand" - ''' - ''' Returns a command that create a new tool. - ''' - Public ReadOnly Property GenerateCommand As ICommand - Get - If m_cmdGenerate Is Nothing Then - m_cmdGenerate = New RelayCommand(AddressOf Generate) - End If - Return m_cmdGenerate - End Get - End Property + ''' + ''' Returns a command that create a new tool. + ''' + Public ReadOnly Property GenerateCommand As ICommand + Get + If m_cmdGenerate Is Nothing Then + m_cmdGenerate = New RelayCommand(AddressOf Generate) + End If + Return m_cmdGenerate + End Get + End Property - ''' - ''' Creata the new tool. This method is invoked by the NewCommand. - ''' - Public Sub Generate(ByVal param As Object) - ' Recupero la fase corrente - Dim nPhase As Integer = EgtGetCurrPhase() - ' Aggiorno le lavorazioni - If Not UpdateAllMachinings() Then - EgtSetCurrPhase(If(nPhase = 0, 1, nPhase), True) - Return - End If - ' Eseguo - Dim sCurrFilePath As String = String.Empty - EgtGetCurrFilePath(sCurrFilePath) - If String.IsNullOrEmpty(sCurrFilePath) OrElse EgtGetModified() Then - ' Il progetto deve essere salvato prima di poter essere generato. Vuoi farlo ? - If MessageBox.Show(EgtMsg(MSG_SIMULATION + 31), EgtMsg(MSG_SIMULATION + 15), MessageBoxButton.YesNo, MessageBoxImage.Warning) = MessageBoxResult.No Then - ' Abbandono - Return - Else - ' Lancio salvataggio - Application.Msn.NotifyColleagues(Application.SAVEPROJECT) - ' Se non salvato, abbandono - If EgtGetModified() Then Return - End If - End If - Dim sCncFile As String = Path.ChangeExtension(sCurrFilePath, Nothing) - Dim sInfo As String = "EgtCAM5 - " & sCurrFilePath - If IniFile.m_bMachiningGroup Then - Dim sMGrpName As String = String.Empty - If EgtGetMachGroupName(EgtGetCurrMachGroup(), sMGrpName) Then - sCncFile &= "_" & sMGrpName & ".cnc" - sInfo &= "-" & sMGrpName - End If - Else - sCncFile &= ".cnc" - End If - If Not EgtGenerate(sCncFile, sInfo) Then - If EgtGetLastMachMgrErrorId() <> 0 Then - Dim sErr As String = EgtGetLastMachMgrErrorString() - 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_SIMULATION + 32)) - End If - ' Torno alla fase originale (o alla prima se non definita) + ''' + ''' Creata the new tool. This method is invoked by the NewCommand. + ''' + Public Sub Generate(ByVal param As Object) + ' Recupero la fase corrente + Dim nPhase As Integer = EgtGetCurrPhase() + ' Aggiorno le lavorazioni + If Not UpdateAllMachinings() Then EgtSetCurrPhase(If(nPhase = 0, 1, nPhase), True) - End Sub + Return + End If + ' Eseguo + Dim sCurrFilePath As String = String.Empty + EgtGetCurrFilePath(sCurrFilePath) + If String.IsNullOrEmpty(sCurrFilePath) OrElse EgtGetModified() Then + ' Il progetto deve essere salvato prima di poter essere generato. Vuoi farlo ? + If MessageBox.Show(EgtMsg(MSG_SIMULATION + 31), EgtMsg(MSG_SIMULATION + 15), MessageBoxButton.YesNo, MessageBoxImage.Warning) = MessageBoxResult.No Then + ' Abbandono + Return + Else + ' Lancio salvataggio + Application.Msn.NotifyColleagues(Application.SAVEPROJECT) + ' Se non salvato, abbandono + If EgtGetModified() Then Return + End If + End If + Dim sCncFile As String = Path.ChangeExtension(sCurrFilePath, Nothing) + Dim sInfo As String = "EgtCAM5 - " & sCurrFilePath + If IniFile.m_bMachiningGroup Then + Dim sMGrpName As String = String.Empty + If EgtGetMachGroupName(EgtGetCurrMachGroup(), sMGrpName) Then + sCncFile &= "_" & sMGrpName & ".cnc" + sInfo &= "-" & sMGrpName + End If + Else + sCncFile &= ".cnc" + End If + If Not EgtGenerate(sCncFile, sInfo) Then + If EgtGetLastMachMgrErrorId() <> 0 Then + Dim sErr As String = EgtGetLastMachMgrErrorString() + 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_SIMULATION + 32)) + End If + ' Torno alla fase originale (o alla prima se non definita) + EgtSetCurrPhase(If(nPhase = 0, 1, nPhase), True) + End Sub #End Region ' GenerateCommand @@ -521,253 +519,251 @@ Namespace EgtCAM5 #Region "METHODS" - Private Function UpdateAllMachinings() As Boolean - ' Eseguo ricalcolo - Dim bModified As Boolean = EgtGetModified() - Dim sErr As String = String.Empty - Dim bOk As Boolean = EgtApplyAllMachinings(False, False, sErr) - ' 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 - End If - If Not bModified Then EgtResetModified() - Return bOk - End Function - - Private Sub InitializeSimulation() - ' Recupero la fase corrente - Dim nPhase As Integer = EgtGetCurrPhase() - ' Aggiorno le lavorazioni - If Not UpdateAllMachinings() Then EgtSetCurrPhase(If(nPhase = 0, 1, nPhase), True) - ' Costringo ad aggiornare UI - UpdateUI() - ' Imposto stato corrente - SimulationStatus = SIM_ST.ST_STOP - m_bShowPlay = True - m_SliderX = GetPrivateProfileDouble(S_SIMUL, K_SLIDERX, 1) - Dim SliderVal As Double = GetPrivateProfileDouble(S_SIMUL, K_SLIDERVAL, 10) - SliderValue = SliderVal - ' Gestione check VMill - If IsKeyEnabledVirtualMilling() And EgtUILib.GetPrivateProfileInt(S_VMILL, K_VM_ENABLE, 0, m_sCurrMachIniFilePath) <> 0 Then - VMill_Visibility = Visibility.Visible - VMill_IsEnabled = True - Dim bVal As Boolean - SetVMillActive(EgtGetInfo(EgtGetCurrMachGroup(), KEY_MCHGRP_VM, bVal) And bVal) + Private Function UpdateAllMachinings() As Boolean + ' Eseguo ricalcolo + Dim bModified As Boolean = EgtGetModified() + Dim sErr As String = String.Empty + Dim bOk As Boolean = EgtApplyAllMachinings(False, False, sErr) + ' 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 - VMill_Visibility = Visibility.Collapsed - VMill_IsEnabled = False - ' Disabilito Vmill, ma inibisco dichiarazione progetto modificato - EgtDisableModified() - VMillActive = False - EgtEnableModified() + MessageBox.Show(EgtMsg(MSG_SIMULATION + 6), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Error) End If - ' Inizio simulazione - If Not EgtSimStart() Then - If EgtGetLastMachMgrErrorId() <> 0 Then - Dim sErr As String = EgtGetLastMachMgrErrorString() - MessageBox.Show(sErr, EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Exclamation) '.... - ERRORE - Else - MessageBox.Show(EgtMsg(MSG_MESSAGEBOX + 10), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Error) 'Errore sconosciuto - ERRORE - End If + End If + If Not bModified Then EgtResetModified() + Return bOk + End Function + + Private Sub InitializeSimulation() + ' Recupero la fase corrente + Dim nPhase As Integer = EgtGetCurrPhase() + ' Aggiorno le lavorazioni + If Not UpdateAllMachinings() Then EgtSetCurrPhase(If(nPhase = 0, 1, nPhase), True) + ' Costringo ad aggiornare UI + UpdateUI() + ' Imposto stato corrente + SimulationStatus = SIM_ST.ST_STOP + m_bShowPlay = True + m_SliderX = GetPrivateProfileDouble(S_SIMUL, K_SLIDERX, 1) + Dim SliderVal As Double = GetPrivateProfileDouble(S_SIMUL, K_SLIDERVAL, 10) + SliderValue = SliderVal + ' Gestione check VMill + If IsKeyEnabledVirtualMilling() And EgtUILib.GetPrivateProfileInt(S_VMILL, K_VM_ENABLE, 0, m_sCurrMachIniFilePath) <> 0 Then + VMill_Visibility = Visibility.Visible + VMill_IsEnabled = True + Dim bVal As Boolean + SetVMillActive(EgtGetInfo(EgtGetCurrMachGroup(), KEY_MCHGRP_VM, bVal) And bVal) + Else + VMill_Visibility = Visibility.Collapsed + VMill_IsEnabled = False + ' Disabilito Vmill, ma inibisco dichiarazione progetto modificato + EgtDisableModified() + VMillActive = False + EgtEnableModified() + End If + ' Inizio simulazione + If Not EgtSimStart() Then + If EgtGetLastMachMgrErrorId() <> 0 Then + Dim sErr As String = EgtGetLastMachMgrErrorString() + MessageBox.Show(sErr, EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Exclamation) '.... - ERRORE + Else + MessageBox.Show(EgtMsg(MSG_MESSAGEBOX + 10), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Error) 'Errore sconosciuto - ERRORE End If - ' Aggiorno visualizzazione dati macchina - ShowCncData() - StatusMsg = EgtMsg(MSG_SIMULATION + 14) ' Home - End Sub + End If + ' Aggiorno visualizzazione dati macchina + ShowCncData() + StatusMsg = EgtMsg(MSG_SIMULATION + 14) ' Home + End Sub - Private Sub CloseSimulation() - StatusMsg = "" - ' Mi assicuro di terminare la simulazione - ResetSimulation() - End Sub + Private Sub CloseSimulation() + StatusMsg = "" + ' Mi assicuro di terminare la simulazione + ResetSimulation() + End Sub - Private Sub ResetSimulation() - ' Termino la simulazione - SimulationStatus = SIM_ST.ST_STOP - EgtSimStop() - ' Salvo valore dello slider - Dim sVal As String = DoubleToString(SliderValue, 1) - WritePrivateProfileString(S_SIMUL, K_SLIDERVAL, sVal) - ' Torno alla prima fase - EgtSetCurrPhase(1, True) - End Sub + Private Sub ResetSimulation() + ' Termino la simulazione + SimulationStatus = SIM_ST.ST_STOP + EgtSimStop() + ' Salvo valore dello slider + Dim sVal As String = DoubleToString(SliderValue, 1) + WritePrivateProfileString(S_SIMUL, K_SLIDERVAL, sVal) + ' Torno alla prima fase + EgtSetCurrPhase(1, True) + End Sub - Private Sub ExecSim() - m_bSimExecuting = True - IniFile.m_bSimulExecuting = True - Application.Msn.NotifyColleagues(Application.SETDRAWISENABLED, False) - Application.Msn.NotifyColleagues(Application.OPERATIONVIEWEXPANDERISENABLED, False) - Application.Msn.NotifyColleagues(Application.MACHGROUPSISENABLED, False) - EgtSimStart(False) - EgtSimSetStep(SliderValue * m_SliderX) - Dim nShowDataCounter As Integer = 0 - While m_nStatus <> SIM_ST.ST_STOP - ' Se simulazione in svolgimento - If m_nStatus = SIM_ST.ST_PLAY Or m_nStatus = SIM_ST.ST_STEP Then - ' Eseguo movimento - Dim nMove As Integer - Dim bMove As Boolean = EgtSimMove(nMove) - ' Se arrivato a fine step e sono in step - If bMove Then - If m_nStatus = SIM_ST.ST_STEP And nMove = MCH_SIM.END_STEP Then - ' Imposto stato Pausa - SimulationStatus = SIM_ST.ST_PAUSE - StatusMsg = EgtMsg(MSG_SIMULATION + 11) ' Pausa - ' Aggiornamenti per bottone Play/Pause - m_bShowPlay = True - OnPropertyChanged("PlayPauseImage") - End If - ' Se movimento non riuscito - Else - SimulationStatus = SIM_ST.ST_STOP + Private Sub ExecSim() + m_bSimExecuting = True + IniFile.m_bSimulExecuting = True + Application.Msn.NotifyColleagues(Application.SETDRAWISENABLED, False) + Application.Msn.NotifyColleagues(Application.OPERATIONVIEWEXPANDERISENABLED, False) + Application.Msn.NotifyColleagues(Application.MACHGROUPSISENABLED, False) + EgtSimStart(False) + EgtSimSetStep(SliderValue * m_SliderX) + Dim nShowDataCounter As Integer = 0 + While m_nStatus <> SIM_ST.ST_STOP + ' Se simulazione in svolgimento + If m_nStatus = SIM_ST.ST_PLAY Or m_nStatus = SIM_ST.ST_STEP Then + ' Eseguo movimento + Dim nMove As Integer + Dim bMove As Boolean = EgtSimMove(nMove) + ' Se arrivato a fine step e sono in step + If bMove Then + If m_nStatus = SIM_ST.ST_STEP And nMove = MCH_SIM.END_STEP Then + ' Imposto stato Pausa + SimulationStatus = SIM_ST.ST_PAUSE + StatusMsg = EgtMsg(MSG_SIMULATION + 11) ' Pausa ' Aggiornamenti per bottone Play/Pause m_bShowPlay = True OnPropertyChanged("PlayPauseImage") - ' Abilito check VMill - VMill_IsEnabled = True - Select Case nMove - Case MCH_SIM.END_ - StatusMsg = EgtMsg(MSG_SIMULATION + 1) 'Simulazione completata - Case MCH_SIM.OUTSTROKE - Dim sInfo As String = String.Empty - EgtGetOutstrokeInfo(sInfo) - MessageBox.Show(EgtMsg(MSG_SIMULATION + 2) & " " & sInfo, EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Stop) 'Extracorsa ... - Case MCH_SIM.DIR_ERR - MessageBox.Show(EgtMsg(MSG_SIMULATION + 3), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Stop) 'Direzione utensile irraggiungibile - Case Else - MessageBox.Show(EgtMsg(MSG_SIMULATION + 4), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Stop) 'Errore - End Select - End If - ' Aggiorno stato visualizzazione macchina (dipende anche da utensile) - UpdateMachView() - ' Aggiorno visualizzazione - EgtDraw() - ' Aggiorno dati CNC - If nShowDataCounter = 5 Or SimulationStatus = SIM_ST.ST_PAUSE Or SimulationStatus = SIM_ST.ST_STOP Then - ShowCncData() - nShowDataCounter = 0 - ElseIf nShowDataCounter > 5 Then - nShowDataCounter = 0 - Else - nShowDataCounter += 1 End If + ' Se movimento non riuscito Else - ' Per evitare di ciclare rapidissimamente e consumare inutilmente CPU - System.Threading.Thread.Sleep(4) + SimulationStatus = SIM_ST.ST_STOP + ' Aggiornamenti per bottone Play/Pause + m_bShowPlay = True + OnPropertyChanged("PlayPauseImage") + ' Abilito check VMill + VMill_IsEnabled = True + Select Case nMove + Case MCH_SIM.END_ + StatusMsg = EgtMsg(MSG_SIMULATION + 1) 'Simulazione completata + Case MCH_SIM.OUTSTROKE + Dim sInfo As String = String.Empty + EgtGetOutstrokeInfo(sInfo) + MessageBox.Show(EgtMsg(MSG_SIMULATION + 2) & " " & sInfo, EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Stop) 'Extracorsa ... + Case MCH_SIM.DIR_ERR + MessageBox.Show(EgtMsg(MSG_SIMULATION + 3), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Stop) 'Direzione utensile irraggiungibile + Case Else + MessageBox.Show(EgtMsg(MSG_SIMULATION + 4), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Stop) 'Errore + End Select End If - ' Costringo ad aggiornare UI - UpdateUI() - End While - m_bSimExecuting = False - IniFile.m_bSimulExecuting = False - Application.Msn.NotifyColleagues(Application.SETDRAWISENABLED, True) - Application.Msn.NotifyColleagues(Application.OPERATIONVIEWEXPANDERISENABLED, True) - Application.Msn.NotifyColleagues(Application.MACHGROUPSISENABLED, True) - End Sub - - Private Sub ShowCncData() - ' Assi - Dim nEgtIndex As Integer = 0 - Dim nAxisIndex As Integer = 0 - Dim sName As String = String.Empty - Dim sToken As String = String.Empty - Dim bLinear As Boolean = True - Dim dVal As Double = 0 - While EgtSimGetAxisInfoPos(nEgtIndex, sName, sToken, bLinear, dVal) - If sToken <> "**" Then - IsValidAxisIndex(nAxisIndex) - m_MachineAxisList(nAxisIndex).Name = sName - m_MachineAxisList(nAxisIndex).Token = sToken - m_MachineAxisList(nAxisIndex).Linear = bLinear - m_MachineAxisList(nAxisIndex).Value = If(bLinear, LenToString(dVal, -3), DoubleToString(dVal, -3)) - nAxisIndex += 1 - End If - nEgtIndex += 1 - End While - For ClearIndex = m_MachineAxisList.Count - 1 To nAxisIndex Step -1 - m_MachineAxisList.RemoveAt(ClearIndex) - Next - ' Tipo di movimento e feed - ShowMoveTypeFeed() - ' Nome utensile e speed - ShowToolNameSpeed() - ' Nome operazione e tipo - ShowOperationName() - End Sub - - Private Sub IsValidAxisIndex(nIndex As Integer) - For Index = m_MachineAxisList.Count To nIndex - m_MachineAxisList.Add(New MachineAxis) - Next - End Sub - - Private Function ShowMoveTypeFeed() As Boolean - Dim nG As Integer = 0 - Dim dFeed As Double = 0 - If EgtSimGetMoveInfo(nG, dFeed) Then - If nG <> 0 Then - GCode = "G" & nG.ToString() - FValue = "F" & LenToString(dFeed, 0) + ' Aggiorno stato visualizzazione macchina (dipende anche da utensile) + UpdateMachView() + ' Aggiorno visualizzazione + EgtDraw() + ' Aggiorno dati CNC + If nShowDataCounter = 5 Or SimulationStatus = SIM_ST.ST_PAUSE Or SimulationStatus = SIM_ST.ST_STOP Then + ShowCncData() + nShowDataCounter = 0 + ElseIf nShowDataCounter > 5 Then + nShowDataCounter = 0 Else - GCode = "G" & nG.ToString() - FValue = "" + nShowDataCounter += 1 End If - Return True Else - GCode = "" + ' Per evitare di ciclare rapidissimamente e consumare inutilmente CPU + System.Threading.Thread.Sleep(4) + End If + ' Costringo ad aggiornare UI + UpdateUI() + End While + m_bSimExecuting = False + IniFile.m_bSimulExecuting = False + Application.Msn.NotifyColleagues(Application.SETDRAWISENABLED, True) + Application.Msn.NotifyColleagues(Application.OPERATIONVIEWEXPANDERISENABLED, True) + Application.Msn.NotifyColleagues(Application.MACHGROUPSISENABLED, True) + End Sub + + Private Sub ShowCncData() + ' Assi + Dim nEgtIndex As Integer = 0 + Dim nAxisIndex As Integer = 0 + Dim sName As String = String.Empty + Dim sToken As String = String.Empty + Dim bLinear As Boolean = True + Dim dVal As Double = 0 + While EgtSimGetAxisInfoPos(nEgtIndex, sName, sToken, bLinear, dVal) + If sToken <> "**" Then + IsValidAxisIndex(nAxisIndex) + m_MachineAxisList(nAxisIndex).Name = sName + m_MachineAxisList(nAxisIndex).Token = sToken + m_MachineAxisList(nAxisIndex).Linear = bLinear + m_MachineAxisList(nAxisIndex).Value = If(bLinear, LenToString(dVal, -3), DoubleToString(dVal, -3)) + nAxisIndex += 1 + End If + nEgtIndex += 1 + End While + For ClearIndex = m_MachineAxisList.Count - 1 To nAxisIndex Step -1 + m_MachineAxisList.RemoveAt(ClearIndex) + Next + ' Tipo di movimento e feed + ShowMoveTypeFeed() + ' Nome utensile e speed + ShowToolNameSpeed() + ' Nome operazione e tipo + ShowOperationName() + End Sub + + Private Sub IsValidAxisIndex(nIndex As Integer) + For Index = m_MachineAxisList.Count To nIndex + m_MachineAxisList.Add(New MachineAxis) + Next + End Sub + + Private Function ShowMoveTypeFeed() As Boolean + Dim nG As Integer = 0 + Dim dFeed As Double = 0 + If EgtSimGetMoveInfo(nG, dFeed) Then + If nG <> 0 Then + GCode = "G" & nG.ToString() + FValue = "F" & LenToString(dFeed, 0) + Else + GCode = "G" & nG.ToString() FValue = "" - Return False End If - End Function + Return True + Else + GCode = "" + FValue = "" + Return False + End If + End Function - Private Function ShowToolNameSpeed() As Boolean - Dim sTool As String = String.Empty - Dim dSpeed As Double = 0 - If EgtSimGetToolInfo(sTool, dSpeed) Then - TName = sTool - If dSpeed > 1 Then - SValue = "S" & DoubleToString(dSpeed, 0) - Else - SValue = "" - End If - Return True + Private Function ShowToolNameSpeed() As Boolean + Dim sTool As String = String.Empty + Dim dSpeed As Double = 0 + If EgtSimGetToolInfo(sTool, dSpeed) Then + TName = sTool + If dSpeed > 1 Then + SValue = "S" & DoubleToString(dSpeed, 0) Else - TName = "" SValue = "" - Return False End If - End Function + Return True + Else + TName = "" + SValue = "" + Return False + End If + End Function - Private Function ShowOperationName() As Boolean - Dim sName As String = String.Empty - Dim nType As Integer = 0 - If EgtSimGetOperationInfo(sName, nType) Then - OpeName = sName - Return True - Else - OpeName = "" - Return False - End If - End Function + Private Function ShowOperationName() As Boolean + Dim sName As String = String.Empty + Dim nType As Integer = 0 + If EgtSimGetOperationInfo(sName, nType) Then + OpeName = sName + Return True + Else + OpeName = "" + Return False + End If + End Function - Private Sub UpdateMachView() - ' Se cambiato utensile, aggiorno stato visualizzazione macchina - Dim sTool As String = String.Empty - Dim dSpeed As Double = 0 - If EgtSimGetToolInfo(sTool, dSpeed) Then - If sTool <> m_sCurrTool Then - m_sCurrTool = sTool - EgtSetMachineLook(m_nMachLook) - End If + Private Sub UpdateMachView() + ' Se cambiato utensile, aggiorno stato visualizzazione macchina + Dim sTool As String = String.Empty + Dim dSpeed As Double = 0 + If EgtSimGetToolInfo(sTool, dSpeed) Then + If sTool <> m_sCurrTool Then + m_sCurrTool = sTool + EgtSetMachineLook(m_nMachLook) End If - End Sub + End If + End Sub #End Region - End Class - -End Namespace \ No newline at end of file +End Class \ No newline at end of file diff --git a/OptionPanel/OptionPanelVM.vb b/OptionPanel/OptionPanelVM.vb index 50a3024..8711fa2 100644 --- a/OptionPanel/OptionPanelVM.vb +++ b/OptionPanel/OptionPanelVM.vb @@ -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 \ No newline at end of file +End Class \ No newline at end of file diff --git a/OptionsWindow/OptionWindowVM.vb b/OptionsWindow/OptionWindowVM.vb index 375a49d..cce61a2 100644 --- a/OptionsWindow/OptionWindowVM.vb +++ b/OptionsWindow/OptionWindowVM.vb @@ -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" - ''' - ''' Returns a command that remove the current selected machining. - ''' - 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 + ''' + ''' Returns a command that remove the current selected machining. + ''' + 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 - ''' - ''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand. - ''' - 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 + ''' + ''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand. + ''' + 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 diff --git a/PopUpGridPanel/PopUpGridPanelViewModel.vb b/PopUpGridPanel/PopUpGridPanelViewModel.vb index 1c5aaa5..89599bb 100644 --- a/PopUpGridPanel/PopUpGridPanelViewModel.vb +++ b/PopUpGridPanel/PopUpGridPanelViewModel.vb @@ -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" - ''' - ''' Returns a command that do CPlaneView. - ''' - 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 + ''' + ''' Returns a command that do CPlaneView. + ''' + 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 - ''' - ''' Execute the CPlaneView. This method is invoked by the CPlaneViewCommand. - ''' - Public Sub CPlaneView(ByVal param As Object) - Map.refProjectVM.GetController.SetLastInteger(Controller.GRID_TYPE.VIEW) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID) - End Sub + ''' + ''' Execute the CPlaneView. This method is invoked by the CPlaneViewCommand. + ''' + 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" - ''' - ''' Returns a command that do CPlaneRotate. - ''' - 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 - - ''' - ''' Execute the CPlaneRotate. This method is invoked by the CPlaneRotateCommand. - ''' - 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) + ''' + ''' Returns a command that do CPlaneRotate. + ''' + 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 + + ''' + ''' Execute the CPlaneRotate. This method is invoked by the CPlaneRotateCommand. + ''' + 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" - ''' - ''' Returns a command that do CPlane3P. - ''' - 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 + ''' + ''' Returns a command that do CPlane3P. + ''' + 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 - ''' - ''' Execute the CPlane3P. This method is invoked by the CPlane3PCommand. - ''' - Public Sub CPlane3P(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID_3P) - End Sub + ''' + ''' Execute the CPlane3P. This method is invoked by the CPlane3PCommand. + ''' + Public Sub CPlane3P(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID_3P) + End Sub #End Region ' CPlane3PCommand #Region "CPlanePerpObjCommand" - ''' - ''' Returns a command that do CPlanePerpObj. - ''' - 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 + ''' + ''' Returns a command that do CPlanePerpObj. + ''' + 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 - ''' - ''' Execute the CPlanePerpObj. This method is invoked by the CPlanePerpObjCommand. - ''' - Public Sub CPlanePerpObj(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID_PERPCURVE) - End Sub + ''' + ''' Execute the CPlanePerpObj. This method is invoked by the CPlanePerpObjCommand. + ''' + Public Sub CPlanePerpObj(ByVal param As Object) + Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID_PERPCURVE) + End Sub #End Region ' CPlanePerpObjCommand #Region "CPlaneObjCommand" - ''' - ''' Returns a command that do CPlanepObj. - ''' - 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 + ''' + ''' Returns a command that do CPlanepObj. + ''' + 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 - ''' - ''' Execute the CPlaneObj. This method is invoked by the CPlaneObjCommand. - ''' - Public Sub CPlaneObj(ByVal param As Object) - Map.refProjectVM.GetController.ExecuteCommand(Controller.CMD.GRID_OBJ) - End Sub + ''' + ''' Execute the CPlaneObj. This method is invoked by the CPlaneObjCommand. + ''' + 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 \ No newline at end of file +End Class \ No newline at end of file diff --git a/PopUpViewPanel/PopUpViewPanelVM.vb b/PopUpViewPanel/PopUpViewPanelVM.vb index a18b9f4..ac33b14 100644 --- a/PopUpViewPanel/PopUpViewPanelVM.vb +++ b/PopUpViewPanel/PopUpViewPanelVM.vb @@ -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" - ''' - ''' Returns a command that do ZoomIn. - ''' - 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 + ''' + ''' Returns a command that do ZoomIn. + ''' + 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 - ''' - ''' Execute the ZoomIn. This method is invoked by the ZoomInCommand. - ''' - Public Sub ZoomIn(ByVal param As Object) - Map.refProjectVM.GetScene.ZoomIn() - End Sub + ''' + ''' Execute the ZoomIn. This method is invoked by the ZoomInCommand. + ''' + Public Sub ZoomIn(ByVal param As Object) + Map.refProjectVM.GetScene.ZoomIn() + End Sub #End Region ' ZoomInCommand #Region "ZoomOutCommand" - ''' - ''' Returns a command that do ZoomOut. - ''' - 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 + ''' + ''' Returns a command that do ZoomOut. + ''' + 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 - ''' - ''' Execute the ZoomOut. This method is invoked by the ZoomOutCommand. - ''' - Public Sub ZoomOut(ByVal param As Object) - Map.refProjectVM.GetScene.ZoomOut() - End Sub + ''' + ''' Execute the ZoomOut. This method is invoked by the ZoomOutCommand. + ''' + Public Sub ZoomOut(ByVal param As Object) + Map.refProjectVM.GetScene.ZoomOut() + End Sub #End Region ' ZoomOutCommand #Region "IsoViewSECommand" - ''' - ''' Returns a command that do IsoViewSE. - ''' - 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 + ''' + ''' Returns a command that do IsoViewSE. + ''' + 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 - ''' - ''' Execute the IsoViewSE. This method is invoked by the IsoViewSECommand. - ''' - Public Sub IsoViewSE(ByVal param As Object) - Map.refProjectVM.GetScene.IsoViewSE() - End Sub + ''' + ''' Execute the IsoViewSE. This method is invoked by the IsoViewSECommand. + ''' + Public Sub IsoViewSE(ByVal param As Object) + Map.refProjectVM.GetScene.IsoViewSE() + End Sub #End Region ' IsoViewSECommand #Region "IsoViewNECommand" - ''' - ''' Returns a command that do IsoViewNE. - ''' - 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 + ''' + ''' Returns a command that do IsoViewNE. + ''' + 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 - ''' - ''' Execute the IsoViewNE. This method is invoked by the IsoViewNECommand. - ''' - Public Sub IsoViewNE(ByVal param As Object) - Map.refProjectVM.GetScene.IsoViewNE() - End Sub + ''' + ''' Execute the IsoViewNE. This method is invoked by the IsoViewNECommand. + ''' + Public Sub IsoViewNE(ByVal param As Object) + Map.refProjectVM.GetScene.IsoViewNE() + End Sub #End Region ' IsoViewNECommand #Region "IsoViewNWCommand" - ''' - ''' Returns a command that do IsoViewNW. - ''' - 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 + ''' + ''' Returns a command that do IsoViewNW. + ''' + 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 - ''' - ''' Execute the IsoViewNW. This method is invoked by the IsoViewNWCommand. - ''' - Public Sub IsoViewNW(ByVal param As Object) - Map.refProjectVM.GetScene.IsoViewNW() - End Sub + ''' + ''' Execute the IsoViewNW. This method is invoked by the IsoViewNWCommand. + ''' + Public Sub IsoViewNW(ByVal param As Object) + Map.refProjectVM.GetScene.IsoViewNW() + End Sub #End Region ' IsoViewNWCommand #Region "ViewToCPlaneCommand" - ''' - ''' Returns a command that do GetDist. - ''' - 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 + ''' + ''' Returns a command that do GetDist. + ''' + 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 - ''' - ''' Execute the GetDist. This method is invoked by the GetDistCommand. - ''' - Public Sub ViewToCPlane(ByVal param As Object) - Map.refProjectVM.GetScene.CPlaneView() - End Sub + ''' + ''' Execute the GetDist. This method is invoked by the GetDistCommand. + ''' + Public Sub ViewToCPlane(ByVal param As Object) + Map.refProjectVM.GetScene.CPlaneView() + End Sub #End Region ' ViewToCPlaneCommand #End Region ' COMMANDS - End Class - -End Namespace \ No newline at end of file +End Class \ No newline at end of file diff --git a/Project/ProjectVM.vb b/Project/ProjectVM.vb index 194bd02..b5579eb 100644 --- a/Project/ProjectVM.vb +++ b/Project/ProjectVM.vb @@ -5,120 +5,118 @@ Imports EgtUILib Imports EgtWPFLib5 Imports EgtWPFLib5.EgtFloating -Namespace EgtCAM5 - - Public Class ProjectVM - Inherits TabViewModel +Public Class ProjectVM + Inherits TabViewModel #Region "FIELDS" - ' Variabili in cui salvo i filtri di selezione della modalità Draw e che poi ripristino all'uscita dalla modalità Machining - Private m_bSelZeroDim As Boolean = True - Private m_bSelCurve As Boolean = True - Private m_bSelSurf As Boolean = True - Private m_bSelVolume As Boolean = True - Private m_bSelExtra As Boolean = True + ' Variabili in cui salvo i filtri di selezione della modalità Draw e che poi ripristino all'uscita dalla modalità Machining + Private m_bSelZeroDim As Boolean = True + Private m_bSelCurve As Boolean = True + Private m_bSelSurf As Boolean = True + Private m_bSelVolume As Boolean = True + Private m_bSelExtra As Boolean = True - Private m_bLoaded As Boolean = False + Private m_bLoaded As Boolean = False - ' Variabile che contiene il Frame di disegno per poterlo ripristinare dopo essere passato dalla lavorazioneù - Private m_GridDrawFrame3d As Frame3d = New Frame3d(New Point3d(0, 0, 0)) + ' Variabile che contiene il Frame di disegno per poterlo ripristinare dopo essere passato dalla lavorazioneù + Private m_GridDrawFrame3d As Frame3d = New Frame3d(New Point3d(0, 0, 0)) - 'PROJECT PAGE'S SCENE FIELDS AND PROPERTIES - ' Reference to the ProjectScene - Private WithEvents m_ProjectScene As New Scene - ' Reference to the ProjectSceneHost - Private SceneHost As WindowsFormsHost - ' Property used to bind the scene to the WindowsFormsHost in XAML - Private m_bfirst As Boolean = True - Public ReadOnly Property ProjectSceneHost As WindowsFormsHost - Get - If m_bfirst Then - SceneHost = New WindowsFormsHost() With {.Child = m_ProjectScene} - m_bfirst = False - End If - Return SceneHost - End Get - End Property - ' Scene controller - Private WithEvents m_Controller As New Controller + 'PROJECT PAGE'S SCENE FIELDS AND PROPERTIES + ' Reference to the ProjectScene + Private WithEvents m_ProjectScene As New Scene + ' Reference to the ProjectSceneHost + Private SceneHost As WindowsFormsHost + ' Property used to bind the scene to the WindowsFormsHost in XAML + Private m_bfirst As Boolean = True + Public ReadOnly Property ProjectSceneHost As WindowsFormsHost + Get + If m_bfirst Then + SceneHost = New WindowsFormsHost() With {.Child = m_ProjectScene} + m_bfirst = False + End If + Return SceneHost + End Get + End Property + ' Scene controller + Private WithEvents m_Controller As New Controller - ' Definizione comandi - Private m_cmdLoaded As ICommand + ' Definizione comandi + Private m_cmdLoaded As ICommand - ' Flag per non salvare Script appena eseguito in elenco MruScript - Private m_bScriptInMru As Boolean = True + ' Flag per non salvare Script appena eseguito in elenco MruScript + Private m_bScriptInMru As Boolean = True #End Region #Region "EGTUILIB FIELDS" - Private m_bCPlaneTypePos As Boolean - 'Private m_bStopExec As Boolean = False - 'Private m_ProcEventsCallback As New ProcessEventsCallback(AddressOf ProcessEvents) - 'Private m_OutTextCallback As New OutTextCallback(AddressOf OutText) + Private m_bCPlaneTypePos As Boolean + 'Private m_bStopExec As Boolean = False + 'Private m_ProcEventsCallback As New ProcessEventsCallback(AddressOf ProcessEvents) + 'Private m_OutTextCallback As New OutTextCallback(AddressOf OutText) - ' Variabile per implementazione eventi - Private m_InputText As String + ' Variabile per implementazione eventi + Private m_InputText As String #End Region #Region "CONSTRUCTOR" - Sub New() - ' Creo riferimento a questa classe in EgtCAM5Map - Map.SetRefProjectVM(Me) - ' Creo classe di supporto per la visualizzazione dei parametri utensile e di lavorazione per Db e operazioni - TMDbParamVisibility.bFirst = True - ManageClosingApplication() - RegisterMainWindowCommands() - ' Inizializza i parametri della scena - 'InitializeEgtProject() - RegisterControllerCommands() - ManageTopCommandBar() - ' Funzione che contiene la registrazione di tutti i comandi del DrawOptionPanel - RegisterDrawOptionPanelCommands() - ' Funzione che contiene la registrazione di tutti i comandi della StatusBar - RegisterStatusBarCommands() - ' Cambio impostazioni griglia a seconda che sia in modalità Draw o Machining - Application.Msn.Register(Application.MACHININGMODE_ISCHECKED, Sub() - ' Salvo il Frame3d di disegno - m_GridDrawFrame3d = EgtGetGridFrame() - ' sposto la griglia sulla tavola di lavorazione - Dim TableRef As Point3d - EgtGetTableRef(1, TableRef) - EgtSetGridFrame(New Frame3d(TableRef)) - m_ProjectScene.GetObjFilterForSel(m_bSelZeroDim, m_bSelCurve, m_bSelSurf, m_bSelVolume, m_bSelExtra) - Application.Msn.NotifyColleagues(Application.UPDATESTATUSGRID, New UpdateStatusGridParam(IniFile.m_bMachiningShowGrid, IniFile.m_bShowGridFrame)) - End Sub) - Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub() - ' Ripristino il riferimento della griglia di disegno - EgtSetGridFrame(m_GridDrawFrame3d) - m_ProjectScene.SetObjFilterForSel(m_bSelZeroDim, m_bSelCurve, m_bSelSurf, m_bSelVolume, m_bSelExtra) - Application.Msn.NotifyColleagues(Application.UPDATESTATUSGRID, New UpdateStatusGridParam(IniFile.m_bDrawShowGrid, IniFile.m_bShowGridFrame)) - End Sub) - Application.Msn.Register(Application.SETSCENESELMODE, Sub(nSceneSelMode As SceneSelModeOpt) - Me.SceneSelMode = nSceneSelMode - End Sub) - Application.Msn.Register(Application.SETSCENESELTYPE, Sub(nSceneSelType As SceneSelTypeOpt) - Me.SceneSelType = nSceneSelType - End Sub) - Application.Msn.Register(Application.SETMOVEINDISPOSITION, Sub(bMoveInDisposition As Boolean) - Me.bMoveInDisposition = bMoveInDisposition + Sub New() + ' Creo riferimento a questa classe in EgtCAM5Map + Map.SetRefProjectVM(Me) + ' Creo classe di supporto per la visualizzazione dei parametri utensile e di lavorazione per Db e operazioni + TMDbParamVisibility.bFirst = True + ManageClosingApplication() + RegisterMainWindowCommands() + ' Inizializza i parametri della scena + 'InitializeEgtProject() + RegisterControllerCommands() + ManageTopCommandBar() + ' Funzione che contiene la registrazione di tutti i comandi del DrawOptionPanel + RegisterDrawOptionPanelCommands() + ' Funzione che contiene la registrazione di tutti i comandi della StatusBar + RegisterStatusBarCommands() + ' Cambio impostazioni griglia a seconda che sia in modalità Draw o Machining + Application.Msn.Register(Application.MACHININGMODE_ISCHECKED, Sub() + ' Salvo il Frame3d di disegno + m_GridDrawFrame3d = EgtGetGridFrame() + ' sposto la griglia sulla tavola di lavorazione + Dim TableRef As Point3d + EgtGetTableRef(1, TableRef) + EgtSetGridFrame(New Frame3d(TableRef)) + m_ProjectScene.GetObjFilterForSel(m_bSelZeroDim, m_bSelCurve, m_bSelSurf, m_bSelVolume, m_bSelExtra) + Application.Msn.NotifyColleagues(Application.UPDATESTATUSGRID, New UpdateStatusGridParam(IniFile.m_bMachiningShowGrid, IniFile.m_bShowGridFrame)) End Sub) + Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub() + ' Ripristino il riferimento della griglia di disegno + EgtSetGridFrame(m_GridDrawFrame3d) + m_ProjectScene.SetObjFilterForSel(m_bSelZeroDim, m_bSelCurve, m_bSelSurf, m_bSelVolume, m_bSelExtra) + Application.Msn.NotifyColleagues(Application.UPDATESTATUSGRID, New UpdateStatusGridParam(IniFile.m_bDrawShowGrid, IniFile.m_bShowGridFrame)) + End Sub) + Application.Msn.Register(Application.SETSCENESELMODE, Sub(nSceneSelMode As SceneSelModeOpt) + Me.SceneSelMode = nSceneSelMode + End Sub) + Application.Msn.Register(Application.SETSCENESELTYPE, Sub(nSceneSelType As SceneSelTypeOpt) + Me.SceneSelType = nSceneSelType + End Sub) + Application.Msn.Register(Application.SETMOVEINDISPOSITION, Sub(bMoveInDisposition As Boolean) + Me.bMoveInDisposition = bMoveInDisposition + End Sub) - End Sub + End Sub #End Region #Region "Get & Set" - Friend Function GetScene() As Scene - Return m_ProjectScene - End Function + Friend Function GetScene() As Scene + Return m_ProjectScene + End Function - Friend Function GetController() As Controller - Return m_Controller - End Function + Friend Function GetController() As Controller + Return m_Controller + End Function #End Region ' Get & Set @@ -126,85 +124,85 @@ Namespace EgtCAM5 #Region "LoadedCommand" - ''' - ''' Returns a command that do Point. - ''' - Public ReadOnly Property LoadedCommand As ICommand - Get - If m_cmdLoaded Is Nothing Then - m_cmdLoaded = New RelayCommand(AddressOf Loaded) - End If - Return m_cmdLoaded - End Get - End Property + ''' + ''' Returns a command that do Point. + ''' + Public ReadOnly Property LoadedCommand As ICommand + Get + If m_cmdLoaded Is Nothing Then + m_cmdLoaded = New RelayCommand(AddressOf Loaded) + End If + Return m_cmdLoaded + End Get + End Property - ''' - ''' Execute the Point. This method is invoked by the PointCommand. - ''' - Public Sub Loaded(ByVal param As Object) - ' Verifico sia la prima volta - If m_bLoaded Then Return - m_bLoaded = True - ' Creazione scena - PreInitializeScene() - ' Se tutto bene - If m_ProjectScene.Init() And (IniFile.m_nKeyOptions And KEY_OPT.BASE) <> 0 Then - IniFile.m_ProjectSceneContext = m_ProjectScene.GetCtx - PostInitializeScene() - ' Recupero e imposto handle finestra principale - Dim hMainWnd As IntPtr = New WindowInteropHelper(Application.Current.MainWindow).Handle - EgtSetMainWindowHandle(hMainWnd) - ' inizializzo gestore lavorazioni - EgtInitMachMgr(IniFile.m_sMachinesRoot) - ' Apro progetto vuoto - Map.refTopCommandBarVM.NewCmd() - ' Seleziono la macchina impostata nel file ini - Application.Msn.NotifyColleagues(Application.LOADCURRENTMACHINE) - EgtSetCurrentContext(IniFile.m_ProjectSceneContext) - Return - End If - ' Problemi - SceneHost.Child = Nothing - ' Se manca la chiave - If IniFile.m_nKeyLevel = -1 Or IniFile.m_nKeyLevel = -2 Then - EgtOutLog("Missing Dongle") - ' Box di avviso chiave mancante : "Chiave non presente. \n Inserirla e riavviare il programma." "Errore" - Dim sText As String = EgtMsg(MSG_MISSINGKEYWD + 2) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 3) - Dim sTitle As String = EgtMsg(MSG_MISSINGKEYWD + 1) - MessageBox.Show(sText, sTitle, MessageBoxButton.OK, MessageBoxImage.Error) - ' Altrimenti manca la licenza - Else - EgtOutLog("Problems with Licence") - ' Box di avviso licenza con problemi : "Programma senza licenza. \n Caricala e riavvia il programma." "Errore" - Dim sText As String = EgtMsg(MSG_MISSINGKEYWD + 5) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 6) - Dim sTitle As String = EgtMsg(MSG_MISSINGKEYWD + 1) - If MessageBox.Show(sText, sTitle, MessageBoxButton.OKCancel, MessageBoxImage.Error) = MessageBoxResult.OK Then - ' Apro dialogo per richiesta file licenza - Dim LicDlg As New Microsoft.Win32.OpenFileDialog() With { - .DefaultExt = ".lic", - .Filter = "Licences (.lic)|*.lic", - .CheckFileExists = True, - .ValidateNames = True - } - If LicDlg.ShowDialog() = True Then - ' Recupero il direttorio del file - Dim sDir As String = Path.GetDirectoryName(LicDlg.FileName) - ' Se il file non è già nel direttorio di configurazione lo copio - If Not String.Equals(Path.GetFullPath(sDir), Path.GetFullPath(IniFile.m_sConfigDir), StringComparison.OrdinalIgnoreCase) Then - Try - File.Copy(LicDlg.FileName, Path.Combine(IniFile.m_sConfigDir, LicDlg.SafeFileName), True) - Catch ex As Exception - End Try - End If - ' Imposto il nuovo file di licenza nell'Ini - WritePrivateProfileString(S_GENERAL, K_LICENCE, LicDlg.SafeFileName) + ''' + ''' Execute the Point. This method is invoked by the PointCommand. + ''' + Public Sub Loaded(ByVal param As Object) + ' Verifico sia la prima volta + If m_bLoaded Then Return + m_bLoaded = True + ' Creazione scena + PreInitializeScene() + ' Se tutto bene + If m_ProjectScene.Init() And (IniFile.m_nKeyOptions And KEY_OPT.BASE) <> 0 Then + IniFile.m_ProjectSceneContext = m_ProjectScene.GetCtx + PostInitializeScene() + ' Recupero e imposto handle finestra principale + Dim hMainWnd As IntPtr = New WindowInteropHelper(Application.Current.MainWindow).Handle + EgtSetMainWindowHandle(hMainWnd) + ' inizializzo gestore lavorazioni + EgtInitMachMgr(IniFile.m_sMachinesRoot) + ' Apro progetto vuoto + Map.refTopCommandBarVM.NewCmd() + ' Seleziono la macchina impostata nel file ini + Application.Msn.NotifyColleagues(Application.LOADCURRENTMACHINE) + EgtSetCurrentContext(IniFile.m_ProjectSceneContext) + Return + End If + ' Problemi + SceneHost.Child = Nothing + ' Se manca la chiave + If IniFile.m_nKeyLevel = -1 Or IniFile.m_nKeyLevel = -2 Then + EgtOutLog("Missing Dongle") + ' Box di avviso chiave mancante : "Chiave non presente. \n Inserirla e riavviare il programma." "Errore" + Dim sText As String = EgtMsg(MSG_MISSINGKEYWD + 2) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 3) + Dim sTitle As String = EgtMsg(MSG_MISSINGKEYWD + 1) + MessageBox.Show(sText, sTitle, MessageBoxButton.OK, MessageBoxImage.Error) + ' Altrimenti manca la licenza + Else + EgtOutLog("Problems with Licence") + ' Box di avviso licenza con problemi : "Programma senza licenza. \n Caricala e riavvia il programma." "Errore" + Dim sText As String = EgtMsg(MSG_MISSINGKEYWD + 5) & vbCrLf & EgtMsg(MSG_MISSINGKEYWD + 6) + Dim sTitle As String = EgtMsg(MSG_MISSINGKEYWD + 1) + If MessageBox.Show(sText, sTitle, MessageBoxButton.OKCancel, MessageBoxImage.Error) = MessageBoxResult.OK Then + ' Apro dialogo per richiesta file licenza + Dim LicDlg As New Microsoft.Win32.OpenFileDialog() With { + .DefaultExt = ".lic", + .Filter = "Licences (.lic)|*.lic", + .CheckFileExists = True, + .ValidateNames = True + } + If LicDlg.ShowDialog() = True Then + ' Recupero il direttorio del file + Dim sDir As String = Path.GetDirectoryName(LicDlg.FileName) + ' Se il file non è già nel direttorio di configurazione lo copio + If Not String.Equals(Path.GetFullPath(sDir), Path.GetFullPath(IniFile.m_sConfigDir), StringComparison.OrdinalIgnoreCase) Then + Try + File.Copy(LicDlg.FileName, Path.Combine(IniFile.m_sConfigDir, LicDlg.SafeFileName), True) + Catch ex As Exception + End Try End If + ' Imposto il nuovo file di licenza nell'Ini + WritePrivateProfileString(S_GENERAL, K_LICENCE, LicDlg.SafeFileName) End If End If - ' Chiudo il programma - IniFile.m_bFailedRun = True - Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATIONCOMMAND) - End Sub + End If + ' Chiudo il programma + IniFile.m_bFailedRun = True + Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATIONCOMMAND) + End Sub #End Region ' LoadedCommand @@ -212,1180 +210,1178 @@ Namespace EgtCAM5 #Region "METHODS" - Private Sub PreInitializeScene() - ' imposto colore di default - Dim DefColor As New Color3d(0, 0, 0) - GetPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor) - m_ProjectScene.SetDefaultMaterial(DefColor) - ' imposto colori sfondo - Dim BackTopColor As New Color3d(192, 192, 192) - GetPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor) - Dim BackBotColor As New Color3d(BackTopColor) - GetPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor) - m_ProjectScene.SetViewBackground(BackTopColor, BackBotColor) - ' imposto colore di evidenziazione - Dim MarkColor As New Color3d(255, 255, 0) - GetPrivateProfileColor(S_SCENE, K_MARK, MarkColor) - m_ProjectScene.SetMarkMaterial(MarkColor) - ' imposto colore per superfici selezionate - Dim SelSurfColor As New Color3d(255, 255, 192) - GetPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor) - m_ProjectScene.SetSelSurfMaterial(SelSurfColor) - ' imposto tipo e colore del rettangolo di zoom - Dim bOutline As Boolean = True - Dim ZwColor As New Color3d(0, 0, 0) - GetPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, bOutline, ZwColor) - m_ProjectScene.SetZoomWinAttribs(bOutline, ZwColor) - ' imposto colore della linea di distanza - Dim DstLnColor As New Color3d(255, 0, 0) - GetPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor) - m_ProjectScene.SetDistLineMaterial(DstLnColor) - ' imposto parametri OpenGL - Dim nDriver As Integer = GetPrivateProfileInt(S_OPENGL, K_DRIVER, 3) - Dim b2Buff As Boolean = (GetPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1) <> 0) - Dim nColorBits As Integer = GetPrivateProfileInt(S_OPENGL, K_COLORBITS, 32) - Dim nDepthBits As Integer = GetPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32) - m_ProjectScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits) - End Sub + Private Sub PreInitializeScene() + ' imposto colore di default + Dim DefColor As New Color3d(0, 0, 0) + GetPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor) + m_ProjectScene.SetDefaultMaterial(DefColor) + ' imposto colori sfondo + Dim BackTopColor As New Color3d(192, 192, 192) + GetPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor) + Dim BackBotColor As New Color3d(BackTopColor) + GetPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor) + m_ProjectScene.SetViewBackground(BackTopColor, BackBotColor) + ' imposto colore di evidenziazione + Dim MarkColor As New Color3d(255, 255, 0) + GetPrivateProfileColor(S_SCENE, K_MARK, MarkColor) + m_ProjectScene.SetMarkMaterial(MarkColor) + ' imposto colore per superfici selezionate + Dim SelSurfColor As New Color3d(255, 255, 192) + GetPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor) + m_ProjectScene.SetSelSurfMaterial(SelSurfColor) + ' imposto tipo e colore del rettangolo di zoom + Dim bOutline As Boolean = True + Dim ZwColor As New Color3d(0, 0, 0) + GetPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, bOutline, ZwColor) + m_ProjectScene.SetZoomWinAttribs(bOutline, ZwColor) + ' imposto colore della linea di distanza + Dim DstLnColor As New Color3d(255, 0, 0) + GetPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor) + m_ProjectScene.SetDistLineMaterial(DstLnColor) + ' imposto parametri OpenGL + Dim nDriver As Integer = GetPrivateProfileInt(S_OPENGL, K_DRIVER, 3) + Dim b2Buff As Boolean = (GetPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1) <> 0) + Dim nColorBits As Integer = GetPrivateProfileInt(S_OPENGL, K_COLORBITS, 32) + Dim nDepthBits As Integer = GetPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32) + m_ProjectScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits) + End Sub - Private Sub PostInitializeScene() - ' Impostazioni Controller - m_Controller.SetScene(m_ProjectScene) - Dim bLuaReg As Boolean = (GetPrivateProfileInt(S_GENERAL, K_COMMANDLOG, 0) <> 0) - Dim sCmdLogFile As String = CMDLOG_FILE_NAME.Replace("#", IniFile.m_nInstance.ToString()) - If Not m_Controller.SetCommandLog(bLuaReg, m_sTempDir, sCmdLogFile) Then - EgtOutLog("Command log not started") - If Environment.GetCommandLineArgs.Count() <= 1 Then - MessageBox.Show("Command log not started", "EgtCAM5 Warning", - MessageBoxButton.OK, MessageBoxImage.Warning) - End If + Private Sub PostInitializeScene() + ' Impostazioni Controller + m_Controller.SetScene(m_ProjectScene) + Dim bLuaReg As Boolean = (GetPrivateProfileInt(S_GENERAL, K_COMMANDLOG, 0) <> 0) + Dim sCmdLogFile As String = CMDLOG_FILE_NAME.Replace("#", IniFile.m_nInstance.ToString()) + If Not m_Controller.SetCommandLog(bLuaReg, m_sTempDir, sCmdLogFile) Then + EgtOutLog("Command log not started") + If Environment.GetCommandLineArgs.Count() <= 1 Then + MessageBox.Show("Command log not started", "EgtCAM5 Warning", + MessageBoxButton.OK, MessageBoxImage.Warning) End If - ' imposto unità di misura per interfaccia utente - IniFile.m_bMmUnits = (GetPrivateProfileInt(S_SCENE, K_MMUNITS, 1) <> 0) - Application.Msn.NotifyColleagues(Application.UPDATESTATUSUNITS, IniFile.m_bMmUnits) - ' imposto visualizzazione riferimento globale - Dim bShowGlobFrame As Boolean = (GetPrivateProfileInt(S_SCENE, K_SHOWGFRAME, 1) <> 0) - EgtSetGlobFrameShow(bShowGlobFrame) - ' imposto i dati della griglia - LoadGridData() - ' imposto stato di visualizzazione della griglia - IniFile.m_bDrawShowGrid = (GetPrivateProfileInt(S_GRID, K_DRAWSHOWGRID, 1) <> 0) - IniFile.m_bMachiningShowGrid = (GetPrivateProfileInt(S_GRID, K_MACHININGSHOWGRID, 1) <> 0) - IniFile.m_bShowGridFrame = (GetPrivateProfileInt(S_GRID, K_SHOWFRAME, 1) <> 0) - Application.Msn.NotifyColleagues(Application.UPDATESTATUSGRID, New UpdateStatusGridParam(IniFile.m_bDrawShowGrid, IniFile.m_bShowGridFrame)) - ' imposto tipo coordinate - m_bCPlaneTypePos = True - Application.Msn.NotifyColleagues(Application.STATUSCURRPOSTYPETEXT, "GRID") - m_ProjectScene.SetGridCursorPos(m_bCPlaneTypePos) - ' modo di visualizzazione - Dim nShowMode As Integer = GetPrivateProfileInt(S_SCENE, K_SHOWMODE, SM.SHADING) - Application.Msn.NotifyColleagues(Application.SHOWMODESTATE, nShowMode) - ' visualizzazione direzione curve - Dim nShowCurveDir As Integer = GetPrivateProfileInt(S_SCENE, K_CURVEDIR, 0) - Application.Msn.NotifyColleagues(Application.SHOWCURVEDIR, nShowCurveDir) - ' visualizzazione avanzata dei triangoli costituenti le superfici - Dim bShowTriaAdv As Boolean = (GetPrivateProfileInt(S_SCENE, K_SHOWTRIAADV, 1) <> 0) - EgtSetShowTriaAdv(bShowTriaAdv) - ' tipo visualizzazione per Zmap - Dim nShowZmap As Integer = GetPrivateProfileInt(S_SCENE, K_SHOWZMAP, 1) - EgtSetShowZmap(nShowZmap, False) - ' dimensione lineare max in pixel delle textures - Dim nTxrMaxLinPix As Integer = GetPrivateProfileInt(S_SCENE, K_TEXMAXLINPIX, 4096) - EgtSetTextureMaxLinPixels(nTxrMaxLinPix) - ' lettura da ini della variabile che abilita i gruppi di lavorazione - IniFile.m_bMachiningGroup = (GetPrivateProfileInt(S_MACH, K_MACHININGGROUP, 0) <> 0) - Application.Msn.NotifyColleagues(Application.DRAWMODE_ISCHECKED) - ' lettura flag visualizzazione solo tavola in definizione lavorazioni - IniFile.m_bShowOnlyTable = (GetPrivateProfileInt(S_MACH, K_SHOWONLYTABLE, 1) <> 0) - ' ObjTree non selezionato - Application.Msn.NotifyColleagues(Application.UPDATEOBJTREEOLDID, GDB_ID.NULL) - ' nascondo input box - Application.Msn.NotifyColleagues(Application.RESETINPUTBOX) - ' Imposto stato filtro selezione - m_ProjectScene.GetObjFilterForSel(m_bSelZeroDim, m_bSelCurve, m_bSelSurf, m_bSelVolume, m_bSelExtra) - m_Controller.MouseSetObjFilterForSelect(m_bSelZeroDim, m_bSelCurve, m_bSelSurf, m_bSelVolume, m_bSelExtra) - ' Imposto default per export - m_Controller.SetDefaultForImageExport(OptionModule.m_nImgWidth, OptionModule.m_nImgHeight) - End Sub + End If + ' imposto unità di misura per interfaccia utente + IniFile.m_bMmUnits = (GetPrivateProfileInt(S_SCENE, K_MMUNITS, 1) <> 0) + Application.Msn.NotifyColleagues(Application.UPDATESTATUSUNITS, IniFile.m_bMmUnits) + ' imposto visualizzazione riferimento globale + Dim bShowGlobFrame As Boolean = (GetPrivateProfileInt(S_SCENE, K_SHOWGFRAME, 1) <> 0) + EgtSetGlobFrameShow(bShowGlobFrame) + ' imposto i dati della griglia + LoadGridData() + ' imposto stato di visualizzazione della griglia + IniFile.m_bDrawShowGrid = (GetPrivateProfileInt(S_GRID, K_DRAWSHOWGRID, 1) <> 0) + IniFile.m_bMachiningShowGrid = (GetPrivateProfileInt(S_GRID, K_MACHININGSHOWGRID, 1) <> 0) + IniFile.m_bShowGridFrame = (GetPrivateProfileInt(S_GRID, K_SHOWFRAME, 1) <> 0) + Application.Msn.NotifyColleagues(Application.UPDATESTATUSGRID, New UpdateStatusGridParam(IniFile.m_bDrawShowGrid, IniFile.m_bShowGridFrame)) + ' imposto tipo coordinate + m_bCPlaneTypePos = True + Application.Msn.NotifyColleagues(Application.STATUSCURRPOSTYPETEXT, "GRID") + m_ProjectScene.SetGridCursorPos(m_bCPlaneTypePos) + ' modo di visualizzazione + Dim nShowMode As Integer = GetPrivateProfileInt(S_SCENE, K_SHOWMODE, SM.SHADING) + Application.Msn.NotifyColleagues(Application.SHOWMODESTATE, nShowMode) + ' visualizzazione direzione curve + Dim nShowCurveDir As Integer = GetPrivateProfileInt(S_SCENE, K_CURVEDIR, 0) + Application.Msn.NotifyColleagues(Application.SHOWCURVEDIR, nShowCurveDir) + ' visualizzazione avanzata dei triangoli costituenti le superfici + Dim bShowTriaAdv As Boolean = (GetPrivateProfileInt(S_SCENE, K_SHOWTRIAADV, 1) <> 0) + EgtSetShowTriaAdv(bShowTriaAdv) + ' tipo visualizzazione per Zmap + Dim nShowZmap As Integer = GetPrivateProfileInt(S_SCENE, K_SHOWZMAP, 1) + EgtSetShowZmap(nShowZmap, False) + ' dimensione lineare max in pixel delle textures + Dim nTxrMaxLinPix As Integer = GetPrivateProfileInt(S_SCENE, K_TEXMAXLINPIX, 4096) + EgtSetTextureMaxLinPixels(nTxrMaxLinPix) + ' lettura da ini della variabile che abilita i gruppi di lavorazione + IniFile.m_bMachiningGroup = (GetPrivateProfileInt(S_MACH, K_MACHININGGROUP, 0) <> 0) + Application.Msn.NotifyColleagues(Application.DRAWMODE_ISCHECKED) + ' lettura flag visualizzazione solo tavola in definizione lavorazioni + IniFile.m_bShowOnlyTable = (GetPrivateProfileInt(S_MACH, K_SHOWONLYTABLE, 1) <> 0) + ' ObjTree non selezionato + Application.Msn.NotifyColleagues(Application.UPDATEOBJTREEOLDID, GDB_ID.NULL) + ' nascondo input box + Application.Msn.NotifyColleagues(Application.RESETINPUTBOX) + ' Imposto stato filtro selezione + m_ProjectScene.GetObjFilterForSel(m_bSelZeroDim, m_bSelCurve, m_bSelSurf, m_bSelVolume, m_bSelExtra) + m_Controller.MouseSetObjFilterForSelect(m_bSelZeroDim, m_bSelCurve, m_bSelSurf, m_bSelVolume, m_bSelExtra) + ' Imposto default per export + m_Controller.SetDefaultForImageExport(OptionModule.m_nImgWidth, OptionModule.m_nImgHeight) + End Sub - Private Sub ProcessCommandLine() - ' Se non ci sono parametri su linea di comando, esco - If Environment.GetCommandLineArgs.Count() <= 1 Then Return - ' Recupero il primo vero parametro che dovrebbe essere il nome con estensione di un file - Dim sFile As String = Environment.GetCommandLineArgs(1) - Dim sExt As String = Path.GetExtension(sFile).ToLower() - If String.IsNullOrWhiteSpace(sFile) OrElse String.IsNullOrWhiteSpace(sExt) Then Return - ' Se file ddf, gestione creazione porta con Doors - If sExt = ".ddf" Then - ' Se manca direttorio uso quello di default - If String.IsNullOrWhiteSpace(Path.GetDirectoryName(sFile)) Then - Dim sDefDir As String = String.Empty - GetPrivateProfileString(S_DOORS, K_DDFDEFAULTDIR, "", sDefDir) - sFile = sDefDir & "\" & sFile - End If - ' Ricoscimento flag - Dim nFlag As Integer = 0 - If Environment.GetCommandLineArgs.Count() > 2 Then Integer.TryParse(Environment.GetCommandLineArgs(2), nFlag) - Dim bNcGen As Boolean = (nFlag >= 1) - Dim bExit As Boolean = (nFlag >= 2) - ' Esecuzione - OpenDoorFile(sFile, bNcGen, bExit) - ' Se richiesta uscita immediata - If bExit Then Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATIONCOMMAND) - Return + Private Sub ProcessCommandLine() + ' Se non ci sono parametri su linea di comando, esco + If Environment.GetCommandLineArgs.Count() <= 1 Then Return + ' Recupero il primo vero parametro che dovrebbe essere il nome con estensione di un file + Dim sFile As String = Environment.GetCommandLineArgs(1) + Dim sExt As String = Path.GetExtension(sFile).ToLower() + If String.IsNullOrWhiteSpace(sFile) OrElse String.IsNullOrWhiteSpace(sExt) Then Return + ' Se file ddf, gestione creazione porta con Doors + If sExt = ".ddf" Then + ' Se manca direttorio uso quello di default + If String.IsNullOrWhiteSpace(Path.GetDirectoryName(sFile)) Then + Dim sDefDir As String = String.Empty + GetPrivateProfileString(S_DOORS, K_DDFDEFAULTDIR, "", sDefDir) + sFile = sDefDir & "\" & sFile End If - ' Se file tol, gestione aggiornamento dei dati degli utensili - If sExt = ".tol" Then - ' Recupero nome macchina - Dim sMachine As String = String.Empty - If Environment.GetCommandLineArgs.Count() > 2 Then sMachine = Environment.GetCommandLineArgs(2) - ' Recupero flag - Dim nFlag As Integer = 0 - If Environment.GetCommandLineArgs.Count() > 3 Then Integer.TryParse(Environment.GetCommandLineArgs(3), nFlag) - Dim bTest As Boolean = (nFlag = 0) - ' Esecuzione - UpdateTools(sFile, sMachine, bTest) - ' Uscita immediata - Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATIONCOMMAND) - Return - End If - ' Altrimenti gestione file standard - OpenStdFile(sFile) - End Sub + ' Ricoscimento flag + Dim nFlag As Integer = 0 + If Environment.GetCommandLineArgs.Count() > 2 Then Integer.TryParse(Environment.GetCommandLineArgs(2), nFlag) + Dim bNcGen As Boolean = (nFlag >= 1) + Dim bExit As Boolean = (nFlag >= 2) + ' Esecuzione + OpenDoorFile(sFile, bNcGen, bExit) + ' Se richiesta uscita immediata + If bExit Then Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATIONCOMMAND) + Return + End If + ' Se file tol, gestione aggiornamento dei dati degli utensili + If sExt = ".tol" Then + ' Recupero nome macchina + Dim sMachine As String = String.Empty + If Environment.GetCommandLineArgs.Count() > 2 Then sMachine = Environment.GetCommandLineArgs(2) + ' Recupero flag + Dim nFlag As Integer = 0 + If Environment.GetCommandLineArgs.Count() > 3 Then Integer.TryParse(Environment.GetCommandLineArgs(3), nFlag) + Dim bTest As Boolean = (nFlag = 0) + ' Esecuzione + UpdateTools(sFile, sMachine, bTest) + ' Uscita immediata + Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATIONCOMMAND) + Return + End If + ' Altrimenti gestione file standard + OpenStdFile(sFile) + End Sub - Friend Function OpenStdFile(sFile As String) As Boolean - Dim nFileType As Integer = EgtGetFileType(sFile) - Select Case nFileType - Case FT.NGE, FT.NFE - Return m_Controller.OpenProject(sFile, False) - Case FT.DXF, FT.STL, FT.CNC, FT.CSF, FT.BTL - Return m_Controller.ImportProject(sFile, False) - Case FT.TSC, FT.LUA - Return m_Controller.Exec(sFile, False) - End Select - Return False - End Function + Friend Function OpenStdFile(sFile As String) As Boolean + Dim nFileType As Integer = EgtGetFileType(sFile) + Select Case nFileType + Case FT.NGE, FT.NFE + Return m_Controller.OpenProject(sFile, False) + Case FT.DXF, FT.STL, FT.CNC, FT.CSF, FT.BTL + Return m_Controller.ImportProject(sFile, False) + Case FT.TSC, FT.LUA + Return m_Controller.Exec(sFile, False) + End Select + Return False + End Function - Friend Function OpenDoorFile(sFile As String, Optional bNcGen As Boolean = False, Optional bBatch As Boolean = False) As Boolean - ' Formato descrizione porte - If Path.GetExtension(sFile).ToLower() = ".ddf" Then - CreateDoors(sFile, bNcGen, bBatch) - EgtZoom(ZM.ALL) - Application.Msn.NotifyColleagues(Application.EMITTITLE) - Return True - End If - Return False - End Function + Friend Function OpenDoorFile(sFile As String, Optional bNcGen As Boolean = False, Optional bBatch As Boolean = False) As Boolean + ' Formato descrizione porte + If Path.GetExtension(sFile).ToLower() = ".ddf" Then + CreateDoors(sFile, bNcGen, bBatch) + EgtZoom(ZM.ALL) + Application.Msn.NotifyColleagues(Application.EMITTITLE) + Return True + End If + Return False + End Function - Private Sub EmitTitle() - ' nome file - Dim sTitle As String = m_Controller.GetCurrFile() - If String.IsNullOrEmpty(sTitle) Then - sTitle = EgtMsg(MSG_TOPCOMMANDBAR + 1) & IniFile.m_nInstance.ToString() - End If - ' indicazione di modificato - If m_Controller.GetModified() Then - sTitle += "*" - End If - ' dati del prodotto - sTitle += " - EgtCAM5" - ' emissione del titolo - Application.Msn.NotifyColleagues(Application.UPDATEMAINWINDOWTITLE, sTitle) - End Sub + Private Sub EmitTitle() + ' nome file + Dim sTitle As String = m_Controller.GetCurrFile() + If String.IsNullOrEmpty(sTitle) Then + sTitle = EgtMsg(MSG_TOPCOMMANDBAR + 1) & IniFile.m_nInstance.ToString() + End If + ' indicazione di modificato + If m_Controller.GetModified() Then + sTitle += "*" + End If + ' dati del prodotto + sTitle += " - EgtCAM5" + ' emissione del titolo + Application.Msn.NotifyColleagues(Application.UPDATEMAINWINDOWTITLE, sTitle) + End Sub - Private Sub LoadGridData() - IniFile.dSnapStepMm = GetPrivateProfileDouble(S_GRID, K_SNAPSTEP, 10) - IniFile.dSnapStepInch = GetPrivateProfileDouble(S_GRID, K_SNAPSTEPINCH, 10) - IniFile.nMinLineSStep = GetPrivateProfileInt(S_GRID, K_MINLINESSTEP, 1) - IniFile.nMajLineSStep = GetPrivateProfileInt(S_GRID, K_MAJLINESSTEP, 10) - IniFile.nExtSStep = GetPrivateProfileInt(S_GRID, K_EXTSSTEP, 50) - IniFile.MinLnColor = New Color3d(160, 160, 160) - GetPrivateProfileColor(S_GRID, K_MINLNCOLOR, IniFile.MinLnColor) - IniFile.MajLnColor = New Color3d(160, 160, 160) - GetPrivateProfileColor(S_GRID, K_MAJLNCOLOR, IniFile.MajLnColor) - EgtSetGridFrame(Frame3d.GLOB) - UpdateGridData() - End Sub + Private Sub LoadGridData() + IniFile.dSnapStepMm = GetPrivateProfileDouble(S_GRID, K_SNAPSTEP, 10) + IniFile.dSnapStepInch = GetPrivateProfileDouble(S_GRID, K_SNAPSTEPINCH, 10) + IniFile.nMinLineSStep = GetPrivateProfileInt(S_GRID, K_MINLINESSTEP, 1) + IniFile.nMajLineSStep = GetPrivateProfileInt(S_GRID, K_MAJLINESSTEP, 10) + IniFile.nExtSStep = GetPrivateProfileInt(S_GRID, K_EXTSSTEP, 50) + IniFile.MinLnColor = New Color3d(160, 160, 160) + GetPrivateProfileColor(S_GRID, K_MINLNCOLOR, IniFile.MinLnColor) + IniFile.MajLnColor = New Color3d(160, 160, 160) + GetPrivateProfileColor(S_GRID, K_MAJLNCOLOR, IniFile.MajLnColor) + EgtSetGridFrame(Frame3d.GLOB) + UpdateGridData() + End Sub - Private Sub UpdateGridData() - If IniFile.m_bMmUnits Then - EgtSetGridGeo(IniFile.dSnapStepMm, IniFile.nMinLineSStep, IniFile.nMajLineSStep, IniFile.nExtSStep) - Else - EgtSetGridGeo(IniFile.dSnapStepInch, IniFile.nMinLineSStep, IniFile.nMajLineSStep, IniFile.nExtSStep) - End If - EgtSetGridColor(IniFile.MinLnColor, IniFile.MajLnColor) - End Sub + Private Sub UpdateGridData() + If IniFile.m_bMmUnits Then + EgtSetGridGeo(IniFile.dSnapStepMm, IniFile.nMinLineSStep, IniFile.nMajLineSStep, IniFile.nExtSStep) + Else + EgtSetGridGeo(IniFile.dSnapStepInch, IniFile.nMinLineSStep, IniFile.nMajLineSStep, IniFile.nExtSStep) + End If + EgtSetGridColor(IniFile.MinLnColor, IniFile.MajLnColor) + End Sub - Sub RegisterDrawOptionPanelCommands() - Application.Msn.Register(Application.NOTIFYINPUTTEXT, Sub(sInputText As String) - m_InputText = sInputText - End Sub) - Application.Msn.Register(Application.SETLASTBOOLEAN, Sub(bBoolean As Boolean) - m_Controller.SetLastBoolean(bBoolean) - End Sub) - Application.Msn.Register(Application.SETLASTINTEGER, Sub(nInteger As Integer) - m_Controller.SetLastInteger(nInteger) - End Sub) - Application.Msn.Register(Application.SHOW, Sub(sString As String) - m_Controller.Show(sString) - End Sub) - Application.Msn.Register(Application.DONE, Sub(sString As String) - m_Controller.Done(sString) - End Sub) - Application.Msn.Register(Application.SAVEOBJECT, Sub(SaveObjectParam As SaveObjectParam) - m_Controller.SaveObject(SaveObjectParam.nId, SaveObjectParam.sDir, SaveObjectParam.nType) - End Sub) - End Sub - - Sub RegisterStatusBarCommands() - Application.Msn.Register(Application.STATUSCURRPOSTYPECOMMAND, Sub() - m_bCPlaneTypePos = Not m_bCPlaneTypePos - If m_bCPlaneTypePos Then - Application.Msn.NotifyColleagues(Application.STATUSCURRPOSTYPETEXT, "GRID") - Else - Application.Msn.NotifyColleagues(Application.STATUSCURRPOSTYPETEXT, "WORLD") - End If - m_ProjectScene.SetGridCursorPos(m_bCPlaneTypePos) - End Sub) - Application.Msn.Register(Application.STATUSUNITSCOMMAND, Sub() - IniFile.m_bMmUnits = Not IniFile.m_bMmUnits - Application.Msn.NotifyColleagues(Application.UPDATESTATUSUNITS, IniFile.m_bMmUnits) - UpdateGridData() - EgtDraw() - End Sub) - End Sub - - Sub RegisterControllerCommands() - Application.Msn.Register(Application.EXECUTECOMMAND, Sub(nCmd As Controller.CMD) - m_Controller.ExecuteCommand(nCmd) - End Sub) - Application.Msn.Register(Application.MANAGEMODIFIED, Sub() - Dim AllowClose = m_Controller.ManageModified() - Application.Msn.NotifyColleagues(Application.ALLOWWINDOWTOCLOSE, AllowClose) - End Sub) - End Sub - - Sub RegisterMainWindowCommands() - Application.Msn.Register(Application.LOADGRIDDATA, Sub() - LoadGridData() + Sub RegisterDrawOptionPanelCommands() + Application.Msn.Register(Application.NOTIFYINPUTTEXT, Sub(sInputText As String) + m_InputText = sInputText End Sub) - Application.Msn.Register(Application.RESETSTATUS, Sub() - m_Controller.ResetStatus() + Application.Msn.Register(Application.SETLASTBOOLEAN, Sub(bBoolean As Boolean) + m_Controller.SetLastBoolean(bBoolean) End Sub) - Application.Msn.Register(Application.EMITTITLE, Sub() - EmitTitle() + Application.Msn.Register(Application.SETLASTINTEGER, Sub(nInteger As Integer) + m_Controller.SetLastInteger(nInteger) + End Sub) + Application.Msn.Register(Application.SHOW, Sub(sString As String) + m_Controller.Show(sString) + End Sub) + Application.Msn.Register(Application.DONE, Sub(sString As String) + m_Controller.Done(sString) + End Sub) + Application.Msn.Register(Application.SAVEOBJECT, Sub(SaveObjectParam As SaveObjectParam) + m_Controller.SaveObject(SaveObjectParam.nId, SaveObjectParam.sDir, SaveObjectParam.nType) + End Sub) + End Sub + + Sub RegisterStatusBarCommands() + Application.Msn.Register(Application.STATUSCURRPOSTYPECOMMAND, Sub() + m_bCPlaneTypePos = Not m_bCPlaneTypePos + If m_bCPlaneTypePos Then + Application.Msn.NotifyColleagues(Application.STATUSCURRPOSTYPETEXT, "GRID") + Else + Application.Msn.NotifyColleagues(Application.STATUSCURRPOSTYPETEXT, "WORLD") + End If + m_ProjectScene.SetGridCursorPos(m_bCPlaneTypePos) + End Sub) + Application.Msn.Register(Application.STATUSUNITSCOMMAND, Sub() + IniFile.m_bMmUnits = Not IniFile.m_bMmUnits + Application.Msn.NotifyColleagues(Application.UPDATESTATUSUNITS, IniFile.m_bMmUnits) + UpdateGridData() + EgtDraw() + End Sub) + End Sub + + Sub RegisterControllerCommands() + Application.Msn.Register(Application.EXECUTECOMMAND, Sub(nCmd As Controller.CMD) + m_Controller.ExecuteCommand(nCmd) + End Sub) + Application.Msn.Register(Application.MANAGEMODIFIED, Sub() + Dim AllowClose = m_Controller.ManageModified() + Application.Msn.NotifyColleagues(Application.ALLOWWINDOWTOCLOSE, AllowClose) + End Sub) + End Sub + + Sub RegisterMainWindowCommands() + Application.Msn.Register(Application.LOADGRIDDATA, Sub() + LoadGridData() End Sub) - Application.Msn.Register(Application.MAINWINDOW_CONTENTRENDERED, Sub() - ProcessCommandLine() - End Sub) + Application.Msn.Register(Application.RESETSTATUS, Sub() + m_Controller.ResetStatus() + End Sub) + Application.Msn.Register(Application.EMITTITLE, Sub() + EmitTitle() + End Sub) + Application.Msn.Register(Application.MAINWINDOW_CONTENTRENDERED, Sub() + ProcessCommandLine() + End Sub) - End Sub + End Sub - Private Sub ManageTopCommandBar() - Application.Msn.Register(Application.OPENPROJECT, Sub(sFilePath As String) - If String.IsNullOrEmpty(sFilePath) Then - Dim sDir As String = String.Empty - GetPrivateProfileString(S_GENERAL, K_LASTNGEDIR, "", sDir) - m_Controller.OpenProject(sDir) - Else - m_Controller.OpenProject(sFilePath, False) - End If - Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREENOMARK, EgtGetCurrLayer()) - End Sub) + Private Sub ManageTopCommandBar() + Application.Msn.Register(Application.OPENPROJECT, Sub(sFilePath As String) + If String.IsNullOrEmpty(sFilePath) Then + Dim sDir As String = String.Empty + GetPrivateProfileString(S_GENERAL, K_LASTNGEDIR, "", sDir) + m_Controller.OpenProject(sDir) + Else + m_Controller.OpenProject(sFilePath, False) + End If + Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREENOMARK, EgtGetCurrLayer()) + End Sub) - Application.Msn.Register(Application.SAVEPROJECT, Sub() - Dim nType As NGE = DirectCast(GetPrivateProfileInt(S_GEOMDB, K_SAVETYPE, NGE.CMPTEXT), NGE) - If Not String.IsNullOrWhiteSpace(m_Controller.GetCurrFile()) Then - m_Controller.SaveProject(nType) - Else - Dim sFile As String = String.Empty - GetPrivateProfileString(S_GENERAL, K_LASTNGEDIR, "", sFile) - sFile.TrimEnd("\"c) - sFile += "\New" & IniFile.m_nInstance.ToString() & ".nge" - m_Controller.SaveAsProject(sFile, nType) - End If - End Sub) + Application.Msn.Register(Application.SAVEPROJECT, Sub() + Dim nType As NGE = DirectCast(GetPrivateProfileInt(S_GEOMDB, K_SAVETYPE, NGE.CMPTEXT), NGE) + If Not String.IsNullOrWhiteSpace(m_Controller.GetCurrFile()) Then + m_Controller.SaveProject(nType) + Else + Dim sFile As String = String.Empty + GetPrivateProfileString(S_GENERAL, K_LASTNGEDIR, "", sFile) + sFile.TrimEnd("\"c) + sFile += "\New" & IniFile.m_nInstance.ToString() & ".nge" + m_Controller.SaveAsProject(sFile, nType) + End If + End Sub) - Application.Msn.Register(Application.SAVEASPROJECT, Sub() - Dim nType As NGE = DirectCast(GetPrivateProfileInt(S_GEOMDB, K_SAVETYPE, NGE.CMPTEXT), NGE) - Dim sFile As String = m_Controller.GetCurrFile() - If String.IsNullOrWhiteSpace(sFile) Then - GetPrivateProfileString(S_GENERAL, K_LASTNGEDIR, "", sFile) - sFile.TrimEnd("\"c) - sFile += "\New" & IniFile.m_nInstance.ToString() & ".nge" - End If - m_Controller.SaveAsProject(sFile, nType) - End Sub) - - Application.Msn.Register(Application.INSERTPROJECT, Sub() - ' eseguo - Dim sDir As String = String.Empty - GetPrivateProfileString(S_GENERAL, K_LASTNGEDIR, "", sDir) - m_Controller.InsertProject(sDir) - End Sub) - - Application.Msn.Register(Application.IMPORTPROJECT, Sub() - Dim sDir As String = String.Empty - GetPrivateProfileString(S_GENERAL, K_LASTIMPDIR, "", sDir) - m_Controller.ImportProject(sDir) - Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREENOMARK, EgtGetCurrLayer()) - End Sub) - - Application.Msn.Register(Application.EXPORTPROJECT, Sub() - m_Controller.ExportProject(Path.ChangeExtension(m_Controller.GetCurrFile(), "dxf")) - End Sub) - - Application.Msn.Register(Application.PREEXECSCRIPT, Sub(bScriptInMru As Boolean) - m_bScriptInMru = bScriptInMru - End Sub) - - Application.Msn.Register(Application.EXECSCRIPT, Sub(sFilePath As String) - If String.IsNullOrEmpty(sFilePath) Then - Dim sDir As String = String.Empty - GetPrivateProfileString(S_GENERAL, K_LASTLUADIR, "", sDir) - m_Controller.Exec(sDir) - Else - m_Controller.Exec(sFilePath, False) - End If - Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREENOMARK, EgtGetCurrLayer()) - If EgtGetCurrMachGroup() <> GDB_ID.NULL Then - Application.Msn.NotifyColleagues(Application.SETMACHININGMODE) + Application.Msn.Register(Application.SAVEASPROJECT, Sub() + Dim nType As NGE = DirectCast(GetPrivateProfileInt(S_GEOMDB, K_SAVETYPE, NGE.CMPTEXT), NGE) + Dim sFile As String = m_Controller.GetCurrFile() + If String.IsNullOrWhiteSpace(sFile) Then + GetPrivateProfileString(S_GENERAL, K_LASTNGEDIR, "", sFile) + sFile.TrimEnd("\"c) + sFile += "\New" & IniFile.m_nInstance.ToString() & ".nge" End If + m_Controller.SaveAsProject(sFile, nType) End Sub) - Application.Msn.Register(Application.DOORSSCRIPT, Sub(sFilePath As String) - Dim nErr As Integer - If String.IsNullOrEmpty(sFilePath) Then - nErr = ExecDoors(m_ProjectScene, String.Empty) - Else - nErr = ExecDoors(m_ProjectScene, sFilePath) - End If - EgtResetCurrPartLayer() - OnUpdateUI(Nothing, True) - Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREENOMARK, EgtGetCurrLayer()) - IniFile.m_MruDoors.Add(IniFile.m_DDFFilePath) + Application.Msn.Register(Application.INSERTPROJECT, Sub() + ' eseguo + Dim sDir As String = String.Empty + GetPrivateProfileString(S_GENERAL, K_LASTNGEDIR, "", sDir) + m_Controller.InsertProject(sDir) + End Sub) + + Application.Msn.Register(Application.IMPORTPROJECT, Sub() + Dim sDir As String = String.Empty + GetPrivateProfileString(S_GENERAL, K_LASTIMPDIR, "", sDir) + m_Controller.ImportProject(sDir) + Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREENOMARK, EgtGetCurrLayer()) + End Sub) + + Application.Msn.Register(Application.EXPORTPROJECT, Sub() + m_Controller.ExportProject(Path.ChangeExtension(m_Controller.GetCurrFile(), "dxf")) + End Sub) + + Application.Msn.Register(Application.PREEXECSCRIPT, Sub(bScriptInMru As Boolean) + m_bScriptInMru = bScriptInMru + End Sub) + + Application.Msn.Register(Application.EXECSCRIPT, Sub(sFilePath As String) + If String.IsNullOrEmpty(sFilePath) Then + Dim sDir As String = String.Empty + GetPrivateProfileString(S_GENERAL, K_LASTLUADIR, "", sDir) + m_Controller.Exec(sDir) + Else + m_Controller.Exec(sFilePath, False) + End If + Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREENOMARK, EgtGetCurrLayer()) + If EgtGetCurrMachGroup() <> GDB_ID.NULL Then + Application.Msn.NotifyColleagues(Application.SETMACHININGMODE) + End If + End Sub) + + Application.Msn.Register(Application.DOORSSCRIPT, Sub(sFilePath As String) + Dim nErr As Integer + If String.IsNullOrEmpty(sFilePath) Then + nErr = ExecDoors(m_ProjectScene, String.Empty) + Else + nErr = ExecDoors(m_ProjectScene, sFilePath) + End If + EgtResetCurrPartLayer() + OnUpdateUI(Nothing, True) + Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREENOMARK, EgtGetCurrLayer()) + IniFile.m_MruDoors.Add(IniFile.m_DDFFilePath) + Dim sFile As String = String.Empty + If EgtGetCurrFilePath(sFile) Then IniFile.m_MruFiles.Add(sFile) + ' Segnalazione eventuali Warnings/Errors + If nErr = 999 Then + MessageBox.Show(EgtMsg(MSG_DOORSERRORS + 17), EgtMsg(MSG_DOORSERRORS + 1).ToUpper) + ElseIf nErr <> 0 Then + Try + Dim sErrFilePath As String = Path.ChangeExtension(IniFile.m_DDFFilePath, ".txt") + Dim Lines() As String = File.ReadAllLines(sErrFilePath) + Dim sErrMsg As String = String.Empty + For Index = 1 To Lines.Count - 1 + If Not String.IsNullOrWhiteSpace(Lines(Index)) Then sErrMsg &= Lines(Index) & vbCrLf + Next + If nErr > 0 Then + MessageBox.Show(sErrMsg, EgtMsg(MSG_DOORSERRORS + 1).ToUpper, MessageBoxButton.OK, MessageBoxImage.Error) + Else + MessageBox.Show(sErrMsg, EgtMsg(MSG_DOORSERRORS + 3).ToUpper, MessageBoxButton.OK, MessageBoxImage.Warning) + End If + Catch ex As Exception + MessageBox.Show(EgtMsg(MSG_DOORSERRORS + 7), EgtMsg(MSG_DOORSERRORS + 1).ToUpper) + End Try + End If + End Sub) + + Application.Msn.Register(Application.DMACHSCRIPT, Sub() + Dim bOk As Boolean = ExecDoorsMachining(m_ProjectScene) + OnUpdateUI(Nothing, True) + If EgtGetCurrMachGroup() <> GDB_ID.NULL Then + Application.Msn.NotifyColleagues(Application.SETMACHININGMODE) + End If + If Not bOk Then Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, EgtMsg(MSG_DOORSERRORS + 2)) + End Sub) + + Application.Msn.Register(Application.GUNSTOCKNEW, Sub(sFilePath As String) + Dim bOk As Boolean + If String.IsNullOrEmpty(sFilePath) Then + bOk = ExecGunStockMod(m_ProjectScene, String.Empty) + Else + bOk = ExecGunStockMod(m_ProjectScene, sFilePath) + End If + EgtResetCurrPartLayer() + OnUpdateUI(Nothing, True) + Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREENOMARK, EgtGetCurrLayer()) + If EgtGetCurrMachGroup() <> GDB_ID.NULL Then + Application.Msn.NotifyColleagues(Application.SETMACHININGMODE) + End If + If bOk Then + IniFile.m_MruNewGunStock.Add(IniFile.m_MODFilePath) + IniFile.m_MruModifyGunStock.Add(IniFile.m_PEZFilePath) Dim sFile As String = String.Empty - If EgtGetCurrFilePath(sFile) Then IniFile.m_MruFiles.Add(sFile) - ' Segnalazione eventuali Warnings/Errors - If nErr = 999 Then - MessageBox.Show(EgtMsg(MSG_DOORSERRORS + 17), EgtMsg(MSG_DOORSERRORS + 1).ToUpper) - ElseIf nErr <> 0 Then + If EgtGetCurrFilePath(sFile) Then + IniFile.m_MruFiles.Add(sFile) + End If + Else + IniFile.m_MruNewGunStock.Remove(IniFile.m_MODFilePath) + If Not String.IsNullOrEmpty(IniFile.m_PEZFilePath) Then Try - Dim sErrFilePath As String = Path.ChangeExtension(IniFile.m_DDFFilePath, ".txt") + Dim sErrFilePath As String = Path.ChangeExtension(IniFile.m_PEZFilePath, ".txt") Dim Lines() As String = File.ReadAllLines(sErrFilePath) + Dim values() As String = Lines(0).Split("="c).ToArray + Lines(0) = EgtMsg(MSG_DOORSERRORS + 1) & " " & Convert.ToInt32(values(1)) Dim sErrMsg As String = String.Empty For Index = 1 To Lines.Count - 1 If Not String.IsNullOrWhiteSpace(Lines(Index)) Then sErrMsg &= Lines(Index) & vbCrLf Next - If nErr > 0 Then - MessageBox.Show(sErrMsg, EgtMsg(MSG_DOORSERRORS + 1).ToUpper, MessageBoxButton.OK, MessageBoxImage.Error) - Else - MessageBox.Show(sErrMsg, EgtMsg(MSG_DOORSERRORS + 3).ToUpper, MessageBoxButton.OK, MessageBoxImage.Warning) - End If + MessageBox.Show(sErrMsg, Lines(0).ToUpper, MessageBoxButton.OK, MessageBoxImage.Error) Catch ex As Exception - MessageBox.Show(EgtMsg(MSG_DOORSERRORS + 7), EgtMsg(MSG_DOORSERRORS + 1).ToUpper) + MessageBox.Show(EgtMsg(MSG_DOORSERRORS + 7)) End Try End If - End Sub) + End If + End Sub) - Application.Msn.Register(Application.DMACHSCRIPT, Sub() - Dim bOk As Boolean = ExecDoorsMachining(m_ProjectScene) - OnUpdateUI(Nothing, True) - If EgtGetCurrMachGroup() <> GDB_ID.NULL Then - Application.Msn.NotifyColleagues(Application.SETMACHININGMODE) - End If - If Not bOk Then Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, EgtMsg(MSG_DOORSERRORS + 2)) - End Sub) - - Application.Msn.Register(Application.GUNSTOCKNEW, Sub(sFilePath As String) - Dim bOk As Boolean - If String.IsNullOrEmpty(sFilePath) Then - bOk = ExecGunStockMod(m_ProjectScene, String.Empty) - Else - bOk = ExecGunStockMod(m_ProjectScene, sFilePath) - End If - EgtResetCurrPartLayer() - OnUpdateUI(Nothing, True) - Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREENOMARK, EgtGetCurrLayer()) - If EgtGetCurrMachGroup() <> GDB_ID.NULL Then - Application.Msn.NotifyColleagues(Application.SETMACHININGMODE) - End If - If bOk Then - IniFile.m_MruNewGunStock.Add(IniFile.m_MODFilePath) - IniFile.m_MruModifyGunStock.Add(IniFile.m_PEZFilePath) - Dim sFile As String = String.Empty - If EgtGetCurrFilePath(sFile) Then - IniFile.m_MruFiles.Add(sFile) - End If - Else - IniFile.m_MruNewGunStock.Remove(IniFile.m_MODFilePath) - If Not String.IsNullOrEmpty(IniFile.m_PEZFilePath) Then - Try - Dim sErrFilePath As String = Path.ChangeExtension(IniFile.m_PEZFilePath, ".txt") - Dim Lines() As String = File.ReadAllLines(sErrFilePath) - Dim values() As String = Lines(0).Split("="c).ToArray - Lines(0) = EgtMsg(MSG_DOORSERRORS + 1) & " " & Convert.ToInt32(values(1)) - Dim sErrMsg As String = String.Empty - For Index = 1 To Lines.Count - 1 - If Not String.IsNullOrWhiteSpace(Lines(Index)) Then sErrMsg &= Lines(Index) & vbCrLf - Next - MessageBox.Show(sErrMsg, Lines(0).ToUpper, MessageBoxButton.OK, MessageBoxImage.Error) - Catch ex As Exception - MessageBox.Show(EgtMsg(MSG_DOORSERRORS + 7)) - End Try - End If - End If - End Sub) - - Application.Msn.Register(Application.GUNSTOCKMODIF, Sub(sFilePath As String) - Dim bOk As Boolean - If String.IsNullOrEmpty(sFilePath) Then - bOk = ExecGunStockPez(m_ProjectScene, String.Empty) - Else - bOk = ExecGunStockPez(m_ProjectScene, sFilePath) + Application.Msn.Register(Application.GUNSTOCKMODIF, Sub(sFilePath As String) + Dim bOk As Boolean + If String.IsNullOrEmpty(sFilePath) Then + bOk = ExecGunStockPez(m_ProjectScene, String.Empty) + Else + bOk = ExecGunStockPez(m_ProjectScene, sFilePath) + End If + EgtResetCurrPartLayer() + OnUpdateUI(Nothing, True) + Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREENOMARK, EgtGetCurrLayer()) + If EgtGetCurrMachGroup() <> GDB_ID.NULL Then + Application.Msn.NotifyColleagues(Application.SETMACHININGMODE) + End If + If bOk Then + IniFile.m_MruModifyGunStock.Add(IniFile.m_PEZFilePath) + Dim sFile As String = String.Empty + If EgtGetCurrFilePath(sFile) Then + IniFile.m_MruFiles.Add(sFile) End If - EgtResetCurrPartLayer() - OnUpdateUI(Nothing, True) - Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREENOMARK, EgtGetCurrLayer()) - If EgtGetCurrMachGroup() <> GDB_ID.NULL Then - Application.Msn.NotifyColleagues(Application.SETMACHININGMODE) - End If - If bOk Then - IniFile.m_MruModifyGunStock.Add(IniFile.m_PEZFilePath) - Dim sFile As String = String.Empty - If EgtGetCurrFilePath(sFile) Then - IniFile.m_MruFiles.Add(sFile) - End If - Else - IniFile.m_MruModifyGunStock.Remove(IniFile.m_PEZFilePath) - Try - Dim sErrFilePath As String = Path.ChangeExtension(IniFile.m_PEZFilePath, ".txt") - Dim Lines() As String = File.ReadAllLines(sErrFilePath) - Dim values() As String = Lines(0).Split("="c) - Lines(0) = EgtMsg(MSG_DOORSERRORS + 1) & " " & Convert.ToInt32(values(1)) - Dim sErrMsg As String = String.Empty - For Index = 1 To Lines.Count - 1 - If Not String.IsNullOrWhiteSpace(Lines(Index)) Then sErrMsg &= Lines(Index) & vbCrLf - Next - MessageBox.Show(sErrMsg, Lines(0).ToUpper, MessageBoxButton.OK, MessageBoxImage.Error) - Catch ex As Exception - MessageBox.Show(EgtMsg(MSG_DOORSERRORS + 7)) - End Try + Else + IniFile.m_MruModifyGunStock.Remove(IniFile.m_PEZFilePath) + Try + Dim sErrFilePath As String = Path.ChangeExtension(IniFile.m_PEZFilePath, ".txt") + Dim Lines() As String = File.ReadAllLines(sErrFilePath) + Dim values() As String = Lines(0).Split("="c) + Lines(0) = EgtMsg(MSG_DOORSERRORS + 1) & " " & Convert.ToInt32(values(1)) + Dim sErrMsg As String = String.Empty + For Index = 1 To Lines.Count - 1 + If Not String.IsNullOrWhiteSpace(Lines(Index)) Then sErrMsg &= Lines(Index) & vbCrLf + Next + MessageBox.Show(sErrMsg, Lines(0).ToUpper, MessageBoxButton.OK, MessageBoxImage.Error) + Catch ex As Exception + MessageBox.Show(EgtMsg(MSG_DOORSERRORS + 7)) + End Try + End If + End Sub) + + End Sub + + Private Sub ManageClosingApplication() + Application.Msn.Register(Application.CLOSEAPPLICATION, Sub() + If Not IniFile.m_bFailedRun Then + ' Salvo modo di visualizzazione + WritePrivateProfileString(S_SCENE, K_SHOWMODE, EgtGetShowMode().ToString) + ' Salvo stato visualizzazione direzione curve + WritePrivateProfileString(S_SCENE, K_CURVEDIR, If(EgtGetShowCurveDirection(), 1, 0).ToString) + ' Salvo stato visualizzazione griglia + WritePrivateProfileString(S_GRID, K_DRAWSHOWGRID, If(IniFile.m_bDrawShowGrid, 1, 0).ToString) + WritePrivateProfileString(S_GRID, K_MACHININGSHOWGRID, If(IniFile.m_bMachiningShowGrid, 1, 0).ToString) + ' Salvo stato unità di misura per interfaccia utente + WritePrivateProfileString(S_SCENE, K_MMUNITS, If(IniFile.m_bMmUnits, 1, 0).ToString) + ' Salvo dimensioni griglie in Mm e Inch + WritePrivateProfileString(S_GRID, K_SNAPSTEP, DoubleToString(IniFile.dSnapStepMm, 4)) + WritePrivateProfileString(S_GRID, K_SNAPSTEPINCH, DoubleToString(IniFile.dSnapStepInch, 4)) End If End Sub) - End Sub - - Private Sub ManageClosingApplication() - Application.Msn.Register(Application.CLOSEAPPLICATION, Sub() - If Not IniFile.m_bFailedRun Then - ' Salvo modo di visualizzazione - WritePrivateProfileString(S_SCENE, K_SHOWMODE, EgtGetShowMode().ToString) - ' Salvo stato visualizzazione direzione curve - WritePrivateProfileString(S_SCENE, K_CURVEDIR, If(EgtGetShowCurveDirection(), 1, 0).ToString) - ' Salvo stato visualizzazione griglia - WritePrivateProfileString(S_GRID, K_DRAWSHOWGRID, If(IniFile.m_bDrawShowGrid, 1, 0).ToString) - WritePrivateProfileString(S_GRID, K_MACHININGSHOWGRID, If(IniFile.m_bMachiningShowGrid, 1, 0).ToString) - ' Salvo stato unità di misura per interfaccia utente - WritePrivateProfileString(S_SCENE, K_MMUNITS, If(IniFile.m_bMmUnits, 1, 0).ToString) - ' Salvo dimensioni griglie in Mm e Inch - WritePrivateProfileString(S_GRID, K_SNAPSTEP, DoubleToString(IniFile.dSnapStepMm, 4)) - WritePrivateProfileString(S_GRID, K_SNAPSTEPINCH, DoubleToString(IniFile.dSnapStepInch, 4)) - End If - End Sub) - - End Sub + End Sub #End Region #Region "SCENE EVENTS" - Private Sub OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String) Handles m_ProjectScene.OnCursorPos - Application.Msn.NotifyColleagues(Application.NOTIFYCURRPOS, sCursorPos) - End Sub + Private Sub OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String) Handles m_ProjectScene.OnCursorPos + Application.Msn.NotifyColleagues(Application.NOTIFYCURRPOS, sCursorPos) + End Sub - Private Sub OnMouseSetObjFilterForSelect(sender As Object, bZeroDim As Boolean, bCurve As Boolean, - bSurf As Boolean, bVolume As Boolean, bExtra As Boolean) Handles m_ProjectScene.OnMouseSetObjFilterForSelect - m_Controller.MouseSetObjFilterForSelect(bZeroDim, bCurve, bSurf, bVolume, bExtra) - End Sub + Private Sub OnMouseSetObjFilterForSelect(sender As Object, bZeroDim As Boolean, bCurve As Boolean, + bSurf As Boolean, bVolume As Boolean, bExtra As Boolean) Handles m_ProjectScene.OnMouseSetObjFilterForSelect + m_Controller.MouseSetObjFilterForSelect(bZeroDim, bCurve, bSurf, bVolume, bExtra) + End Sub - Private Sub OnMouseSelectedAll(ByVal sender As Object) Handles m_ProjectScene.OnMouseSelectedAll - ' Se in modalità Draw seleziono tutto - If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then - m_Controller.MouseSelectedAll() + Private Sub OnMouseSelectedAll(ByVal sender As Object) Handles m_ProjectScene.OnMouseSelectedAll + ' Se in modalità Draw seleziono tutto + If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then + m_Controller.MouseSelectedAll() + Return + End If + ' Sono in modalità Machining, se la modalità di selezione è NULL non seleziono nulla ed esco + If m_SceneSelMode = SceneSelModeOpt.NULL Then Return + Select Case m_SceneSelType + Case SceneSelTypeOpt.MACHINING + ' Cerco i pezzi all'interno dei grezzi + Dim nRawPart As Integer = EgtGetFirstRawPart() + While nRawPart <> GDB_ID.NULL + Dim nPart As Integer = EgtGetFirstPartInRawPart(nRawPart) + While nPart <> GDB_ID.NULL + Dim nLayer As Integer = EgtGetFirstGroupInGroup(nPart) + While nLayer <> GDB_ID.NULL + Dim nObj As Integer = EgtGetFirstInGroup(nLayer) + While nObj <> GDB_ID.NULL + EgtSelectObj(nObj) + nObj = EgtGetNext(nObj) + End While + nLayer = EgtGetNextGroup(nLayer) + End While + nPart = EgtGetNextPartInRawPart(nPart) + End While + nRawPart = EgtGetNextRawPart(nRawPart) + End While + Case SceneSelTypeOpt.FIXTURE + Dim nFixtureId As Integer = EgtGetFirstFixture() + While nFixtureId <> GDB_ID.NULL + EgtSelectObj(nFixtureId) + nFixtureId = EgtGetNextFixture(nFixtureId) + End While + Dim SelCount As Integer = EgtGetSelectedObjCount() + If SelCount > 1 Then + EgtSetMark(EgtGetFirstSelectedObj) + End If + Case SceneSelTypeOpt.RAWPART + Dim nRawPartId As Integer = EgtGetFirstRawPart() + While nRawPartId <> GDB_ID.NULL + If EgtVerifyRawPartCurrPhase(nRawPartId) Then + EgtSelectObj(nRawPartId) + End If + nRawPartId = EgtGetNextRawPart(nRawPartId) + End While + Dim SelCount As Integer = EgtGetSelectedObjCount() + If SelCount > 1 Then + EgtSetMark(EgtGetFirstSelectedObj) + End If + Case SceneSelTypeOpt.RAWPARTWITHFIXTURE + Dim nRawPartCount As Integer = 0 + Dim nRawPartId As Integer = EgtGetFirstRawPart() + While nRawPartId <> GDB_ID.NULL + If EgtVerifyRawPartCurrPhase(nRawPartId) Then + nRawPartCount += 1 + EgtSelectObj(nRawPartId) + DispositionUtility.SelectRawPartFixture(nRawPartId) + End If + nRawPartId = EgtGetNextRawPart(nRawPartId) + End While + If nRawPartCount > 1 Then + EgtSetMark(EgtGetFirstSelectedObj) + End If + End Select + EgtDraw() + End Sub + + Private Sub OnMouseDeselectedAll(ByVal sender As Object) Handles m_ProjectScene.OnMouseDeselectedAll + ' Se in modalità Draw seleziono tutto + If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then + m_Controller.MouseDeselectedAll() + Return + End If + ' Sono in modalità Machining, se la modalità di selezione è NULL non seleziono nulla ed esco + If m_SceneSelMode = SceneSelModeOpt.NULL Then Return + ' Se sono in lavorazione + If IniFile.m_ProjectMode = ProjectModeOpt.MACHINING Then + If (m_SceneSelType = SceneSelTypeOpt.RAWPART OrElse m_SceneSelType = SceneSelTypeOpt.FIXTURE OrElse m_SceneSelType = SceneSelTypeOpt.RAWPARTWITHFIXTURE) Then + EgtResetMark(EgtGetFirstSelectedObj()) + ElseIf m_SceneSelType = SceneSelTypeOpt.NULL Then Return End If - ' Sono in modalità Machining, se la modalità di selezione è NULL non seleziono nulla ed esco - If m_SceneSelMode = SceneSelModeOpt.NULL Then Return + End If + ' deseleziono tutto + m_Controller.MouseDeselectedAll() + End Sub + + ' Identificativi per elemento da selezionare/deselezionare + Private m_nIdToSel As Integer = GDB_ID.NULL + Private m_nIdToDesel As Integer = GDB_ID.NULL + 'Private m_nFirstRawPartId As Integer = GDB_ID.NULL + + ' Dati per Drag + Private m_nRestRadius As Integer = 3 + Private m_bDrag As Boolean = False + Private m_bDragToStart As Boolean = False + Private m_bDragging As Boolean = False + Private m_locPrev As System.Drawing.Point + Private m_ptPrev As Point3d + + Private Sub OnMouseDown(ByVal sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_ProjectScene.OnMouseDownScene + ' Se in modalità Draw accetto tutto + If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then Return + ' Sono in modalità Machining + ' se non posso selezionare nulla o in lavorazione esco + If m_SceneSelType = SceneSelTypeOpt.NULL OrElse m_SceneSelType = SceneSelTypeOpt.MACHINING Then Return + ' Si può selezionare solo con il tasto sinistro + If e.Button <> Forms.MouseButtons.Left Then Return + ' Per default no drag + m_bDrag = False + Dim nSel As Integer + EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSel) + Dim nId As Integer = EgtGetFirstObjInSelWin() + While nId <> GDB_ID.NULL Select Case m_SceneSelType - Case SceneSelTypeOpt.MACHINING - ' Cerco i pezzi all'interno dei grezzi - Dim nRawPart As Integer = EgtGetFirstRawPart() - While nRawPart <> GDB_ID.NULL - Dim nPart As Integer = EgtGetFirstPartInRawPart(nRawPart) - While nPart <> GDB_ID.NULL - Dim nLayer As Integer = EgtGetFirstGroupInGroup(nPart) - While nLayer <> GDB_ID.NULL - Dim nObj As Integer = EgtGetFirstInGroup(nLayer) - While nObj <> GDB_ID.NULL - EgtSelectObj(nObj) - nObj = EgtGetNext(nObj) - End While - nLayer = EgtGetNextGroup(nLayer) - End While - nPart = EgtGetNextPartInRawPart(nPart) - End While - nRawPart = EgtGetNextRawPart(nRawPart) - End While Case SceneSelTypeOpt.FIXTURE - Dim nFixtureId As Integer = EgtGetFirstFixture() - While nFixtureId <> GDB_ID.NULL - EgtSelectObj(nFixtureId) - nFixtureId = EgtGetNextFixture(nFixtureId) - End While - Dim SelCount As Integer = EgtGetSelectedObjCount() - If SelCount > 1 Then - EgtSetMark(EgtGetFirstSelectedObj) - End If - Case SceneSelTypeOpt.RAWPART - Dim nRawPartId As Integer = EgtGetFirstRawPart() - While nRawPartId <> GDB_ID.NULL - If EgtVerifyRawPartCurrPhase(nRawPartId) Then - EgtSelectObj(nRawPartId) + Dim nFixtureId As Integer = EgtGetParent(EgtGetParent(nId)) + If EgtVerifyFixture(nFixtureId) Then + ' Se già selezionato + If EgtIsSelectedObj(nFixtureId) Then + ' Memorizzo Id da deselezionare + m_nIdToDesel = nFixtureId + Else + ' Memorizzo Id da selezionare + m_nIdToSel = nFixtureId End If - nRawPartId = EgtGetNextRawPart(nRawPartId) - End While - Dim SelCount As Integer = EgtGetSelectedObjCount() - If SelCount > 1 Then - EgtSetMark(EgtGetFirstSelectedObj) + ' Drag possibile + m_bDrag = True + Exit While End If - Case SceneSelTypeOpt.RAWPARTWITHFIXTURE - Dim nRawPartCount As Integer = 0 - Dim nRawPartId As Integer = EgtGetFirstRawPart() - While nRawPartId <> GDB_ID.NULL - If EgtVerifyRawPartCurrPhase(nRawPartId) Then - nRawPartCount += 1 - EgtSelectObj(nRawPartId) - DispositionUtility.SelectRawPartFixture(nRawPartId) + Case SceneSelTypeOpt.RAWPART, SceneSelTypeOpt.RAWPARTWITHFIXTURE + Dim nRawPartId As Integer = EgtGetParent(nId) + If EgtVerifyRawPartCurrPhase(nRawPartId) Then + ' Se già selezionato + If EgtIsSelectedObj(nRawPartId) Then + ' Memorizzo Id da deselezionare + m_nIdToDesel = nRawPartId + Else + ' Memorizzo Id da selezionare + m_nIdToSel = nRawPartId End If - nRawPartId = EgtGetNextRawPart(nRawPartId) - End While - If nRawPartCount > 1 Then - EgtSetMark(EgtGetFirstSelectedObj) + ' Drag possibile + m_bDrag = True + Exit While End If End Select - EgtDraw() - End Sub + nId = EgtGetNextObjInSelWin() + End While + ' Dati per drag + m_locPrev = e.Location + Dim TableRef As Point3d + EgtGetTableRef(1, TableRef) + m_bDrag = m_bDrag AndAlso EgtGetPlaneSnapPoint(e.Location, Vector3d.Z_AX, TableRef.z, m_ptPrev) + m_bDragToStart = m_bDrag + End Sub - Private Sub OnMouseDeselectedAll(ByVal sender As Object) Handles m_ProjectScene.OnMouseDeselectedAll - ' Se in modalità Draw seleziono tutto - If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then - m_Controller.MouseDeselectedAll() + Private Sub OnMyMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_ProjectScene.OnMouseMoveScene + ' Se in modalità Draw esco + If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then + Return + End If + ' Sono in modalità Machining + ' Si può selezionare solo con il tasto sinistro se la selezione non è impostata a NULL + If e.Button <> Forms.MouseButtons.Left OrElse m_SceneSelType = SceneSelTypeOpt.NULL Then Return + ' se non sono in modalità muovi esco + If Not m_bMoveInDisposition Then Return + ' Se drag non abilitato o già in esecuzione, esco + If Not m_bDrag Or m_bDragging Then Return + ' Se primo movimento di drag, verifico di aver superato la soglia di movimento in pixel + If m_bDragToStart Then + If Math.Abs(e.Location.X - m_locPrev.X) < m_nRestRadius And + Math.Abs(e.Location.Y - m_locPrev.Y) < m_nRestRadius Then Return End If - ' Sono in modalità Machining, se la modalità di selezione è NULL non seleziono nulla ed esco - If m_SceneSelMode = SceneSelModeOpt.NULL Then Return - ' Se sono in lavorazione - If IniFile.m_ProjectMode = ProjectModeOpt.MACHINING Then - If (m_SceneSelType = SceneSelTypeOpt.RAWPART OrElse m_SceneSelType = SceneSelTypeOpt.FIXTURE OrElse m_SceneSelType = SceneSelTypeOpt.RAWPARTWITHFIXTURE) Then - EgtResetMark(EgtGetFirstSelectedObj()) - ElseIf m_SceneSelType = SceneSelTypeOpt.NULL Then + m_bDragToStart = False + End If + ' Determino cosa muovere + Dim nMoveId = If(m_nIdToSel <> GDB_ID.NULL, m_nIdToSel, GDB_ID.SEL) + ' Inizio esecuzione di drag + m_bDragging = True + ' Ricavo il punto corrente in coordinate mondo + Dim ptCurr As Point3d + Dim TableRef As Point3d + EgtGetTableRef(1, TableRef) + EgtGetPlaneSnapPoint(e.Location, Vector3d.Z_AX, TableRef.z, ptCurr) + ' Ricavo il vettore di movimento (tengo solo XY) + Dim vtMove As Vector3d = ptCurr - m_ptPrev + vtMove.z = 0 + ' Muovo gli oggetti selezionati se consentito + DispositionUtility.MoveRawPartPartAndFixture(nMoveId, vtMove) + EgtDraw() + ' Aggiorno il punto precedente + m_ptPrev = ptCurr + ' Terminata esecuzione di drag + m_bDragging = False + End Sub + + Private Sub OnMyMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_ProjectScene.OnMouseUpScene + ' Se in modalità Draw esco + If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then + Return + End If + ' Sono in modalità Machining + ' Se eseguito drag + If Not m_bDragToStart Then + ' Basta reset alla fine + ' Se selezione da eseguire + ElseIf m_nIdToSel <> GDB_ID.NULL Then + ' se sono in modalità sottopezzi + If m_SceneSelType = SceneSelTypeOpt.FIXTURE Then + ' verifico se il sottopezzo da selezionare è un riferimento + If DispositionUtility.FixtureType(m_nIdToSel) = DispositionUtility.FIX_TYPE.REFERENCE _ + AndAlso EgtGetSelectedObjCount() > 0 Then + ' se ci sono altri oggetti selezionati resetto lo stato di selezione ed esco + m_bDrag = False + m_nIdToSel = GDB_ID.NULL + m_nIdToDesel = GDB_ID.NULL + EgtDraw() Return - End If - End If - ' deseleziono tutto - m_Controller.MouseDeselectedAll() - End Sub - - ' Identificativi per elemento da selezionare/deselezionare - Private m_nIdToSel As Integer = GDB_ID.NULL - Private m_nIdToDesel As Integer = GDB_ID.NULL - 'Private m_nFirstRawPartId As Integer = GDB_ID.NULL - - ' Dati per Drag - Private m_nRestRadius As Integer = 3 - Private m_bDrag As Boolean = False - Private m_bDragToStart As Boolean = False - Private m_bDragging As Boolean = False - Private m_locPrev As System.Drawing.Point - Private m_ptPrev As Point3d - - Private Sub OnMouseDown(ByVal sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_ProjectScene.OnMouseDownScene - ' Se in modalità Draw accetto tutto - If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then Return - ' Sono in modalità Machining - ' se non posso selezionare nulla o in lavorazione esco - If m_SceneSelType = SceneSelTypeOpt.NULL OrElse m_SceneSelType = SceneSelTypeOpt.MACHINING Then Return - ' Si può selezionare solo con il tasto sinistro - If e.Button <> Forms.MouseButtons.Left Then Return - ' Per default no drag - m_bDrag = False - Dim nSel As Integer - EgtSelect(e.Location, Scene.DIM_SEL, Scene.DIM_SEL, nSel) - Dim nId As Integer = EgtGetFirstObjInSelWin() - While nId <> GDB_ID.NULL - Select Case m_SceneSelType - Case SceneSelTypeOpt.FIXTURE - Dim nFixtureId As Integer = EgtGetParent(EgtGetParent(nId)) - If EgtVerifyFixture(nFixtureId) Then - ' Se già selezionato - If EgtIsSelectedObj(nFixtureId) Then - ' Memorizzo Id da deselezionare - m_nIdToDesel = nFixtureId - Else - ' Memorizzo Id da selezionare - m_nIdToSel = nFixtureId - End If - ' Drag possibile - m_bDrag = True - Exit While - End If - Case SceneSelTypeOpt.RAWPART, SceneSelTypeOpt.RAWPARTWITHFIXTURE - Dim nRawPartId As Integer = EgtGetParent(nId) - If EgtVerifyRawPartCurrPhase(nRawPartId) Then - ' Se già selezionato - If EgtIsSelectedObj(nRawPartId) Then - ' Memorizzo Id da deselezionare - m_nIdToDesel = nRawPartId - Else - ' Memorizzo Id da selezionare - m_nIdToSel = nRawPartId - End If - ' Drag possibile - m_bDrag = True - Exit While - End If - End Select - nId = EgtGetNextObjInSelWin() - End While - ' Dati per drag - m_locPrev = e.Location - Dim TableRef As Point3d - EgtGetTableRef(1, TableRef) - m_bDrag = m_bDrag AndAlso EgtGetPlaneSnapPoint(e.Location, Vector3d.Z_AX, TableRef.z, m_ptPrev) - m_bDragToStart = m_bDrag - End Sub - - Private Sub OnMyMouseMoveScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_ProjectScene.OnMouseMoveScene - ' Se in modalità Draw esco - If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then - Return - End If - ' Sono in modalità Machining - ' Si può selezionare solo con il tasto sinistro se la selezione non è impostata a NULL - If e.Button <> Forms.MouseButtons.Left OrElse m_SceneSelType = SceneSelTypeOpt.NULL Then Return - ' se non sono in modalità muovi esco - If Not m_bMoveInDisposition Then Return - ' Se drag non abilitato o già in esecuzione, esco - If Not m_bDrag Or m_bDragging Then Return - ' Se primo movimento di drag, verifico di aver superato la soglia di movimento in pixel - If m_bDragToStart Then - If Math.Abs(e.Location.X - m_locPrev.X) < m_nRestRadius And - Math.Abs(e.Location.Y - m_locPrev.Y) < m_nRestRadius Then - Return - End If - m_bDragToStart = False - End If - ' Determino cosa muovere - Dim nMoveId = If(m_nIdToSel <> GDB_ID.NULL, m_nIdToSel, GDB_ID.SEL) - ' Inizio esecuzione di drag - m_bDragging = True - ' Ricavo il punto corrente in coordinate mondo - Dim ptCurr As Point3d - Dim TableRef As Point3d - EgtGetTableRef(1, TableRef) - EgtGetPlaneSnapPoint(e.Location, Vector3d.Z_AX, TableRef.z, ptCurr) - ' Ricavo il vettore di movimento (tengo solo XY) - Dim vtMove As Vector3d = ptCurr - m_ptPrev - vtMove.z = 0 - ' Muovo gli oggetti selezionati se consentito - DispositionUtility.MoveRawPartPartAndFixture(nMoveId, vtMove) - EgtDraw() - ' Aggiorno il punto precedente - m_ptPrev = ptCurr - ' Terminata esecuzione di drag - m_bDragging = False - End Sub - - Private Sub OnMyMouseUpScene(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles m_ProjectScene.OnMouseUpScene - ' Se in modalità Draw esco - If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then - Return - End If - ' Sono in modalità Machining - ' Se eseguito drag - If Not m_bDragToStart Then - ' Basta reset alla fine - ' Se selezione da eseguire - ElseIf m_nIdToSel <> GDB_ID.NULL Then - ' se sono in modalità sottopezzi - If m_SceneSelType = SceneSelTypeOpt.FIXTURE Then - ' verifico se il sottopezzo da selezionare è un riferimento - If DispositionUtility.FixtureType(m_nIdToSel) = DispositionUtility.FIX_TYPE.REFERENCE _ - AndAlso EgtGetSelectedObjCount() > 0 Then - ' se ci sono altri oggetti selezionati resetto lo stato di selezione ed esco + Else + ' altrimenti verifico il tipo del primo oggetto selezionato + Dim nFirstSelId As Integer = EgtGetFirstSelectedObj() + If DispositionUtility.FixtureType(nFirstSelId) = DispositionUtility.FIX_TYPE.REFERENCE Then + ' se è un riferimento resetto lo stato di selezione ed esco m_bDrag = False m_nIdToSel = GDB_ID.NULL m_nIdToDesel = GDB_ID.NULL EgtDraw() Return - Else - ' altrimenti verifico il tipo del primo oggetto selezionato - Dim nFirstSelId As Integer = EgtGetFirstSelectedObj() - If DispositionUtility.FixtureType(nFirstSelId) = DispositionUtility.FIX_TYPE.REFERENCE Then - ' se è un riferimento resetto lo stato di selezione ed esco - m_bDrag = False - m_nIdToSel = GDB_ID.NULL - m_nIdToDesel = GDB_ID.NULL - EgtDraw() - Return - End If End If End If - ' marco il primo elemento se questo è il secondo - If EgtGetSelectedObjCount() = 1 Then - ' marco il primo tra i selezionati - Dim nFirstSelObj As Integer = EgtGetFirstSelectedObj() - EgtSetMark(nFirstSelObj) - End If - ' se sono in modalità grezzo con relativi sottopezzi - If m_SceneSelType = SceneSelTypeOpt.RAWPARTWITHFIXTURE Then - ' seleziono tutti i sottopezzi sotto il grezzo da selezionare - DispositionUtility.SelectRawPartFixture(m_nIdToSel) - End If - ' Eseguo la selezione - EgtSelectObj(m_nIdToSel) - ' Se deselezione da eseguire - ElseIf m_nIdToDesel <> GDB_ID.NULL Then - ' se l'elemento da deselezionare è marcato - Dim bMarked As Boolean = False - EgtGetMark(m_nIdToDesel, bMarked) - If bMarked Then - ' smarco l'oggetto deselezionato - EgtResetMark(m_nIdToDesel) - End If - ' se sono in modalità ventose o grezzi - If m_SceneSelType = SceneSelTypeOpt.RAWPARTWITHFIXTURE Then - ' deseleziono tutti i sottopezzi sotto il grezzo da deselezionare - DispositionUtility.DeselectRawPartFixture(m_nIdToDesel) - End If - ' Eseguo la deselezione - EgtDeselectObj(m_nIdToDesel) - If EgtGetSelectedObjCount() > 1 Then - ' marco il primo - Dim nFirstSelObj As Integer = EgtGetFirstSelectedObj() - EgtSetMark(nFirstSelObj) - Else - ' smarco il primo ed unico oggetto selezionato - Dim nFirstSelObj As Integer = EgtGetFirstSelectedObj() - EgtResetMark(nFirstSelObj) - End If End If - ' Reset - m_bDrag = False - m_nIdToSel = GDB_ID.NULL - m_nIdToDesel = GDB_ID.NULL - EgtDraw() - End Sub + ' marco il primo elemento se questo è il secondo + If EgtGetSelectedObjCount() = 1 Then + ' marco il primo tra i selezionati + Dim nFirstSelObj As Integer = EgtGetFirstSelectedObj() + EgtSetMark(nFirstSelObj) + End If + ' se sono in modalità grezzo con relativi sottopezzi + If m_SceneSelType = SceneSelTypeOpt.RAWPARTWITHFIXTURE Then + ' seleziono tutti i sottopezzi sotto il grezzo da selezionare + DispositionUtility.SelectRawPartFixture(m_nIdToSel) + End If + ' Eseguo la selezione + EgtSelectObj(m_nIdToSel) + ' Se deselezione da eseguire + ElseIf m_nIdToDesel <> GDB_ID.NULL Then + ' se l'elemento da deselezionare è marcato + Dim bMarked As Boolean = False + EgtGetMark(m_nIdToDesel, bMarked) + If bMarked Then + ' smarco l'oggetto deselezionato + EgtResetMark(m_nIdToDesel) + End If + ' se sono in modalità ventose o grezzi + If m_SceneSelType = SceneSelTypeOpt.RAWPARTWITHFIXTURE Then + ' deseleziono tutti i sottopezzi sotto il grezzo da deselezionare + DispositionUtility.DeselectRawPartFixture(m_nIdToDesel) + End If + ' Eseguo la deselezione + EgtDeselectObj(m_nIdToDesel) + If EgtGetSelectedObjCount() > 1 Then + ' marco il primo + Dim nFirstSelObj As Integer = EgtGetFirstSelectedObj() + EgtSetMark(nFirstSelObj) + Else + ' smarco il primo ed unico oggetto selezionato + Dim nFirstSelObj As Integer = EgtGetFirstSelectedObj() + EgtResetMark(nFirstSelObj) + End If + End If + ' Reset + m_bDrag = False + m_nIdToSel = GDB_ID.NULL + m_nIdToDesel = GDB_ID.NULL + EgtDraw() + End Sub - Private Sub OnMouseSelectingObj(ByVal sender As Object, ByVal nId As Integer, ByRef bOk As Boolean) Handles m_ProjectScene.OnMouseSelectingObj - ' Se oggetto già rifiutato non faccio le verifiche - If Not bOk Then Return - ' Se in modalità Draw accetto tutto - If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then - Return - End If - ' Sono in modalità Machining - Select Case m_SceneSelType - Case SceneSelTypeOpt.NULL + Private Sub OnMouseSelectingObj(ByVal sender As Object, ByVal nId As Integer, ByRef bOk As Boolean) Handles m_ProjectScene.OnMouseSelectingObj + ' Se oggetto già rifiutato non faccio le verifiche + If Not bOk Then Return + ' Se in modalità Draw accetto tutto + If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then + Return + End If + ' Sono in modalità Machining + Select Case m_SceneSelType + Case SceneSelTypeOpt.NULL + bOk = False + Case SceneSelTypeOpt.MACHINING + Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId)) + If Not IsPartInRaw(nPartId) Then bOk = False - Case SceneSelTypeOpt.MACHINING - Dim nPartId As Integer = EgtGetParent(EgtGetParent(nId)) - If Not IsPartInRaw(nPartId) Then - bOk = False - End If + End If - Case Else - bOk = False - End Select - End Sub + Case Else + bOk = False + End Select + End Sub - Private Sub OnMouseSelectedObj(ByVal sender As Object, ByVal nId As Integer, ByVal bLast As Boolean) Handles m_ProjectScene.OnMouseSelectedObj - m_Controller.MouseSelectedObj(nId, bLast) - End Sub + Private Sub OnMouseSelectedObj(ByVal sender As Object, ByVal nId As Integer, ByVal bLast As Boolean) Handles m_ProjectScene.OnMouseSelectedObj + m_Controller.MouseSelectedObj(nId, bLast) + End Sub - Private Sub OnMouseSelectedPart(ByVal sender As Object, ByVal nId As Integer) Handles m_ProjectScene.OnMouseSelectedPart - m_Controller.MouseSelectedPart(nId) - End Sub + Private Sub OnMouseSelectedPart(ByVal sender As Object, ByVal nId As Integer) Handles m_ProjectScene.OnMouseSelectedPart + m_Controller.MouseSelectedPart(nId) + End Sub - Private Sub OnMouseSelectedLayer(ByVal sender As Object, ByVal nId As Integer) Handles m_ProjectScene.OnMouseSelectedLayer - m_Controller.MouseSelectedLayer(nId) - End Sub + Private Sub OnMouseSelectedLayer(ByVal sender As Object, ByVal nId As Integer) Handles m_ProjectScene.OnMouseSelectedLayer + m_Controller.MouseSelectedLayer(nId) + End Sub - Private Sub OnMouseSelectedPath(ByVal sender As Object, ByVal nId As Integer, ByVal bHaltOnFork As Boolean) Handles m_ProjectScene.OnMouseSelectedPath - m_Controller.MouseSelectedPath(nId, bHaltOnFork) - End Sub + Private Sub OnMouseSelectedPath(ByVal sender As Object, ByVal nId As Integer, ByVal bHaltOnFork As Boolean) Handles m_ProjectScene.OnMouseSelectedPath + m_Controller.MouseSelectedPath(nId, bHaltOnFork) + End Sub - Private Sub OnMousePointFromSelection(ByVal sender As Object, ByVal nId As Integer, ByVal PtP As Point3d, ByVal nAux As Integer) Handles m_ProjectScene.OnMousePointFromSelection - m_Controller.SetPointFromSelection(nId, PtP, nAux) - IniFile.m_LastSubEntityId = nAux - End Sub + Private Sub OnMousePointFromSelection(ByVal sender As Object, ByVal nId As Integer, ByVal PtP As Point3d, ByVal nAux As Integer) Handles m_ProjectScene.OnMousePointFromSelection + m_Controller.SetPointFromSelection(nId, PtP, nAux) + IniFile.m_LastSubEntityId = nAux + End Sub - Private Sub OnMouseDone(ByVal sender As Object) Handles m_ProjectScene.OnMouseDone - m_Controller.Done(m_InputText) - End Sub + Private Sub OnMouseDone(ByVal sender As Object) Handles m_ProjectScene.OnMouseDone + m_Controller.Done(m_InputText) + End Sub - Private Sub OnMouseSelectedPoint(ByVal sender As Object, ByVal PtP As Point3d, ByVal nSep As SEP, ByVal nId As Integer) Handles m_ProjectScene.OnMouseSelectedPoint - Dim bDone As Boolean = (Keyboard.Modifiers And ModifierKeys.Control) <> ModifierKeys.Control - m_Controller.MouseSelectedPoint(PtP, nSep, nId, bDone) - End Sub + Private Sub OnMouseSelectedPoint(ByVal sender As Object, ByVal PtP As Point3d, ByVal nSep As SEP, ByVal nId As Integer) Handles m_ProjectScene.OnMouseSelectedPoint + Dim bDone As Boolean = (Keyboard.Modifiers And ModifierKeys.Control) <> ModifierKeys.Control + m_Controller.MouseSelectedPoint(PtP, nSep, nId, bDone) + End Sub - Private Sub OnMouseSelectedDir(ByVal sender As Object, ByVal VtDir As Vector3d) Handles m_ProjectScene.OnMouseSelectedDir - m_Controller.SetLastVector3d(VtDir) - End Sub + Private Sub OnMouseSelectedDir(ByVal sender As Object, ByVal VtDir As Vector3d) Handles m_ProjectScene.OnMouseSelectedDir + m_Controller.SetLastVector3d(VtDir) + End Sub - Private Sub OnMouseMoveSelPoint(ByVal sender As Object, ByVal PtP As Point3d) Handles m_ProjectScene.OnMouseMoveSelPoint - m_Controller.MouseMoveInSelectionPoint(PtP) - End Sub + Private Sub OnMouseMoveSelPoint(ByVal sender As Object, ByVal PtP As Point3d) Handles m_ProjectScene.OnMouseMoveSelPoint + m_Controller.MouseMoveInSelectionPoint(PtP) + End Sub - Private Sub OnMouseAnalyzed(ByVal sender As Object, ByVal nId As Integer) Handles m_ProjectScene.OnMouseAnalyzed - Application.Msn.NotifyColleagues(Application.UPDATEOBJINOBJTREE, nId) - Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREE, nId) - End Sub + Private Sub OnMouseAnalyzed(ByVal sender As Object, ByVal nId As Integer) Handles m_ProjectScene.OnMouseAnalyzed + Application.Msn.NotifyColleagues(Application.UPDATEOBJINOBJTREE, nId) + Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREE, nId) + End Sub - Private Sub OnShowDistance(ByVal sender As Object, ByVal sDistance As String) Handles m_ProjectScene.OnShowDistance - Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, sDistance) - End Sub + Private Sub OnShowDistance(ByVal sender As Object, ByVal sDistance As String) Handles m_ProjectScene.OnShowDistance + Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, sDistance) + End Sub - Private Sub OnSceneKeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles m_ProjectScene.KeyDown - ' Con DEL eseguo cancellazione delle entità selezionate - If e.KeyData = System.Windows.Forms.Keys.Delete Then - m_Controller.SetLastInteger(GDB_ID.SEL) - m_Controller.ExecuteCommand(Controller.CMD.DELETE) - ' Con SPAZIO ripeto l'ultimo comando - ElseIf e.KeyData = System.Windows.Forms.Keys.Space Then - m_Controller.RepeatLastCommand() - ' Con 'A' e in modalità continuazione, forzo il passaggio ad arco - ElseIf e.KeyData = System.Windows.Forms.Keys.A And m_Controller.GetContinue() Then - m_Controller.ContinueArcPDP() - ' Con 'L' e in modalità continuazione, forzo il passaggio a retta - ElseIf e.KeyData = System.Windows.Forms.Keys.L And m_Controller.GetContinue() Then - m_Controller.ContinueLine2P() - ' Con 'V' cambio lo stato del check - ElseIf e.KeyData = System.Windows.Forms.Keys.V Then - Application.Msn.NotifyColleagues(Application.CHANGEINPUTBOXCHECK) - End If - End Sub + Private Sub OnSceneKeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles m_ProjectScene.KeyDown + ' Con DEL eseguo cancellazione delle entità selezionate + If e.KeyData = System.Windows.Forms.Keys.Delete Then + m_Controller.SetLastInteger(GDB_ID.SEL) + m_Controller.ExecuteCommand(Controller.CMD.DELETE) + ' Con SPAZIO ripeto l'ultimo comando + ElseIf e.KeyData = System.Windows.Forms.Keys.Space Then + m_Controller.RepeatLastCommand() + ' Con 'A' e in modalità continuazione, forzo il passaggio ad arco + ElseIf e.KeyData = System.Windows.Forms.Keys.A And m_Controller.GetContinue() Then + m_Controller.ContinueArcPDP() + ' Con 'L' e in modalità continuazione, forzo il passaggio a retta + ElseIf e.KeyData = System.Windows.Forms.Keys.L And m_Controller.GetContinue() Then + m_Controller.ContinueLine2P() + ' Con 'V' cambio lo stato del check + ElseIf e.KeyData = System.Windows.Forms.Keys.V Then + Application.Msn.NotifyColleagues(Application.CHANGEINPUTBOXCHECK) + End If + End Sub - Private Sub OnSceneCloseAnalyze(sender As System.Object) Handles m_ProjectScene.OnCloseAnalyze - Application.Msn.NotifyColleagues(Application.ANALYZE_ISCHECKED, False) - End Sub + Private Sub OnSceneCloseAnalyze(sender As System.Object) Handles m_ProjectScene.OnCloseAnalyze + Application.Msn.NotifyColleagues(Application.ANALYZE_ISCHECKED, False) + End Sub - Private Sub OnSceneCloseGetDist(sender As System.Object) Handles m_ProjectScene.OnCloseGetDist - Application.Msn.NotifyColleagues(Application.GETDISTANCE_ISCHECKED, False) - End Sub + Private Sub OnSceneCloseGetDist(sender As System.Object) Handles m_ProjectScene.OnCloseGetDist + Application.Msn.NotifyColleagues(Application.GETDISTANCE_ISCHECKED, False) + End Sub #End Region #Region "CONTROLLER EVENTS" - Private Sub OnNewProject(ByVal sender As Object, ByVal bOk As Boolean) Handles m_Controller.OnNewProject - EgtZoom(ZM.ALL) - If Not bOk Then - MessageBox.Show(Application.Current.MainWindow, EgtMsg(10002), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error on new file - Error - End If - End Sub + Private Sub OnNewProject(ByVal sender As Object, ByVal bOk As Boolean) Handles m_Controller.OnNewProject + EgtZoom(ZM.ALL) + If Not bOk Then + MessageBox.Show(Application.Current.MainWindow, EgtMsg(10002), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error on new file - Error + End If + End Sub - Private Sub OnOpeningProject(ByVal sender As Object) Handles m_Controller.OnOpeningProject + Private Sub OnOpeningProject(ByVal sender As Object) Handles m_Controller.OnOpeningProject + Application.Msn.NotifyColleagues(Application.CLEAROBJTREE) + End Sub + + Private Sub OnOpenProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnOpenProject + EgtZoom(ZM.ALL) + WritePrivateProfileString(S_GENERAL, K_LASTNGEDIR, Path.GetDirectoryName(sFile)) + If bOk Then + IniFile.m_MruFiles.Add(sFile) + Else + IniFile.m_MruFiles.Remove(sFile) + Dim sMsg As String = EgtMsg(10003) & " '" & sFile & "'" 'Error opening file + MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) 'Error + End If + End Sub + + Private Sub OnInsertedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnInsertedProject + EgtZoom(ZM.ALL) + End Sub + + Private Sub OnSavingProject(ByVal sender As Object, ByVal sFile As String) Handles m_Controller.OnSavingProject + End Sub + + Private Sub OnSavedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnSavedProject + WritePrivateProfileString(S_GENERAL, K_LASTNGEDIR, Path.GetDirectoryName(sFile)) + If bOk Then + IniFile.m_MruFiles.Add(sFile) + Else + IniFile.m_MruFiles.Remove(sFile) + Dim sMsg As String = EgtMsg(10004) & " '" & sFile & "'" 'Error saving file + MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error + End If + End Sub + + Private Sub OnSavingObject(ByVal sender As Object, ByVal sFile As String) Handles m_Controller.OnSavingObject + End Sub + + Private Sub OnSavedObject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnSavedObject + WritePrivateProfileString(S_GENERAL, K_LASTNGEOBJDIR, Path.GetDirectoryName(sFile)) + If bOk Then + IniFile.m_MruFiles.Add(sFile) + Else + IniFile.m_MruFiles.Remove(sFile) + Dim sMsg As String = EgtMsg(10004) & " '" & sFile & "'" 'Error saving file + MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error + End If + End Sub + + Private Sub OnImportingProject(sender As Object, nType As Integer, ByRef nFlag As Integer) Handles m_Controller.OnImportingProject + If nType <> FT.NULL Then Application.Msn.NotifyColleagues(Application.CLEAROBJTREE) - End Sub - - Private Sub OnOpenProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnOpenProject - EgtZoom(ZM.ALL) - WritePrivateProfileString(S_GENERAL, K_LASTNGEDIR, Path.GetDirectoryName(sFile)) - If bOk Then - IniFile.m_MruFiles.Add(sFile) + If nType = FT.CNC Then + nFlag = GetPrivateProfileInt(S_IMPORT, K_CNCFLAG, EIC_FL.NONE) + ElseIf nType = FT.BTL Then + nFlag = GetPrivateProfileInt(S_IMPORT, K_BTLFLAG, EIC_FL.NONE) Else - IniFile.m_MruFiles.Remove(sFile) - Dim sMsg As String = EgtMsg(10003) & " '" & sFile & "'" 'Error opening file - MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) 'Error + nFlag = 0 End If - End Sub + Else + MessageBox.Show(Application.Current.MainWindow, EgtMsg(10005), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' File type unknown - Error + End If + End Sub - Private Sub OnInsertedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnInsertedProject - EgtZoom(ZM.ALL) - End Sub + Private Sub OnImportedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnImportedProject + EgtZoom(ZM.ALL) + WritePrivateProfileString(S_GENERAL, K_LASTIMPDIR, Path.GetDirectoryName(sFile)) + If Not bOk Then + Dim sMsg As String = EgtMsg(10006) & " '" & sFile & "'" 'Error importing file + MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error + End If + End Sub - Private Sub OnSavingProject(ByVal sender As Object, ByVal sFile As String) Handles m_Controller.OnSavingProject - End Sub + Private Sub OnExportingProject(ByVal sender As Object) Handles m_Controller.OnExportingProject + End Sub - Private Sub OnSavedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnSavedProject - WritePrivateProfileString(S_GENERAL, K_LASTNGEDIR, Path.GetDirectoryName(sFile)) - If bOk Then - IniFile.m_MruFiles.Add(sFile) - Else - IniFile.m_MruFiles.Remove(sFile) - Dim sMsg As String = EgtMsg(10004) & " '" & sFile & "'" 'Error saving file - MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error - End If - End Sub + Private Sub OnExportedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnExportedProject + WritePrivateProfileString(S_GENERAL, K_LASTEXPDIR, Path.GetDirectoryName(sFile)) + If Not bOk Then + Dim sMsg As String = EgtMsg(10007) & " '" & sFile & "'" 'Error exporting file + MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error + End If + End Sub - Private Sub OnSavingObject(ByVal sender As Object, ByVal sFile As String) Handles m_Controller.OnSavingObject - End Sub + Private Sub OnExecutingScript(ByVal sender As Object) Handles m_Controller.OnExecutingScript + Application.Msn.NotifyColleagues(Application.CLEAROBJTREE) + ' Abilito progress e bottone stop + Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSPROGRESS, 0) + Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSSTOP, True) + ' Dichiaro script in esecuzione + m_bScriptRunning = True + End Sub - Private Sub OnSavedObject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnSavedObject - WritePrivateProfileString(S_GENERAL, K_LASTNGEOBJDIR, Path.GetDirectoryName(sFile)) - If bOk Then - IniFile.m_MruFiles.Add(sFile) - Else - IniFile.m_MruFiles.Remove(sFile) - Dim sMsg As String = EgtMsg(10004) & " '" & sFile & "'" 'Error saving file - MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error - End If - End Sub + Private Sub OnExecutedScript(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean, ByVal sError As String) Handles m_Controller.OnExecutedScript + ' Salvo path dello script in lista recenti + WritePrivateProfileString(S_GENERAL, K_LASTLUADIR, Path.GetDirectoryName(sFile)) + If bOk Then + If m_bScriptInMru Then IniFile.m_MruScripts.Add(sFile) + Else + If m_bScriptInMru Then IniFile.m_MruScripts.Remove(sFile) + MessageBox.Show(Application.Current.MainWindow, sError, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error + End If + ' Disabilito progress e bottone stop + Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSPROGRESS, 0) + Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSSTOP, False) + ' Dichiaro terminata esecuzione script + m_bScriptRunning = False + End Sub - Private Sub OnImportingProject(sender As Object, nType As Integer, ByRef nFlag As Integer) Handles m_Controller.OnImportingProject - If nType <> FT.NULL Then - Application.Msn.NotifyColleagues(Application.CLEAROBJTREE) - If nType = FT.CNC Then - nFlag = GetPrivateProfileInt(S_IMPORT, K_CNCFLAG, EIC_FL.NONE) - ElseIf nType = FT.BTL Then - nFlag = GetPrivateProfileInt(S_IMPORT, K_BTLFLAG, EIC_FL.NONE) - Else - nFlag = 0 - End If - Else - MessageBox.Show(Application.Current.MainWindow, EgtMsg(10005), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' File type unknown - Error - End If - End Sub + Private Sub OnPrepareInputBox(ByVal sTitle As String, ByVal sLabel As String, ByVal sCheckLabel As String, + ByVal bShowCombo As Boolean, ByVal bShowBtn As Boolean) Handles m_Controller.PrepareInputBox + Application.Msn.NotifyColleagues(Application.PREPAREINPUTBOX, New PrepareInputBoxParam(sTitle, sLabel, sCheckLabel, bShowCombo, bShowBtn)) + End Sub - Private Sub OnImportedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnImportedProject - EgtZoom(ZM.ALL) - WritePrivateProfileString(S_GENERAL, K_LASTIMPDIR, Path.GetDirectoryName(sFile)) - If Not bOk Then - Dim sMsg As String = EgtMsg(10006) & " '" & sFile & "'" 'Error importing file - MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error - End If - End Sub + Private Sub OnSetInputBoxText(ByVal sText As String) Handles m_Controller.SetInputBoxText + Application.Msn.NotifyColleagues(Application.SETINPUTBOXTEXT, sText) + End Sub - Private Sub OnExportingProject(ByVal sender As Object) Handles m_Controller.OnExportingProject - End Sub + Private Sub OnSetInputBoxCheck(ByVal bCheck As Boolean) Handles m_Controller.SetInputBoxCheck + Application.Msn.NotifyColleagues(Application.SETINPUTBOXCHECK, bCheck) + End Sub - Private Sub OnExportedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnExportedProject - WritePrivateProfileString(S_GENERAL, K_LASTEXPDIR, Path.GetDirectoryName(sFile)) - If Not bOk Then - Dim sMsg As String = EgtMsg(10007) & " '" & sFile & "'" 'Error exporting file - MessageBox.Show(Application.Current.MainWindow, sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error - End If - End Sub + Private Sub OnAddInputBoxCombo(ByVal sText As String, ByVal bSelected As Boolean) Handles m_Controller.AddInputBoxCombo + Application.Msn.NotifyColleagues(Application.ADDINPUTBOXCOMBO, New AddInputBoxComboParam(sText, bSelected)) + End Sub - Private Sub OnExecutingScript(ByVal sender As Object) Handles m_Controller.OnExecutingScript - Application.Msn.NotifyColleagues(Application.CLEAROBJTREE) - ' Abilito progress e bottone stop - Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSPROGRESS, 0) - Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSSTOP, True) - ' Dichiaro script in esecuzione - m_bScriptRunning = True - End Sub + Private Sub OnUpdateUI(ByVal sender As Object, ByVal bReloadUI As Boolean) Handles m_Controller.UpdateUI + ' pulisco input e relativi messaggi + Application.Msn.NotifyColleagues(Application.RESETINPUTBOX) + If m_Controller.GetContinue() Then + Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, (EgtMsg(399))) ' Continue : 'L' with line, 'A' with arc + Else + Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, ("")) + End If + ' aggiorno dati correnti + EmitTitle() + EmitCurrPartLayer() + If bReloadUI Then + Application.Msn.NotifyColleagues(Application.LOADOBJTREE) + Else + Application.Msn.NotifyColleagues(Application.UPDATEOBJTREE) + End If + ' aggiorno macchina corrente + Application.Msn.NotifyColleagues(Application.UPDATECURRENTMACHINE) + End Sub - Private Sub OnExecutedScript(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean, ByVal sError As String) Handles m_Controller.OnExecutedScript - ' Salvo path dello script in lista recenti - WritePrivateProfileString(S_GENERAL, K_LASTLUADIR, Path.GetDirectoryName(sFile)) - If bOk Then - If m_bScriptInMru Then IniFile.m_MruScripts.Add(sFile) - Else - If m_bScriptInMru Then IniFile.m_MruScripts.Remove(sFile) - MessageBox.Show(Application.Current.MainWindow, sError, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error - End If - ' Disabilito progress e bottone stop - Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSPROGRESS, 0) - Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSSTOP, False) - ' Dichiaro terminata esecuzione script - m_bScriptRunning = False - End Sub - - Private Sub OnPrepareInputBox(ByVal sTitle As String, ByVal sLabel As String, ByVal sCheckLabel As String, - ByVal bShowCombo As Boolean, ByVal bShowBtn As Boolean) Handles m_Controller.PrepareInputBox - Application.Msn.NotifyColleagues(Application.PREPAREINPUTBOX, New PrepareInputBoxParam(sTitle, sLabel, sCheckLabel, bShowCombo, bShowBtn)) - End Sub - - Private Sub OnSetInputBoxText(ByVal sText As String) Handles m_Controller.SetInputBoxText - Application.Msn.NotifyColleagues(Application.SETINPUTBOXTEXT, sText) - End Sub - - Private Sub OnSetInputBoxCheck(ByVal bCheck As Boolean) Handles m_Controller.SetInputBoxCheck - Application.Msn.NotifyColleagues(Application.SETINPUTBOXCHECK, bCheck) - End Sub - - Private Sub OnAddInputBoxCombo(ByVal sText As String, ByVal bSelected As Boolean) Handles m_Controller.AddInputBoxCombo - Application.Msn.NotifyColleagues(Application.ADDINPUTBOXCOMBO, New AddInputBoxComboParam(sText, bSelected)) - End Sub - - Private Sub OnUpdateUI(ByVal sender As Object, ByVal bReloadUI As Boolean) Handles m_Controller.UpdateUI - ' pulisco input e relativi messaggi - Application.Msn.NotifyColleagues(Application.RESETINPUTBOX) - If m_Controller.GetContinue() Then - Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, (EgtMsg(399))) ' Continue : 'L' with line, 'A' with arc - Else - Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, ("")) - End If - ' aggiorno dati correnti - EmitTitle() - EmitCurrPartLayer() - If bReloadUI Then - Application.Msn.NotifyColleagues(Application.LOADOBJTREE) - Else - Application.Msn.NotifyColleagues(Application.UPDATEOBJTREE) - End If - ' aggiorno macchina corrente - Application.Msn.NotifyColleagues(Application.UPDATECURRENTMACHINE) - End Sub - - Private Sub OutputInfo(ByVal sender As Object, ByVal sText As String) Handles m_Controller.OutputInfo - Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, sText) - End Sub + Private Sub OutputInfo(ByVal sender As Object, ByVal sText As String) Handles m_Controller.OutputInfo + Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, sText) + End Sub #End Region #Region "STATUSBAR EVENTS" - Private Sub ProjectScene_OnChangedSnapPointType(ByVal sender As Object, ByVal nSpType As SP, ByVal bUser As Boolean) Handles m_ProjectScene.OnChangedSnapPointType - If bUser Then - Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPEBACKGROUND, New SolidColorBrush(SystemColors.ControlColor)) - Else - Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPEBACKGROUND, Brushes.Bisque) - End If - Select Case nSpType - Case SP.PT_SKETCH - Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, EgtMsg(1102)) 'Sketch Point - Case SP.PT_GRID - Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, EgtMsg(1104)) 'Grid Point - Case SP.PT_END - Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, EgtMsg(1106)) 'End Point - Case SP.PT_MID - Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, EgtMsg(1108)) 'Mid Point - Case SP.CENTER - Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, EgtMsg(1110)) 'Center - Case SP.CENTROID - Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, EgtMsg(1112)) 'Centroid - Case SP.PT_NEAR - Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, EgtMsg(1114)) 'Near Point - Case SP.PT_INTERS - Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, EgtMsg(1116)) 'Inters Point - Case SP.PT_TANGENT - Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, EgtMsg(1118)) 'Tang Point - Case SP.PT_PERPENDICULAR - Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, EgtMsg(1120)) 'Perp Point - Case SP.PT_MINDIST - Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, EgtMsg(1122)) 'MinDist Point - Case Else - Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, "---") - End Select - End Sub + Private Sub ProjectScene_OnChangedSnapPointType(ByVal sender As Object, ByVal nSpType As SP, ByVal bUser As Boolean) Handles m_ProjectScene.OnChangedSnapPointType + If bUser Then + Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPEBACKGROUND, New SolidColorBrush(SystemColors.ControlColor)) + Else + Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPEBACKGROUND, Brushes.Bisque) + End If + Select Case nSpType + Case SP.PT_SKETCH + Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, EgtMsg(1102)) 'Sketch Point + Case SP.PT_GRID + Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, EgtMsg(1104)) 'Grid Point + Case SP.PT_END + Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, EgtMsg(1106)) 'End Point + Case SP.PT_MID + Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, EgtMsg(1108)) 'Mid Point + Case SP.CENTER + Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, EgtMsg(1110)) 'Center + Case SP.CENTROID + Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, EgtMsg(1112)) 'Centroid + Case SP.PT_NEAR + Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, EgtMsg(1114)) 'Near Point + Case SP.PT_INTERS + Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, EgtMsg(1116)) 'Inters Point + Case SP.PT_TANGENT + Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, EgtMsg(1118)) 'Tang Point + Case SP.PT_PERPENDICULAR + Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, EgtMsg(1120)) 'Perp Point + Case SP.PT_MINDIST + Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, EgtMsg(1122)) 'MinDist Point + Case Else + Application.Msn.NotifyColleagues(Application.STATUSSNAPPOINTTYPETEXT, "---") + End Select + End Sub #End Region ' StatusBar events #Region "DrawOptionPanel" - Private Sub EmitCurrPartLayer() - Dim sText As String = " " - Dim sName As String = String.Empty - Dim colObj As Color3d - EgtGetColor(GDB_ID.ROOT, colObj) - Dim nCurrPart As Integer = m_Controller.GetCurrPart() - If nCurrPart <> GDB_ID.NULL Then - If EgtGetName(nCurrPart, sName) Then - sText = sName - Else - sText = "Part " + nCurrPart.ToString() - End If - EgtGetCalcColor(nCurrPart, colObj) - Dim nCurrLayer As Integer = m_Controller.GetCurrLayer() - If nCurrLayer <> GDB_ID.NULL And EgtExistsObj(nCurrLayer) Then - If EgtGetName(nCurrLayer, sName) Then - sText += " --> " + sName - Else - sText += " --> Layer " + nCurrLayer.ToString() - End If - EgtGetCalcColor(nCurrLayer, colObj) - End If + Private Sub EmitCurrPartLayer() + Dim sText As String = " " + Dim sName As String = String.Empty + Dim colObj As Color3d + EgtGetColor(GDB_ID.ROOT, colObj) + Dim nCurrPart As Integer = m_Controller.GetCurrPart() + If nCurrPart <> GDB_ID.NULL Then + If EgtGetName(nCurrPart, sName) Then + sText = sName + Else + sText = "Part " + nCurrPart.ToString() End If - Application.Msn.NotifyColleagues(Application.UPDATEHEADERNAME, sText) - colObj.A = 100 - Application.Msn.NotifyColleagues(Application.UPDATEHEADERCOLOR, colObj) - End Sub + EgtGetCalcColor(nCurrPart, colObj) + Dim nCurrLayer As Integer = m_Controller.GetCurrLayer() + If nCurrLayer <> GDB_ID.NULL And EgtExistsObj(nCurrLayer) Then + If EgtGetName(nCurrLayer, sName) Then + sText += " --> " + sName + Else + sText += " --> Layer " + nCurrLayer.ToString() + End If + EgtGetCalcColor(nCurrLayer, colObj) + End If + End If + Application.Msn.NotifyColleagues(Application.UPDATEHEADERNAME, sText) + colObj.A = 100 + Application.Msn.NotifyColleagues(Application.UPDATEHEADERCOLOR, colObj) + End Sub #End Region 'DrawOptionPanel #Region "Scene selection" - Private m_SceneSelMode As SceneSelModeOpt - Friend Property SceneSelMode As SceneSelModeOpt - Get - Return m_SceneSelMode - End Get - Set(value As SceneSelModeOpt) - If value <> m_SceneSelMode Then - m_SceneSelMode = value - Select Case m_SceneSelMode - Case SceneSelModeOpt.NULL - m_ProjectScene.SetObjFilterForSel(False, False, False, False, False) - EgtSetObjFilterForSelect(True, True, True, True, True) - Case SceneSelModeOpt.PARTCURVES - m_ProjectScene.SetObjFilterForSel(False, True, False, False, False) - Case SceneSelModeOpt.PARTSURFACES - m_ProjectScene.SetObjFilterForSel(False, False, True, False, False) - Case SceneSelModeOpt.PARTCURVESANDSURFACES - m_ProjectScene.SetObjFilterForSel(False, True, True, False, False) - Case SceneSelModeOpt.ALL - m_ProjectScene.SetObjFilterForSel(True, True, True, True, True) - Case Else - m_ProjectScene.SetObjFilterForSel(False, False, False, False, False) - End Select + Private m_SceneSelMode As SceneSelModeOpt + Friend Property SceneSelMode As SceneSelModeOpt + Get + Return m_SceneSelMode + End Get + Set(value As SceneSelModeOpt) + If value <> m_SceneSelMode Then + m_SceneSelMode = value + Select Case m_SceneSelMode + Case SceneSelModeOpt.NULL + m_ProjectScene.SetObjFilterForSel(False, False, False, False, False) + EgtSetObjFilterForSelect(True, True, True, True, True) + Case SceneSelModeOpt.PARTCURVES + m_ProjectScene.SetObjFilterForSel(False, True, False, False, False) + Case SceneSelModeOpt.PARTSURFACES + m_ProjectScene.SetObjFilterForSel(False, False, True, False, False) + Case SceneSelModeOpt.PARTCURVESANDSURFACES + m_ProjectScene.SetObjFilterForSel(False, True, True, False, False) + Case SceneSelModeOpt.ALL + m_ProjectScene.SetObjFilterForSel(True, True, True, True, True) + Case Else + m_ProjectScene.SetObjFilterForSel(False, False, False, False, False) + End Select + End If + End Set + End Property + + Private m_SceneSelType As SceneSelTypeOpt + Friend Property SceneSelType As SceneSelTypeOpt + Get + Return m_SceneSelType + End Get + Set(value As SceneSelTypeOpt) + If value <> m_SceneSelType Then + m_SceneSelType = value + End If + End Set + End Property + + Private m_bMoveInDisposition As Boolean + Public Property bMoveInDisposition As Boolean + Get + Return m_bMoveInDisposition + End Get + Set(value As Boolean) + m_bMoveInDisposition = value + End Set + End Property + + Friend Function IsPartInRaw(nSearchedPartId As Integer) As Boolean + Dim nRawId As Integer = EgtGetFirstRawPart() + While nRawId <> GDB_ID.NULL + Dim nPartId As Integer = EgtGetFirstPartInRawPart(nRawId) + While nPartId <> GDB_ID.NULL + If nPartId = nSearchedPartId Then + Return True End If - End Set - End Property - - Private m_SceneSelType As SceneSelTypeOpt - Friend Property SceneSelType As SceneSelTypeOpt - Get - Return m_SceneSelType - End Get - Set(value As SceneSelTypeOpt) - If value <> m_SceneSelType Then - m_SceneSelType = value - End If - End Set - End Property - - Private m_bMoveInDisposition As Boolean - Public Property bMoveInDisposition As Boolean - Get - Return m_bMoveInDisposition - End Get - Set(value As Boolean) - m_bMoveInDisposition = value - End Set - End Property - - Friend Function IsPartInRaw(nSearchedPartId As Integer) As Boolean - Dim nRawId As Integer = EgtGetFirstRawPart() - While nRawId <> GDB_ID.NULL - Dim nPartId As Integer = EgtGetFirstPartInRawPart(nRawId) - While nPartId <> GDB_ID.NULL - If nPartId = nSearchedPartId Then - Return True - End If - nPartId = EgtGetNextPartInRawPart(nPartId) - End While - nRawId = EgtGetNextRawPart(nRawId) + nPartId = EgtGetNextPartInRawPart(nPartId) End While - Return False - End Function + nRawId = EgtGetNextRawPart(nRawId) + End While + Return False + End Function #End Region ' Scene selection - End Class - -End Namespace \ No newline at end of file +End Class \ No newline at end of file diff --git a/SetUpWindow/SetUpVM.vb b/SetUpWindow/SetUpVM.vb index 1f51ed5..2457fbb 100644 --- a/SetUpWindow/SetUpVM.vb +++ b/SetUpWindow/SetUpVM.vb @@ -3,747 +3,837 @@ Imports System.ComponentModel Imports System.IO Imports EgtUILib -Namespace EgtCAM5 +Public Class SetUpWindowVM + Implements INotifyPropertyChanged - Public Class SetUpWindowVM - Implements INotifyPropertyChanged + Private Const INVALIDPOS As String = "" - Private Const INVALIDPOS As String = "" + Private m_Title As String + Public ReadOnly Property Title As String + Get + Return EgtMsg(MSG_SETUP + 1) + End Get + End Property - Private m_Title As String - Public ReadOnly Property Title As String - Get - Return EgtMsg(MSG_SETUP + 1) - End Get - End Property + ' Lista degli utensili + Private m_ToolsList As New ObservableCollection(Of FamilyToolItem) + Public Property ToolsList As ObservableCollection(Of FamilyToolItem) + Get + Return m_ToolsList + End Get + Set(value As ObservableCollection(Of FamilyToolItem)) + m_ToolsList = value + End Set + End Property - ' Lista degli utensili - Private m_ToolsList As New ObservableCollection(Of FamilyToolItem) - Public Property ToolsList As ObservableCollection(Of FamilyToolItem) - Get - Return m_ToolsList - End Get - Set(value As ObservableCollection(Of FamilyToolItem)) - m_ToolsList = value - End Set - End Property + ' Lista dei gruppi di posizioni + Private m_PositionGroupList As New ObservableCollection(Of PositionGroup) + Public Property PositionGroupList As ObservableCollection(Of PositionGroup) + Get + Return m_PositionGroupList + End Get + Set(value As ObservableCollection(Of PositionGroup)) + m_PositionGroupList = value + End Set + End Property - ' Lista dei gruppi di posizioni - Private m_PositionGroupList As New ObservableCollection(Of PositionGroup) - Public Property PositionGroupList As ObservableCollection(Of PositionGroup) - Get - Return m_PositionGroupList - End Get - Set(value As ObservableCollection(Of PositionGroup)) - m_PositionGroupList = value - End Set - End Property + Private m_IsEnabledApplyBtn As Boolean + Public ReadOnly Property IsEnabledApplyBtn As Boolean + Get + Return m_IsEnabledApplyBtn + End Get + End Property - Private m_IsEnabledApplyBtn As Boolean - Public ReadOnly Property IsEnabledApplyBtn As Boolean - Get - Return m_IsEnabledApplyBtn - End Get - End Property - - ' Immagine del porta utensili - Public ReadOnly Property SetUpImage As String - Get - ' Cerco png - Dim sImagePath As String = IniFile.m_sCurrMachSetUpDirPath & "\SetupImage.png" - If File.Exists(sImagePath) Then Return sImagePath - ' Cerco jpeg - sImagePath = IniFile.m_sCurrMachSetUpDirPath & "\SetupImage.jpg" - If File.Exists(sImagePath) Then Return sImagePath - ' Cerco bmp - sImagePath = IniFile.m_sCurrMachSetUpDirPath & "\SetupImage.bmp" - If File.Exists(sImagePath) Then Return sImagePath - ' Non trovato alcunché - Return String.Empty - End Get - End Property + ' Immagine del porta utensili + Public ReadOnly Property SetUpImage As String + Get + ' Cerco png + Dim sImagePath As String = IniFile.m_sCurrMachSetUpDirPath & "\SetupImage.png" + If File.Exists(sImagePath) Then Return sImagePath + ' Cerco jpeg + sImagePath = IniFile.m_sCurrMachSetUpDirPath & "\SetupImage.jpg" + If File.Exists(sImagePath) Then Return sImagePath + ' Cerco bmp + sImagePath = IniFile.m_sCurrMachSetUpDirPath & "\SetupImage.bmp" + If File.Exists(sImagePath) Then Return sImagePath + ' Non trovato alcunché + Return String.Empty + End Get + End Property #Region "Messages" - Public ReadOnly Property TitleMsg As String - Get - Return EgtMsg(MSG_SETUP + 1) - End Get - End Property + Public ReadOnly Property TitleMsg As String + Get + Return EgtMsg(MSG_SETUP + 1) + End Get + End Property - Public ReadOnly Property ApplyMsg As String - Get - Return EgtMsg(MSG_SETUP + 2) - End Get - End Property - Public ReadOnly Property ArchiveMsg As String - Get - Return EgtMsg(MSG_SETUP + 3) - End Get - End Property - Public ReadOnly Property RetrievesMsg As String - Get - Return EgtMsg(MSG_SETUP + 4) - End Get - End Property - Public ReadOnly Property AutomaticMsg As String - Get - Return EgtMsg(MSG_SETUP + 5) - End Get - End Property + Public ReadOnly Property ApplyMsg As String + Get + Return EgtMsg(MSG_SETUP + 2) + End Get + End Property + Public ReadOnly Property ArchiveMsg As String + Get + Return EgtMsg(MSG_SETUP + 3) + End Get + End Property + Public ReadOnly Property RetrievesMsg As String + Get + Return EgtMsg(MSG_SETUP + 4) + End Get + End Property + Public ReadOnly Property AutomaticMsg As String + Get + Return EgtMsg(MSG_SETUP + 5) + End Get + End Property #End Region - ' Definizione comandi - Private m_cmdApply As ICommand - Private m_cmdArchive As ICommand - Private m_cmdRetrieves As ICommand - Private m_cmdAutomatic As ICommand - Private m_cmdCloseSetUp As ICommand - Private m_cmdToolDoubleClick As ICommand + ' Definizione comandi + Private m_cmdApply As ICommand + Private m_cmdArchive As ICommand + Private m_cmdRetrieves As ICommand + Private m_cmdAutomatic As ICommand + Private m_cmdCloseSetUp As ICommand + Private m_cmdToolDoubleClick As ICommand - Sub New() - ' rendo accessibile la lista posizioni a famiglie ed utensili per poterle attivare e disattivare - ' (probabilmente da cambiare passandogli il riferimento alla creazione dell'utensile per non avere parametro shared) - FamilyToolItem.m_PositionGroupList = m_PositionGroupList - ToolItem.m_PositionGroupList = m_PositionGroupList - ' rendo accessibile le liste utensili e posizioni alle uscite - ExitToolAssociation.sh_ToolsList = m_ToolsList - ExitToolAssociation.sh_PositionGroupList = m_PositionGroupList - ' imposto il delegate che attiva e disattiva il bottone applica dall'uscita - ExitToolAssociation.m_delIsEnabledBtns = AddressOf IsEnabledBtns - ' carico lista utensili - LoadMachineTools() - ' carico lista posizioni - LoadMachinePositions() - ' Se esiste almeno una famiglia di utensili, la seleziono - If ToolsList.Count > 0 Then - ToolsList(0).IsSelected = True - ToolsList(0).NotifyPropertyChanged("IsSelected") + Sub New() + ' rendo accessibile la lista posizioni a famiglie ed utensili per poterle attivare e disattivare + ' (probabilmente da cambiare passandogli il riferimento alla creazione dell'utensile per non avere parametro shared) + FamilyToolItem.m_PositionGroupList = m_PositionGroupList + ToolItem.m_PositionGroupList = m_PositionGroupList + ' rendo accessibile le liste utensili e posizioni alle uscite + ExitToolAssociation.sh_ToolsList = m_ToolsList + ExitToolAssociation.sh_PositionGroupList = m_PositionGroupList + ' imposto il delegate che attiva e disattiva il bottone applica dall'uscita + ExitToolAssociation.m_delIsEnabledBtns = AddressOf IsEnabledBtns + ' carico lista utensili + LoadMachineTools() + ' carico lista posizioni + LoadMachinePositions() + ' Se esiste almeno una famiglia di utensili, la seleziono + If ToolsList.Count > 0 Then + ToolsList(0).IsSelected = True + ToolsList(0).NotifyPropertyChanged("IsSelected") + End If + End Sub + + ''' + ''' Method that search tools for the currently selected Machine and add it to the ToolsList. + ''' + Private Sub LoadMachineTools() + ' Creo lista utensili utilizzati dal gruppo di lavorazione corrente + Dim UsedToolList As New List(Of String) + Dim Machining As Integer = EgtGetFirstOperation() + While Machining <> GDB_ID.NULL + If EgtGetOperationType(Machining) <> MCH_OY.DISP Then + EgtSetCurrMachining(Machining) + Dim Tuuid As String = String.Empty + EgtGetMachiningParam(MCH_MP.TUUID, Tuuid) + UsedToolList.Add(Tuuid) End If - End Sub - - ''' - ''' Method that search tools for the currently selected Machine and add it to the ToolsList. - ''' - Private Sub LoadMachineTools() - ' Creo lista utensili utilizzati dal gruppo di lavorazione corrente - Dim UsedToolList As New List(Of String) - Dim Machining As Integer = EgtGetFirstOperation() - While Machining <> GDB_ID.NULL - If EgtGetOperationType(Machining) <> MCH_OY.DISP Then - EgtSetCurrMachining(Machining) - Dim Tuuid As String = String.Empty - EgtGetMachiningParam(MCH_MP.TUUID, Tuuid) - UsedToolList.Add(Tuuid) - End If - Machining = EgtGetNextOperation(Machining) + Machining = EgtGetNextOperation(Machining) + End While + ' Creo lista utensili per grafica + Dim ActiveToolsFamilies() As ToolsFamily = MachineModel.ReadActiveToolsFamilies() + For Index = 0 To ActiveToolsFamilies.Count - 1 + Dim FamilyToolItem As New FamilyToolItem(ActiveToolsFamilies(Index).FamilyName, ActiveToolsFamilies(Index).FamilyId) + m_ToolsList.Add(FamilyToolItem) + Dim nType As Integer = 0 + Dim ToolName As String = String.Empty + Dim bFound As Boolean = EgtTdbGetFirstTool(ActiveToolsFamilies(Index).FamilyId, ToolName, nType) + While bFound + EgtTdbSetCurrTool(ToolName) + Dim nValue As Integer = 0 + Dim sValue As String = String.Empty + EgtTdbGetCurrToolParam(MCH_TP.EXIT_, nValue) + Dim ExitPar As String = nValue.ToString() + EgtTdbGetCurrToolParam(MCH_TP.HEAD, sValue) + Dim Head As String = sValue + EgtTdbGetCurrToolParam(MCH_TP.TCPOS, sValue) + Dim TcPos As String = sValue + EgtTdbGetCurrToolParam(MCH_TP.UUID, sValue) + Dim Uuid As String = sValue + Dim IsInCurrMachGroup As Boolean = If(UsedToolList.Contains(Uuid), True, False) + FamilyToolItem.Items.Add(New ToolItem(ToolName, ExitPar, nType, Head, TcPos, Uuid, IsInCurrMachGroup)) + bFound = EgtTdbGetNextTool(ActiveToolsFamilies(Index).FamilyId, ToolName, nType) End While - ' Creo lista utensili per grafica - Dim ActiveToolsFamilies() As ToolsFamily = MachineModel.ReadActiveToolsFamilies() - For Index = 0 To ActiveToolsFamilies.Count - 1 - Dim FamilyToolItem As New FamilyToolItem(ActiveToolsFamilies(Index).FamilyName, ActiveToolsFamilies(Index).FamilyId) - m_ToolsList.Add(FamilyToolItem) - Dim nType As Integer = 0 - Dim ToolName As String = String.Empty - Dim bFound As Boolean = EgtTdbGetFirstTool(ActiveToolsFamilies(Index).FamilyId, ToolName, nType) - While bFound - EgtTdbSetCurrTool(ToolName) - Dim nValue As Integer = 0 - Dim sValue As String = String.Empty - EgtTdbGetCurrToolParam(MCH_TP.EXIT_, nValue) - Dim ExitPar As String = nValue.ToString() - EgtTdbGetCurrToolParam(MCH_TP.HEAD, sValue) - Dim Head As String = sValue - EgtTdbGetCurrToolParam(MCH_TP.TCPOS, sValue) - Dim TcPos As String = sValue - EgtTdbGetCurrToolParam(MCH_TP.UUID, sValue) - Dim Uuid As String = sValue - Dim IsInCurrMachGroup As Boolean = If(UsedToolList.Contains(Uuid), True, False) - FamilyToolItem.Items.Add(New ToolItem(ToolName, ExitPar, nType, Head, TcPos, Uuid, IsInCurrMachGroup)) - bFound = EgtTdbGetNextTool(ActiveToolsFamilies(Index).FamilyId, ToolName, nType) - End While - Next - End Sub + Next + End Sub - Private Sub LoadMachinePositions() - ' recupero il gruppo del setup - Dim nSetUpGroup As Integer = EgtGetCurrSetup() - ' genero l'attrezzaggio dalla configurazione Lua - Dim Index As Integer = 1 - While CreateStdPosFromPosIndex(Index) - Index += 1 - End While - Index -= 1 + Private Sub LoadMachinePositions() + ' recupero il gruppo del setup + Dim nSetUpGroup As Integer = EgtGetCurrSetup() + ' genero l'attrezzaggio dalla configurazione Lua + Dim Index As Integer = 1 + While CreateStdPosFromPosIndex(Index) + Index += 1 + End While + Index -= 1 - ' leggo l'attrezzaggio del progetto - Dim sPosition As String = String.Empty - Dim IniIndex As Integer = 1 - ' recupero stringa di ogni posizione - While EgtGetInfo(nSetUpGroup, K_POS & IniIndex, sPosition) - If IniIndex <= Index Then - ReadPositionString(IniIndex, sPosition, True) - Else - EgtRemoveInfo(nSetUpGroup, K_POS & IniIndex) - End If - IniIndex += 1 - End While - - End Sub - - ' Funzione che dato l'indice di una posizione, la crea secondo il modello standard presente nello script Lua - Private Function CreateStdPosFromPosIndex(Index As Integer) As Boolean - Dim sTcPos As String = String.Empty - Dim sHead As String = String.Empty - Dim sGroup As String = String.Empty - Dim nErr As Integer = 999 - EgtLuaSetGlobIntVar("STU.INDEX", Index) - EgtLuaCallFunction("STU.GetTcPosHeadGroupFromPos") - ' Leggo variabili - EgtLuaGetGlobStringVar("STU.TCPOS", sTcPos) - EgtLuaGetGlobStringVar("STU.HEAD", sHead) - EgtLuaGetGlobStringVar("STU.GROUP", sGroup) - EgtLuaGetGlobIntVar("STU.ERR", nErr) - ' se l'indice del gruppo è valido - Dim nGroup As Integer = If(Integer.TryParse(sGroup.Trim("G"c), nGroup), nGroup, 0) - If VerifyIndexValidity(nGroup) Then - m_PositionGroupList(nGroup - 1).PositionList.Add(New Position(sTcPos, sHead, EgtGetHeadExitCount(sHead))) + ' leggo l'attrezzaggio del progetto + Dim sPosition As String = String.Empty + Dim IniIndex As Integer = 1 + ' recupero stringa di ogni posizione + While EgtGetInfo(nSetUpGroup, K_POS & IniIndex, sPosition) + If IniIndex <= Index Then + ReadPositionString(IniIndex, sPosition, True) + Else + EgtRemoveInfo(nSetUpGroup, K_POS & IniIndex) End If - Return (nErr = 0) - End Function + IniIndex += 1 + End While - ' funzione che mantiene le posizioni ma elimina tutti gli utensili attrezzati - Private Sub ClearAllPos() - For GroupIndex = 0 To m_PositionGroupList.Count - 1 - For PositionIndex = 0 To m_PositionGroupList(GroupIndex).PositionList.Count - 1 - For ExitIndex = 0 To m_PositionGroupList(GroupIndex).PositionList(PositionIndex).ExitToolAssociationList.Count - 1 - Dim TempExit As ExitToolAssociation = m_PositionGroupList(GroupIndex).PositionList(PositionIndex).ExitToolAssociationList(ExitIndex) - ' e lo tolgo dalla posizione di attrezzaggio - TempExit.Tool = Nothing - TempExit.IsOccupied = False - Next + End Sub + + ' Funzione che dato l'indice di una posizione, la crea secondo il modello standard presente nello script Lua + Private Function CreateStdPosFromPosIndex(Index As Integer) As Boolean + Dim sTcPos As String = String.Empty + Dim sHead As String = String.Empty + Dim sGroup As String = String.Empty + Dim nErr As Integer = 999 + EgtLuaSetGlobIntVar("STU.INDEX", Index) + EgtLuaCallFunction("STU.GetTcPosHeadGroupFromPos") + ' Leggo variabili + EgtLuaGetGlobStringVar("STU.TCPOS", sTcPos) + EgtLuaGetGlobStringVar("STU.HEAD", sHead) + EgtLuaGetGlobStringVar("STU.GROUP", sGroup) + EgtLuaGetGlobIntVar("STU.ERR", nErr) + ' se l'indice del gruppo è valido + Dim nGroup As Integer = If(Integer.TryParse(sGroup.Trim("G"c), nGroup), nGroup, 0) + If VerifyIndexValidity(nGroup) Then + m_PositionGroupList(nGroup - 1).PositionList.Add(New Position(sTcPos, sHead, EgtGetHeadExitCount(sHead))) + End If + Return (nErr = 0) + End Function + + ' funzione che mantiene le posizioni ma elimina tutti gli utensili attrezzati + Private Sub ClearAllPos() + For GroupIndex = 0 To m_PositionGroupList.Count - 1 + For PositionIndex = 0 To m_PositionGroupList(GroupIndex).PositionList.Count - 1 + For ExitIndex = 0 To m_PositionGroupList(GroupIndex).PositionList(PositionIndex).ExitToolAssociationList.Count - 1 + Dim TempExit As ExitToolAssociation = m_PositionGroupList(GroupIndex).PositionList(PositionIndex).ExitToolAssociationList(ExitIndex) + ' e lo tolgo dalla posizione di attrezzaggio + TempExit.Tool = Nothing + TempExit.IsOccupied = False Next Next - End Sub + Next + End Sub - ' Funzione che verifica che l'indice del gruppo sia valido, esista, e nel caso non esistesse aggiunge i gruppi necessari - Private Function VerifyIndexValidity(nGroupIndex As Integer) As Boolean - ' verifico che l'indice del gruppo sia valido - If nGroupIndex >= 1 Then - ' verifico che l'indice del gruppo sia compreso nel range di quelli esistenti - If nGroupIndex <= m_PositionGroupList.Count Then - Return True - ' se l'indice è maggiore di quelli presenti nella lista dei gruppi - Else - ' aggiungo i gruppi che mancano fino all'indice del mio - For GroupIndex = m_PositionGroupList.Count To nGroupIndex - 1 - m_PositionGroupList.Add(New PositionGroup) - Next - Return True - End If - ' altrimenti + ' Funzione che verifica che l'indice del gruppo sia valido, esista, e nel caso non esistesse aggiunge i gruppi necessari + Private Function VerifyIndexValidity(nGroupIndex As Integer) As Boolean + ' verifico che l'indice del gruppo sia valido + If nGroupIndex >= 1 Then + ' verifico che l'indice del gruppo sia compreso nel range di quelli esistenti + If nGroupIndex <= m_PositionGroupList.Count Then + Return True + ' se l'indice è maggiore di quelli presenti nella lista dei gruppi Else - ' mi assicuro che esista il primo gruppo - VerifyIndexValidity(1) - Return False - End If - End Function - - ' Funzione che dati l'indice della posizione e la sua stringa di attrezzaggio, carica l'attrezzaggio descritto - Private Sub ReadPositionString(nIndex As Integer, sPosition As String, bOriginal As Boolean) - Dim sTcPos As String = String.Empty - Dim sHead As String = String.Empty - Dim sExitList As New List(Of String) - Dim sToolList As New List(Of String) - ' la spezzo sui ; - Dim sItems() As String = sPosition.Split(";".ToCharArray) - ' se c'è almeno un elemento sono sicuro che ci sia la T - If sItems.Count() >= 1 Then - Dim nGroup As Integer = 0 - sTcPos = sItems(0) - ' recupero il suo gruppo - If Not GetGroupFromTcPos(sTcPos, nGroup) Then - ' se non lo trovo lo metto nel primo - nGroup = 1 - End If - If Not VerifyIndexValidity(nGroup) Then - ' se mi viene passato un indice non valido, lo metto nel primo - nGroup = 1 - End If - ' se ci sono almeno due elementi sono sicuro che ci sia la H - If sItems.Count >= 2 Then - sHead = sItems(1) - ' se ci sono almeno tre elementi sono sicuro che ci sia almeno un'uscita attrezzata - If sItems.Count >= 3 Then - ' separo le uscite divise dalla , - Dim sExitToolAssList() As String = sItems(2).Split(",".ToCharArray) - sExitList.Clear() - sToolList.Clear() - ' creo le liste di uscite e utensili attrezzati ricavati - For AssIndex = 0 To sExitToolAssList.Count() - 1 - Dim sExitToolAssItem() As String = sExitToolAssList(AssIndex).Split("/".ToCharArray) - If sExitToolAssItem.Count > 1 Then - sExitList.Add(sExitToolAssItem(0)) - sToolList.Add(sExitToolAssItem(1)) - End If - Next - ' analizzo la lista di utensili attrezzati - For ToolIndex = 0 To sToolList.Count - 1 - If Not String.IsNullOrEmpty(sToolList(ToolIndex)) Then - Dim TempTool As ToolItem = Nothing - Dim TempFamilyIndex As Integer = -1 - Dim TempToolIndex As Integer = -1 - Dim bToolFound As Boolean = False - ' cerco l'utensile attrezzato nella lista utensili - For FamilyListIndex = 0 To m_ToolsList.Count - 1 - For ToolListIndex = 0 To m_ToolsList(FamilyListIndex).Items.Count - 1 - TempTool = DirectCast(m_ToolsList(FamilyListIndex).Items(ToolListIndex), ToolItem) - If TempTool.Uuid = sToolList(ToolIndex) Then - TempFamilyIndex = FamilyListIndex - TempToolIndex = ToolListIndex - bToolFound = True - Exit For - End If - Next - If bToolFound Then Exit For - Next - ' se lo trovo - If bToolFound Then - ' cerco la relativa uscita - Dim bFoundPos As Boolean = False - For PositionIndex = 0 To m_PositionGroupList(nGroup - 1).PositionList.Count - 1 - Dim TempPosition As Position = m_PositionGroupList(nGroup - 1).PositionList(PositionIndex) - If TempPosition.TcPos = sTcPos Then - bFoundPos = True - ' verifico se la testa è diversa - If TempPosition.Head <> sHead Then - ' altrimenti la sovrascrivo - TempPosition.Head = sHead - ' e verifico il numero di uscite - For ExitIndex = TempPosition.ExitToolAssociationList.Count + 1 To EgtGetHeadExitCount(sHead) - TempPosition.ExitToolAssociationList.Add(New ExitToolAssociation(ExitIndex.ToString, TempPosition)) - Next - For ExitIndex = TempPosition.ExitToolAssociationList.Count - 1 To EgtGetHeadExitCount(sHead) Step -1 - TempPosition.ExitToolAssociationList.RemoveAt(ExitIndex) - Next - End If - For ExitIndex = 0 To TempPosition.ExitToolAssociationList.Count - 1 - Dim CurrExitToolAss As ExitToolAssociation = TempPosition.ExitToolAssociationList(ExitIndex) - If CurrExitToolAss.ExitPar = sExitList(ToolIndex) Then - ' vi metto l'utensile e segno l'uscita come occupata - CurrExitToolAss.Tool = TempTool - CurrExitToolAss.IsOccupied = True - CurrExitToolAss.NotifyPropertyChanged("ToolTipMsg") - ' lo metto anche come utensile originale - If bOriginal Then CurrExitToolAss.OrigTool = TempTool - Exit For - End If - Next - Exit For - End If - Next - ' se posizione trovata, devo togliere l'utensile dalla lista utensili - If bFoundPos Then - m_ToolsList(TempFamilyIndex).Items.Remove(m_ToolsList(TempFamilyIndex).Items(TempToolIndex)) - End If - ' altrimenti, se non l'ho trovato - Else - Dim sSearchedTool As String = String.Empty - EgtTdbGetToolFromUUID(sToolList(ToolIndex), sSearchedTool) - If Not String.IsNullOrWhiteSpace(sSearchedTool) Then - ' Impossibile trovare l'utensile xxx nel DB utensili - MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 3) & " " & sSearchedTool & " " & EgtMsg(MSG_SETUPERRORS + 4), EgtMsg(MSG_SETUPERRORS + 2), MessageBoxButton.OK, MessageBoxImage.Error) - Else - ' Impossibile trovare l'utensile nel DB utensili - MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 3) & " " & EgtMsg(MSG_SETUPERRORS + 4), EgtMsg(MSG_SETUPERRORS + 2), MessageBoxButton.OK, MessageBoxImage.Error) - End If - End If - End If - Next - End If - End If - End If - End Sub - - '' Funzione che dati l'indice della posizione e la sua stringa di attrezzaggio, carica l'attrezzaggio descritto - 'Private Sub ReadPositionString(nIndex As Integer, sPosition As String) - ' Dim sTcPos As String = String.Empty - ' Dim sHead As String = String.Empty - ' Dim sExitList As New List(Of String) - ' Dim sToolList As New List(Of String) - ' ' la spezzo sui ; - ' Dim sItems() As String = sPosition.Split(";".ToCharArray) - ' ' se c'è almeno un elemento sono sicuro che ci sia la T - ' If sItems.Count() >= 1 Then - ' Dim nGroup As Integer = 0 - ' sTcPos = sItems(0) - ' ' recupero il suo gruppo - ' If Not GetGroupFromTcPos(sTcPos, nGroup) Then - ' ' se non lo trovo lo metto nel primo - ' nGroup = 1 - ' End If - ' If Not VerifyIndexValidity(nGroup) Then - ' ' se mi viene passato un indice non valido, lo metto nel primo - ' nGroup = 1 - ' End If - ' ' se ci sono almeno due elementi sono sicuro che ci sia la H - ' If sItems.Count >= 2 Then - ' sHead = sItems(1) - ' m_PositionGroupList(nGroup - 1).PositionList.Add(New Position(sTcPos, sHead, EgtGetHeadExitCount(sHead))) - ' ' se ci sono almeno tre elementi sono sicuro che ci sia almeno un'uscita attrezzata - ' If sItems.Count >= 3 Then - ' ' separo le uscite divise dalla , - ' Dim sExitToolAssList() As String = sItems(2).Split(",".ToCharArray) - ' sExitList.Clear() - ' sToolList.Clear() - ' ' creo le liste di uscite e utensili attrezzati ricavati - ' For AssIndex = 0 To sExitToolAssList.Count() - 1 - ' Dim sExitToolAssItem() As String = sExitToolAssList(AssIndex).Split("/".ToCharArray) - ' If sExitToolAssItem.Count > 1 Then - ' sExitList.Add(sExitToolAssItem(0)) - ' sToolList.Add(sExitToolAssItem(1)) - ' End If - ' Next - ' ' analizzo la lista di utensili attrezzati - ' For ToolIndex = 0 To sToolList.Count - 1 - ' If Not String.IsNullOrEmpty(sToolList(ToolIndex)) Then - ' Dim TempTool As ToolItem = Nothing - ' Dim bFound As Boolean = False - ' ' cerco l'utensile attrezzato nella lista utensili - ' For FamilyListIndex = 0 To m_ToolsList.Count - 1 - ' For ToolListIndex = 0 To m_ToolsList(FamilyListIndex).Items.Count - 1 - ' TempTool = DirectCast(m_ToolsList(FamilyListIndex).Items(ToolListIndex), ToolItem) - ' If TempTool.Uuid = sToolList(ToolIndex) Then - ' ' lo salvo in una variabile temporanea e lo tolgo dalla lista - ' m_ToolsList(FamilyListIndex).Items.Remove(m_ToolsList(FamilyListIndex).Items(ToolListIndex)) - ' bFound = True - ' Exit For - ' End If - ' Next - ' If bFound Then Exit For - ' Next - ' ' se lo trovo - ' If bFound Then - ' ' cerco la relativa uscita - ' For ExitIndex = 0 To m_PositionGroupList(nGroup - 1).PositionList(m_PositionGroupList(nGroup - 1).PositionList.Count - 1).ExitToolAssociationList.Count - 1 - ' Dim CurrExitToolAss As ExitToolAssociation = m_PositionGroupList(nGroup - 1).PositionList(m_PositionGroupList(nGroup - 1).PositionList.Count - 1).ExitToolAssociationList(ExitIndex) - ' If CurrExitToolAss.ExitPar = sExitList(ToolIndex) Then - ' ' vi metto l'utensile e segno l'uscita come occupata - ' CurrExitToolAss.Tool = TempTool - ' CurrExitToolAss.IsOccupied = True - ' ' lo metto anche come utensile originale - ' CurrExitToolAss.OrigTool = TempTool - ' Exit For - ' End If - ' Next - ' ' altrimenti, se non l'ho trovato - ' Else - ' Dim sSearchedTool As String = String.Empty - ' EgtTdbGetToolFromUUID(sToolList(ToolIndex), sSearchedTool) - ' MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 3) & " " & sSearchedTool & " " & EgtMsg(MSG_SETUPERRORS + 4), EgtMsg(MSG_SETUPERRORS + 2), MessageBoxButton.OK, MessageBoxImage.Error) - ' End If - ' End If - ' Next - ' End If - ' ' non è presente la H, quindi la recupero dal modello delle posizioni nel file MachIni - ' Else - ' CreateStdPosFromPosIndex(nIndex) - ' End If - ' End If - - 'End Sub - - ' Funzione che data una T restituisce il gruppo a cui appartiene - Private Function GetGroupFromTcPos(sTcPos As String, ByRef nGroup As Integer) As Boolean - Dim sGroup As String = String.Empty - Dim nErr As Integer = 999 - EgtLuaSetGlobStringVar("STU.TCPOS", sTcPos) - EgtLuaCallFunction("STU.GetGroupFromTcPos") - ' Leggo variabili - EgtLuaGetGlobStringVar("STU.GROUP", sGroup) - EgtLuaGetGlobIntVar("STU.ERR", nErr) - If nErr = 0 Then - nGroup = If(Integer.TryParse(sGroup.Trim("G"c), nGroup), nGroup, 0) + ' aggiungo i gruppi che mancano fino all'indice del mio + For GroupIndex = m_PositionGroupList.Count To nGroupIndex - 1 + m_PositionGroupList.Add(New PositionGroup) + Next Return True End If - nGroup = 0 + ' altrimenti + Else + ' mi assicuro che esista il primo gruppo + VerifyIndexValidity(1) Return False - End Function + End If + End Function - Private Function GetPositionFromTcPos(sTcPos As String, ByRef nPosIndex As Integer) As Boolean - Dim sPosition As String = String.Empty - Dim nErr As Integer = 999 - EgtLuaSetGlobStringVar("STU.TCPOS", sTcPos) - EgtLuaCallFunction("STU.GetPosFromTcPos") - ' Leggo variabili - EgtLuaGetGlobStringVar("STU.POS", sPosition) - EgtLuaGetGlobIntVar("STU.ERR", nErr) - If nErr = 0 Then - nPosIndex = If(Integer.TryParse(sPosition.Replace("Pos", ""), nPosIndex), nPosIndex, -1) - Return (nPosIndex >= 0) + ' Funzione che dati l'indice della posizione e la sua stringa di attrezzaggio, carica l'attrezzaggio descritto + Private Sub ReadPositionString(nIndex As Integer, sPosition As String, bOriginal As Boolean) + Dim sTcPos As String = String.Empty + Dim sHead As String = String.Empty + Dim sExitList As New List(Of String) + Dim sToolList As New List(Of String) + ' la spezzo sui ; + Dim sItems() As String = sPosition.Split(";".ToCharArray) + ' se c'è almeno un elemento sono sicuro che ci sia la T + If sItems.Count() >= 1 Then + Dim nGroup As Integer = 0 + sTcPos = sItems(0) + ' recupero il suo gruppo + If Not GetGroupFromTcPos(sTcPos, nGroup) Then + ' se non lo trovo lo metto nel primo + nGroup = 1 End If - nPosIndex = -1 - Return False - End Function - - ' Funzione che verifica se ci sono state modifiche all'attrezzaggio corrente - Private Function IsModifiedSetUp() As Boolean - For GroupIndex = 0 To PositionGroupList.Count - 1 - For PositionIndex = 0 To PositionGroupList(GroupIndex).PositionList.Count - 1 - For ExitIndex = 0 To PositionGroupList(GroupIndex).PositionList(PositionIndex).ExitToolAssociationList.Count - 1 - Dim CurrExitToolAss As ExitToolAssociation = PositionGroupList(GroupIndex).PositionList(PositionIndex).ExitToolAssociationList(ExitIndex) - If CurrExitToolAss.m_IsModifiedTool Then - Return True + If Not VerifyIndexValidity(nGroup) Then + ' se mi viene passato un indice non valido, lo metto nel primo + nGroup = 1 + End If + ' se ci sono almeno due elementi sono sicuro che ci sia la H + If sItems.Count >= 2 Then + sHead = sItems(1) + ' se ci sono almeno tre elementi sono sicuro che ci sia almeno un'uscita attrezzata + If sItems.Count >= 3 Then + ' separo le uscite divise dalla , + Dim sExitToolAssList() As String = sItems(2).Split(",".ToCharArray) + sExitList.Clear() + sToolList.Clear() + ' creo le liste di uscite e utensili attrezzati ricavati + For AssIndex = 0 To sExitToolAssList.Count() - 1 + Dim sExitToolAssItem() As String = sExitToolAssList(AssIndex).Split("/".ToCharArray) + If sExitToolAssItem.Count > 1 Then + sExitList.Add(sExitToolAssItem(0)) + sToolList.Add(sExitToolAssItem(1)) End If Next + ' analizzo la lista di utensili attrezzati + For ToolIndex = 0 To sToolList.Count - 1 + If Not String.IsNullOrEmpty(sToolList(ToolIndex)) Then + Dim TempTool As ToolItem = Nothing + Dim TempFamilyIndex As Integer = -1 + Dim TempToolIndex As Integer = -1 + Dim bToolFound As Boolean = False + ' cerco l'utensile attrezzato nella lista utensili + For FamilyListIndex = 0 To m_ToolsList.Count - 1 + For ToolListIndex = 0 To m_ToolsList(FamilyListIndex).Items.Count - 1 + TempTool = DirectCast(m_ToolsList(FamilyListIndex).Items(ToolListIndex), ToolItem) + If TempTool.Uuid = sToolList(ToolIndex) Then + TempFamilyIndex = FamilyListIndex + TempToolIndex = ToolListIndex + bToolFound = True + Exit For + End If + Next + If bToolFound Then Exit For + Next + ' se lo trovo + If bToolFound Then + ' cerco la relativa uscita + Dim bFoundPos As Boolean = False + For PositionIndex = 0 To m_PositionGroupList(nGroup - 1).PositionList.Count - 1 + Dim TempPosition As Position = m_PositionGroupList(nGroup - 1).PositionList(PositionIndex) + If TempPosition.TcPos = sTcPos Then + bFoundPos = True + ' verifico se la testa è diversa + If TempPosition.Head <> sHead Then + ' altrimenti la sovrascrivo + TempPosition.Head = sHead + ' e verifico il numero di uscite + For ExitIndex = TempPosition.ExitToolAssociationList.Count + 1 To EgtGetHeadExitCount(sHead) + TempPosition.ExitToolAssociationList.Add(New ExitToolAssociation(ExitIndex.ToString, TempPosition)) + Next + For ExitIndex = TempPosition.ExitToolAssociationList.Count - 1 To EgtGetHeadExitCount(sHead) Step -1 + TempPosition.ExitToolAssociationList.RemoveAt(ExitIndex) + Next + End If + For ExitIndex = 0 To TempPosition.ExitToolAssociationList.Count - 1 + Dim CurrExitToolAss As ExitToolAssociation = TempPosition.ExitToolAssociationList(ExitIndex) + If CurrExitToolAss.ExitPar = sExitList(ToolIndex) Then + ' vi metto l'utensile e segno l'uscita come occupata + CurrExitToolAss.Tool = TempTool + CurrExitToolAss.IsOccupied = True + CurrExitToolAss.NotifyPropertyChanged("ToolTipMsg") + ' lo metto anche come utensile originale + If bOriginal Then CurrExitToolAss.OrigTool = TempTool + Exit For + End If + Next + Exit For + End If + Next + ' se posizione trovata, devo togliere l'utensile dalla lista utensili + If bFoundPos Then + m_ToolsList(TempFamilyIndex).Items.Remove(m_ToolsList(TempFamilyIndex).Items(TempToolIndex)) + End If + ' altrimenti, se non l'ho trovato + Else + Dim sSearchedTool As String = String.Empty + EgtTdbGetToolFromUUID(sToolList(ToolIndex), sSearchedTool) + If Not String.IsNullOrWhiteSpace(sSearchedTool) Then + ' Impossibile trovare l'utensile xxx nel DB utensili + MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 3) & " " & sSearchedTool & " " & EgtMsg(MSG_SETUPERRORS + 4), EgtMsg(MSG_SETUPERRORS + 2), MessageBoxButton.OK, MessageBoxImage.Error) + Else + ' Impossibile trovare l'utensile nel DB utensili + MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 3) & " " & EgtMsg(MSG_SETUPERRORS + 4), EgtMsg(MSG_SETUPERRORS + 2), MessageBoxButton.OK, MessageBoxImage.Error) + End If + End If + End If + Next + End If + End If + End If + End Sub + + '' Funzione che dati l'indice della posizione e la sua stringa di attrezzaggio, carica l'attrezzaggio descritto + 'Private Sub ReadPositionString(nIndex As Integer, sPosition As String) + ' Dim sTcPos As String = String.Empty + ' Dim sHead As String = String.Empty + ' Dim sExitList As New List(Of String) + ' Dim sToolList As New List(Of String) + ' ' la spezzo sui ; + ' Dim sItems() As String = sPosition.Split(";".ToCharArray) + ' ' se c'è almeno un elemento sono sicuro che ci sia la T + ' If sItems.Count() >= 1 Then + ' Dim nGroup As Integer = 0 + ' sTcPos = sItems(0) + ' ' recupero il suo gruppo + ' If Not GetGroupFromTcPos(sTcPos, nGroup) Then + ' ' se non lo trovo lo metto nel primo + ' nGroup = 1 + ' End If + ' If Not VerifyIndexValidity(nGroup) Then + ' ' se mi viene passato un indice non valido, lo metto nel primo + ' nGroup = 1 + ' End If + ' ' se ci sono almeno due elementi sono sicuro che ci sia la H + ' If sItems.Count >= 2 Then + ' sHead = sItems(1) + ' m_PositionGroupList(nGroup - 1).PositionList.Add(New Position(sTcPos, sHead, EgtGetHeadExitCount(sHead))) + ' ' se ci sono almeno tre elementi sono sicuro che ci sia almeno un'uscita attrezzata + ' If sItems.Count >= 3 Then + ' ' separo le uscite divise dalla , + ' Dim sExitToolAssList() As String = sItems(2).Split(",".ToCharArray) + ' sExitList.Clear() + ' sToolList.Clear() + ' ' creo le liste di uscite e utensili attrezzati ricavati + ' For AssIndex = 0 To sExitToolAssList.Count() - 1 + ' Dim sExitToolAssItem() As String = sExitToolAssList(AssIndex).Split("/".ToCharArray) + ' If sExitToolAssItem.Count > 1 Then + ' sExitList.Add(sExitToolAssItem(0)) + ' sToolList.Add(sExitToolAssItem(1)) + ' End If + ' Next + ' ' analizzo la lista di utensili attrezzati + ' For ToolIndex = 0 To sToolList.Count - 1 + ' If Not String.IsNullOrEmpty(sToolList(ToolIndex)) Then + ' Dim TempTool As ToolItem = Nothing + ' Dim bFound As Boolean = False + ' ' cerco l'utensile attrezzato nella lista utensili + ' For FamilyListIndex = 0 To m_ToolsList.Count - 1 + ' For ToolListIndex = 0 To m_ToolsList(FamilyListIndex).Items.Count - 1 + ' TempTool = DirectCast(m_ToolsList(FamilyListIndex).Items(ToolListIndex), ToolItem) + ' If TempTool.Uuid = sToolList(ToolIndex) Then + ' ' lo salvo in una variabile temporanea e lo tolgo dalla lista + ' m_ToolsList(FamilyListIndex).Items.Remove(m_ToolsList(FamilyListIndex).Items(ToolListIndex)) + ' bFound = True + ' Exit For + ' End If + ' Next + ' If bFound Then Exit For + ' Next + ' ' se lo trovo + ' If bFound Then + ' ' cerco la relativa uscita + ' For ExitIndex = 0 To m_PositionGroupList(nGroup - 1).PositionList(m_PositionGroupList(nGroup - 1).PositionList.Count - 1).ExitToolAssociationList.Count - 1 + ' Dim CurrExitToolAss As ExitToolAssociation = m_PositionGroupList(nGroup - 1).PositionList(m_PositionGroupList(nGroup - 1).PositionList.Count - 1).ExitToolAssociationList(ExitIndex) + ' If CurrExitToolAss.ExitPar = sExitList(ToolIndex) Then + ' ' vi metto l'utensile e segno l'uscita come occupata + ' CurrExitToolAss.Tool = TempTool + ' CurrExitToolAss.IsOccupied = True + ' ' lo metto anche come utensile originale + ' CurrExitToolAss.OrigTool = TempTool + ' Exit For + ' End If + ' Next + ' ' altrimenti, se non l'ho trovato + ' Else + ' Dim sSearchedTool As String = String.Empty + ' EgtTdbGetToolFromUUID(sToolList(ToolIndex), sSearchedTool) + ' MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 3) & " " & sSearchedTool & " " & EgtMsg(MSG_SETUPERRORS + 4), EgtMsg(MSG_SETUPERRORS + 2), MessageBoxButton.OK, MessageBoxImage.Error) + ' End If + ' End If + ' Next + ' End If + ' ' non è presente la H, quindi la recupero dal modello delle posizioni nel file MachIni + ' Else + ' CreateStdPosFromPosIndex(nIndex) + ' End If + ' End If + + 'End Sub + + ' Funzione che data una T restituisce il gruppo a cui appartiene + Private Function GetGroupFromTcPos(sTcPos As String, ByRef nGroup As Integer) As Boolean + Dim sGroup As String = String.Empty + Dim nErr As Integer = 999 + EgtLuaSetGlobStringVar("STU.TCPOS", sTcPos) + EgtLuaCallFunction("STU.GetGroupFromTcPos") + ' Leggo variabili + EgtLuaGetGlobStringVar("STU.GROUP", sGroup) + EgtLuaGetGlobIntVar("STU.ERR", nErr) + If nErr = 0 Then + nGroup = If(Integer.TryParse(sGroup.Trim("G"c), nGroup), nGroup, 0) + Return True + End If + nGroup = 0 + Return False + End Function + + Private Function GetPositionFromTcPos(sTcPos As String, ByRef nPosIndex As Integer) As Boolean + Dim sPosition As String = String.Empty + Dim nErr As Integer = 999 + EgtLuaSetGlobStringVar("STU.TCPOS", sTcPos) + EgtLuaCallFunction("STU.GetPosFromTcPos") + ' Leggo variabili + EgtLuaGetGlobStringVar("STU.POS", sPosition) + EgtLuaGetGlobIntVar("STU.ERR", nErr) + If nErr = 0 Then + nPosIndex = If(Integer.TryParse(sPosition.Replace("Pos", ""), nPosIndex), nPosIndex, -1) + Return (nPosIndex >= 0) + End If + nPosIndex = -1 + Return False + End Function + + ' Funzione che verifica se ci sono state modifiche all'attrezzaggio corrente + Private Function IsModifiedSetUp() As Boolean + For GroupIndex = 0 To PositionGroupList.Count - 1 + For PositionIndex = 0 To PositionGroupList(GroupIndex).PositionList.Count - 1 + For ExitIndex = 0 To PositionGroupList(GroupIndex).PositionList(PositionIndex).ExitToolAssociationList.Count - 1 + Dim CurrExitToolAss As ExitToolAssociation = PositionGroupList(GroupIndex).PositionList(PositionIndex).ExitToolAssociationList(ExitIndex) + If CurrExitToolAss.m_IsModifiedTool Then + Return True + End If Next Next - Return False - End Function + Next + Return False + End Function - ' Funzione che verifica se ci sono state modifiche all'attrezzaggio corrente e permette di attivare e disattivare il bottone applica - Private Sub IsEnabledBtns() - m_IsEnabledApplyBtn = IsModifiedSetUp() - NotifyPropertyChanged("IsEnabledApplyBtn") - End Sub + ' Funzione che verifica se ci sono state modifiche all'attrezzaggio corrente e permette di attivare e disattivare il bottone applica + Private Sub IsEnabledBtns() + m_IsEnabledApplyBtn = IsModifiedSetUp() + NotifyPropertyChanged("IsEnabledApplyBtn") + End Sub #Region "COMMANDS" #Region "ApplyCommand" - ''' - ''' Returns a command that do Exec. - ''' - Public ReadOnly Property ApplyCommand As ICommand - Get - If m_cmdApply Is Nothing Then - m_cmdApply = New Command(AddressOf Apply) - End If - Return m_cmdApply - End Get - End Property + ''' + ''' Returns a command that do Exec. + ''' + Public ReadOnly Property ApplyCommand As ICommand + Get + If m_cmdApply Is Nothing Then + m_cmdApply = New Command(AddressOf Apply) + End If + Return m_cmdApply + End Get + End Property - ''' - ''' Execute the Exec. This method is invoked by the ExecCommand. - ''' - Public Sub Apply() - ' ricavo il gruppo in cui mettere l'attrezzaggio - Dim nSetUpGroup As Integer = EgtGetCurrSetup() - For GroupIndex = 0 To m_PositionGroupList.Count - 1 - For PositionIndex = 0 To m_PositionGroupList(GroupIndex).PositionList.Count - 1 - Dim CurrPosition As Position = m_PositionGroupList(GroupIndex).PositionList(PositionIndex) - Dim sPosition As String = String.Empty - sPosition = CurrPosition.TcPos - Dim sExitToolAssociation As String = String.Empty - For ExitIndex = 0 To CurrPosition.ExitToolAssociationList.Count - 1 - Dim CurrExitToolAss As ExitToolAssociation = CurrPosition.ExitToolAssociationList(ExitIndex) - sExitToolAssociation &= If(CurrExitToolAss.IsOccupied, - CurrExitToolAss.ExitPar & "/" & - CurrExitToolAss.Tool.Uuid & "/" & - CurrExitToolAss.Tool.Name & ",", String.Empty) - CurrExitToolAss.OrigTool = CurrExitToolAss.Tool - Next - sExitToolAssociation = sExitToolAssociation.Trim(","c) - If Not String.IsNullOrEmpty(sExitToolAssociation) Then - sPosition &= ";" & CurrPosition.Head & ";" & sExitToolAssociation - End If - Dim nPosition As Integer - If GetPositionFromTcPos(CurrPosition.TcPos, nPosition) Then - EgtSetInfo(nSetUpGroup, K_POS & nPosition, sPosition) - End If + ''' + ''' Execute the Exec. This method is invoked by the ExecCommand. + ''' + Public Sub Apply() + ' ricavo il gruppo in cui mettere l'attrezzaggio + Dim nSetUpGroup As Integer = EgtGetCurrSetup() + For GroupIndex = 0 To m_PositionGroupList.Count - 1 + For PositionIndex = 0 To m_PositionGroupList(GroupIndex).PositionList.Count - 1 + Dim CurrPosition As Position = m_PositionGroupList(GroupIndex).PositionList(PositionIndex) + Dim sPosition As String = String.Empty + sPosition = CurrPosition.TcPos + Dim sExitToolAssociation As String = String.Empty + For ExitIndex = 0 To CurrPosition.ExitToolAssociationList.Count - 1 + Dim CurrExitToolAss As ExitToolAssociation = CurrPosition.ExitToolAssociationList(ExitIndex) + sExitToolAssociation &= If(CurrExitToolAss.IsOccupied, + CurrExitToolAss.ExitPar & "/" & + CurrExitToolAss.Tool.Uuid & "/" & + CurrExitToolAss.Tool.Name & ",", String.Empty) + CurrExitToolAss.OrigTool = CurrExitToolAss.Tool Next + sExitToolAssociation = sExitToolAssociation.Trim(","c) + If Not String.IsNullOrEmpty(sExitToolAssociation) Then + sPosition &= ";" & CurrPosition.Head & ";" & sExitToolAssociation + End If + Dim nPosition As Integer + If GetPositionFromTcPos(CurrPosition.TcPos, nPosition) Then + EgtSetInfo(nSetUpGroup, K_POS & nPosition, sPosition) + End If Next - m_IsEnabledApplyBtn = False - NotifyPropertyChanged("IsEnabledApplyBtn") - ' aggiorno le librerie sottostanti - EgtUpdateSetup() - End Sub + Next + m_IsEnabledApplyBtn = False + NotifyPropertyChanged("IsEnabledApplyBtn") + ' aggiorno le librerie sottostanti + EgtUpdateSetup() + End Sub #End Region ' ApplyCommand #Region "ArchiveCommand" - ''' - ''' Returns a command that do Exec. - ''' - Public ReadOnly Property ArchiveCommand As ICommand - Get - If m_cmdArchive Is Nothing Then - m_cmdArchive = New Command(AddressOf Archive) - End If - Return m_cmdArchive - End Get - End Property - - ''' - ''' Execute the Exec. This method is invoked by the ExecCommand. - ''' - Public Sub Archive(param As Object) - ' Direttorio per attrezzaggi - Dim sDir As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\SetUp" - Dim sPath As String = String.Empty - If Not Directory.Exists(sDir) Then - Try - Directory.CreateDirectory(sDir) - Catch ex As Exception - EgtOutLog("Error in SetupDir creation " & ex.ToString()) - Return - End Try + ''' + ''' Returns a command that do Exec. + ''' + Public ReadOnly Property ArchiveCommand As ICommand + Get + If m_cmdArchive Is Nothing Then + m_cmdArchive = New Command(AddressOf Archive) End If - ' Apertura dialogo di salvataggio - Dim SaveFileDialogView As New EgtWPFLib5.EgtSaveFileDialog - SaveFileDialogView.Title = EgtMsg(MSG_SETUP + 3) & " " & EgtMsg(MSG_SETUP + 1) - SaveFileDialogView.Extension = ".stu" - SaveFileDialogView.Directory = sDir - SaveFileDialogView.FileName = String.Empty - If Not SaveFileDialogView.EgtShowDialog Then + Return m_cmdArchive + End Get + End Property + + ''' + ''' Execute the Exec. This method is invoked by the ExecCommand. + ''' + Public Sub Archive(param As Object) + ' Direttorio per attrezzaggi + Dim sDir As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\SetUp" + Dim sPath As String = String.Empty + If Not Directory.Exists(sDir) Then + Try + Directory.CreateDirectory(sDir) + Catch ex As Exception + EgtOutLog("Error in SetupDir creation " & ex.ToString()) Return - End If - sPath = SaveFileDialogView.FileName + End Try + End If + ' Apertura dialogo di salvataggio + Dim SaveFileDialogView As New EgtWPFLib5.EgtSaveFileDialog + SaveFileDialogView.Title = EgtMsg(MSG_SETUP + 3) & " " & EgtMsg(MSG_SETUP + 1) + SaveFileDialogView.Extension = ".stu" + SaveFileDialogView.Directory = sDir + SaveFileDialogView.FileName = String.Empty + If Not SaveFileDialogView.EgtShowDialog Then + Return + End If + sPath = SaveFileDialogView.FileName - ' creo il file con il solo commento come prima linea - File.WriteAllLines(sPath, {"; Commento per evitare BOM con UTF-8"}, Text.Encoding.UTF8) + ' creo il file con il solo commento come prima linea + File.WriteAllLines(sPath, {"; Commento per evitare BOM con UTF-8"}, Text.Encoding.UTF8) - For GroupIndex = 0 To m_PositionGroupList.Count - 1 - For PositionIndex = 0 To m_PositionGroupList(GroupIndex).PositionList.Count - 1 - Dim CurrPosition As Position = m_PositionGroupList(GroupIndex).PositionList(PositionIndex) - Dim sPosition As String = String.Empty - sPosition = CurrPosition.TcPos - Dim sExitToolAssociation As String = String.Empty - For AssIndex = 0 To CurrPosition.ExitToolAssociationList.Count - 1 - sExitToolAssociation &= If(CurrPosition.ExitToolAssociationList(AssIndex).IsOccupied, - CurrPosition.ExitToolAssociationList(AssIndex).ExitPar & "/" & - CurrPosition.ExitToolAssociationList(AssIndex).Tool.Uuid & "/" & - CurrPosition.ExitToolAssociationList(AssIndex).Tool.Name & ",", String.Empty) - Next - sExitToolAssociation = sExitToolAssociation.Trim(","c) - If Not String.IsNullOrEmpty(sExitToolAssociation) Then - sPosition &= ";" & CurrPosition.Head & ";" & sExitToolAssociation - End If - Dim nPosition As Integer - If GetPositionFromTcPos(m_PositionGroupList(GroupIndex).PositionList(PositionIndex).TcPos, nPosition) Then - EgtUILib.WritePrivateProfileString(S_GENERAL, K_POS & nPosition, sPosition, sPath) - End If + For GroupIndex = 0 To m_PositionGroupList.Count - 1 + For PositionIndex = 0 To m_PositionGroupList(GroupIndex).PositionList.Count - 1 + Dim CurrPosition As Position = m_PositionGroupList(GroupIndex).PositionList(PositionIndex) + Dim sPosition As String = String.Empty + sPosition = CurrPosition.TcPos + Dim sExitToolAssociation As String = String.Empty + For AssIndex = 0 To CurrPosition.ExitToolAssociationList.Count - 1 + sExitToolAssociation &= If(CurrPosition.ExitToolAssociationList(AssIndex).IsOccupied, + CurrPosition.ExitToolAssociationList(AssIndex).ExitPar & "/" & + CurrPosition.ExitToolAssociationList(AssIndex).Tool.Uuid & "/" & + CurrPosition.ExitToolAssociationList(AssIndex).Tool.Name & ",", String.Empty) Next + sExitToolAssociation = sExitToolAssociation.Trim(","c) + If Not String.IsNullOrEmpty(sExitToolAssociation) Then + sPosition &= ";" & CurrPosition.Head & ";" & sExitToolAssociation + End If + Dim nPosition As Integer + If GetPositionFromTcPos(m_PositionGroupList(GroupIndex).PositionList(PositionIndex).TcPos, nPosition) Then + EgtUILib.WritePrivateProfileString(S_GENERAL, K_POS & nPosition, sPosition, sPath) + End If Next - End Sub + Next + End Sub #End Region ' ArchiveCommand #Region "RetrievesCommand" - ''' - ''' Returns a command that do Exec. - ''' - Public ReadOnly Property RetrievesCommand As ICommand - Get - If m_cmdRetrieves Is Nothing Then - m_cmdRetrieves = New Command(AddressOf Retrieves) - End If - Return m_cmdRetrieves - End Get - End Property + ''' + ''' Returns a command that do Exec. + ''' + Public ReadOnly Property RetrievesCommand As ICommand + Get + If m_cmdRetrieves Is Nothing Then + m_cmdRetrieves = New Command(AddressOf Retrieves) + End If + Return m_cmdRetrieves + End Get + End Property - ''' - ''' Execute the Exec. This method is invoked by the ExecCommand. - ''' - Public Sub Retrieves(param As Object) - ' Direttorio per attrezzaggi - Dim sDir As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\SetUp" - Dim sPath As String = String.Empty - If Not Directory.Exists(sDir) Then - EgtOutLog("Error in SetupDir retrieve : directory not found") - Return - End If - ' Apertura dialogo di salvataggio - Dim OpenFileDialogView As New EgtWPFLib5.EgtOpenFileDialog - OpenFileDialogView.Title = EgtMsg(MSG_SETUP + 4) & " " & EgtMsg(MSG_SETUP + 1) - OpenFileDialogView.Filter = "*.stu" - OpenFileDialogView.Directory = sDir - OpenFileDialogView.FileName = String.Empty - If Not OpenFileDialogView.EgtShowDialog Then - Return - End If - sPath = OpenFileDialogView.FileName + ''' + ''' Execute the Exec. This method is invoked by the ExecCommand. + ''' + Public Sub Retrieves(param As Object) + ' Direttorio per attrezzaggi + Dim sDir As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\SetUp" + Dim sPath As String = String.Empty + If Not Directory.Exists(sDir) Then + EgtOutLog("Error in SetupDir retrieve : directory not found") + Return + End If + ' Apertura dialogo di salvataggio + Dim OpenFileDialogView As New EgtWPFLib5.EgtOpenFileDialog + OpenFileDialogView.Title = EgtMsg(MSG_SETUP + 4) & " " & EgtMsg(MSG_SETUP + 1) + OpenFileDialogView.Filter = "*.stu" + OpenFileDialogView.Directory = sDir + OpenFileDialogView.FileName = String.Empty + If Not OpenFileDialogView.EgtShowDialog Then + Return + End If + sPath = OpenFileDialogView.FileName - ' resetto lista utensili e posizioni - m_ToolsList.Clear() - ClearAllPos() - 'ricarico lista utensili - LoadMachineTools() - ' leggo l'attrezzaggio dal file scelto - Dim sPosition As String = String.Empty - Dim IniIndex As Integer = 1 - ' recupero stringa di ogni posizione - While EgtUILib.GetPrivateProfileString(S_GENERAL, K_POS & IniIndex, String.Empty, sPosition, sPath) > 0 - ReadPositionString(IniIndex, sPosition, False) - IniIndex += 1 - End While - ' verifico se disabilitare questa posizione in base all'utensile correntemente selezionato - If Not TypeOf param Is ToolItem Then - ' disabilito tutte le uscite tranne quelle occupate - For GroupIndex = 0 To m_PositionGroupList.Count - 1 - For PosIndex = 0 To m_PositionGroupList(GroupIndex).PositionList.Count - 1 - m_PositionGroupList(GroupIndex).PositionList(PosIndex).SetNotValidPos() - Next + ' resetto lista utensili e posizioni + m_ToolsList.Clear() + ClearAllPos() + 'ricarico lista utensili + LoadMachineTools() + ' leggo l'attrezzaggio dal file scelto + Dim sPosition As String = String.Empty + Dim IniIndex As Integer = 1 + ' recupero stringa di ogni posizione + While EgtUILib.GetPrivateProfileString(S_GENERAL, K_POS & IniIndex, String.Empty, sPosition, sPath) > 0 + ReadPositionString(IniIndex, sPosition, False) + IniIndex += 1 + End While + ' verifico se disabilitare questa posizione in base all'utensile correntemente selezionato + If Not TypeOf param Is ToolItem Then + ' disabilito tutte le uscite tranne quelle occupate + For GroupIndex = 0 To m_PositionGroupList.Count - 1 + For PosIndex = 0 To m_PositionGroupList(GroupIndex).PositionList.Count - 1 + m_PositionGroupList(GroupIndex).PositionList(PosIndex).SetNotValidPos() Next - Else - Dim SelTool As ToolItem = DirectCast(param, ToolItem) - ' abilito e disabilito tutte le uscite in base all'utensile selezionato - For GroupIndex = 0 To m_PositionGroupList.Count - 1 - For PosIndex = 0 To m_PositionGroupList(GroupIndex).PositionList.Count - 1 - m_PositionGroupList(GroupIndex).PositionList(PosIndex).SetIsValidPosFromTool(SelTool.Uuid) - Next + Next + Else + Dim SelTool As ToolItem = DirectCast(param, ToolItem) + ' abilito e disabilito tutte le uscite in base all'utensile selezionato + For GroupIndex = 0 To m_PositionGroupList.Count - 1 + For PosIndex = 0 To m_PositionGroupList(GroupIndex).PositionList.Count - 1 + m_PositionGroupList(GroupIndex).PositionList(PosIndex).SetIsValidPosFromTool(SelTool.Uuid) Next - End If - IsEnabledBtns() - End Sub + Next + End If + IsEnabledBtns() + End Sub #End Region ' RetrievesCommand #Region "AutomaticCommand" - ''' - ''' Returns a command that do Exec. - ''' - Public ReadOnly Property AutomaticCommand As ICommand - Get - If m_cmdAutomatic Is Nothing Then - m_cmdAutomatic = New Command(AddressOf Automatic) - End If - Return m_cmdAutomatic - End Get - End Property - - ''' - ''' Execute the Exec. This method is invoked by the ExecCommand. - ''' - Public Sub Automatic(param As Object) - ' verifico il tipo di elemento selezionato - Dim bIsToolItem As Boolean = False - Dim SelTool As ToolItem = Nothing - If TypeOf param Is ToolItem Then - SelTool = DirectCast(param, ToolItem) - bIsToolItem = Not SelTool.IsInCurrMachGroup + ''' + ''' Returns a command that do Exec. + ''' + Public ReadOnly Property AutomaticCommand As ICommand + Get + If m_cmdAutomatic Is Nothing Then + m_cmdAutomatic = New Command(AddressOf Automatic) End If + Return m_cmdAutomatic + End Get + End Property - Dim ErrorList As New List(Of String) - ' analizzo la lista degli utensili alla ricerca di quelli usati nel progetto corrente - For FamilyIndex = 0 To m_ToolsList.Count - 1 - ' verifico se nella famiglia c'è almeno un utensile usato nel progetto - If m_ToolsList(FamilyIndex).HaveToolsInCurrMachGroup Then - ' analizzo gli utensili all'interno della famiglia - For ToolIndex = m_ToolsList(FamilyIndex).Items.Count - 1 To 0 Step -1 - Dim CurrTool As ToolItem = DirectCast(m_ToolsList(FamilyIndex).Items(ToolIndex), ToolItem) - ' se l'utensile è utilizzato - If CurrTool.IsInCurrMachGroup Then - ' lo attrezzo al suo posto predefinito - AutoSetUpTool(CurrTool, ErrorList) - End If - Next + ''' + ''' Execute the Exec. This method is invoked by the ExecCommand. + ''' + Public Sub Automatic(param As Object) + ' verifico il tipo di elemento selezionato + Dim bIsToolItem As Boolean = False + Dim SelTool As ToolItem = Nothing + If TypeOf param Is ToolItem Then + SelTool = DirectCast(param, ToolItem) + bIsToolItem = Not SelTool.IsInCurrMachGroup + End If + + Dim ErrorList As New List(Of String) + ' analizzo la lista degli utensili alla ricerca di quelli usati nel progetto corrente + For FamilyIndex = 0 To m_ToolsList.Count - 1 + ' verifico se nella famiglia c'è almeno un utensile usato nel progetto + If m_ToolsList(FamilyIndex).HaveToolsInCurrMachGroup Then + ' analizzo gli utensili all'interno della famiglia + For ToolIndex = m_ToolsList(FamilyIndex).Items.Count - 1 To 0 Step -1 + Dim CurrTool As ToolItem = DirectCast(m_ToolsList(FamilyIndex).Items(ToolIndex), ToolItem) + ' se l'utensile è utilizzato + If CurrTool.IsInCurrMachGroup Then + ' lo attrezzo al suo posto predefinito + AutoSetUpTool(CurrTool, ErrorList) + End If + Next + End If + Next + + ' verifico se ci sono errori + If ErrorList.Count > 0 Then + ' li raccolgo tutti nello stesso messaggio + Dim sError As String = EgtMsg(MSG_SETUPERRORS + 6) & Environment.NewLine + For ErrorIndex = 0 To ErrorList.Count - 1 + sError &= "- " & ErrorList(ErrorIndex) & Environment.NewLine + Next + MessageBox.Show(sError, EgtMsg(MSG_SETUPERRORS + 2), MessageBoxButton.OK, MessageBoxImage.Exclamation) + End If + + ' abilito e disabilito tutte le uscite in base all'utensile selezionato + For GroupIndex = 0 To m_PositionGroupList.Count - 1 + For PosIndex = 0 To m_PositionGroupList(GroupIndex).PositionList.Count - 1 + If bIsToolItem Then + m_PositionGroupList(GroupIndex).PositionList(PosIndex).SetIsValidPosFromTool(SelTool.Uuid) + Else + m_PositionGroupList(GroupIndex).PositionList(PosIndex).SetNotValidPos() End If Next + Next + ' aggiorno lo stato del bottone applica + IsEnabledBtns() + End Sub +#End Region ' AutomaticCommand + +#Region "CloseSetUpCommand" + + ''' + ''' Returns a command that remove the current selected machining. + ''' + Public ReadOnly Property CloseSetUpCommand() As ICommand + Get + If m_cmdCloseSetUp Is Nothing Then + m_cmdCloseSetUp = New RelayCommand(AddressOf CloseSetUp) + End If + Return m_cmdCloseSetUp + End Get + End Property + + ''' + ''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand. + ''' + Public Sub CloseSetUp() + + ' Verifico se l'attrezzaggio è stato modificato + If IsModifiedSetUp() Then + ' se modificato chiedo se salvarlo prima di uscire + If MessageBox.Show(EgtMsg(MSG_SETUP + 6), EgtMsg(MSG_SETUP + 2), MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then + ' lo salvo + Apply() + End If + End If + + ' Resetto tutti i delegate usati + ExitToolAssociation.m_delIsEnabledBtns = Nothing + ' Reset lua + EgtLuaResetGlobVar("STU") + + ' Chiusura finestra + For Each Window In Application.Current.Windows + If TypeOf Window Is SetUpWindowV Then + Dim SetUpWindow As SetUpWindowV = DirectCast(Window, SetUpWindowV) + SetUpWindow.Close() + End If + Next + End Sub + +#End Region ' CloseSetUpCommand + +#Region "ToolDoubleClickCommand" + + ''' + ''' Returns a command that do TreeViewDoubleClick. + ''' + Public ReadOnly Property ToolDoubleClickCommand As ICommand + Get + If m_cmdToolDoubleClick Is Nothing Then + m_cmdToolDoubleClick = New RelayCommand(AddressOf ToolDoubleClick) + End If + Return m_cmdToolDoubleClick + End Get + End Property + + ''' + ''' Execute the TreeViewDoubleClick. This method is invoked by the TreeViewDoubleClickCommand. + ''' + Public Sub ToolDoubleClick(ByVal param As Object) + If TypeOf param Is ToolItem Then + Dim SelTool As ToolItem = DirectCast(param, ToolItem) + Dim ErrorList As New List(Of String) + AutoSetUpTool(SelTool, ErrorList) ' verifico se ci sono errori If ErrorList.Count > 0 Then ' li raccolgo tutti nello stesso messaggio @@ -753,221 +843,127 @@ Namespace EgtCAM5 Next MessageBox.Show(sError, EgtMsg(MSG_SETUPERRORS + 2), MessageBoxButton.OK, MessageBoxImage.Exclamation) End If - - ' abilito e disabilito tutte le uscite in base all'utensile selezionato - For GroupIndex = 0 To m_PositionGroupList.Count - 1 - For PosIndex = 0 To m_PositionGroupList(GroupIndex).PositionList.Count - 1 - If bIsToolItem Then - m_PositionGroupList(GroupIndex).PositionList(PosIndex).SetIsValidPosFromTool(SelTool.uuid) - Else - m_PositionGroupList(GroupIndex).PositionList(PosIndex).SetNotValidPos() - End If - Next - Next - ' aggiorno lo stato del bottone applica IsEnabledBtns() - End Sub + End If + End Sub -#End Region ' AutomaticCommand - -#Region "CloseSetUpCommand" - - ''' - ''' Returns a command that remove the current selected machining. - ''' - Public ReadOnly Property CloseSetUpCommand() As ICommand - Get - If m_cmdCloseSetUp Is Nothing Then - m_cmdCloseSetUp = New RelayCommand(AddressOf CloseSetUp) - End If - Return m_cmdCloseSetUp - End Get - End Property - - ''' - ''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand. - ''' - Public Sub CloseSetUp() - - ' Verifico se l'attrezzaggio è stato modificato - If IsModifiedSetUp() Then - ' se modificato chiedo se salvarlo prima di uscire - If MessageBox.Show(EgtMsg(MSG_SETUP + 6), EgtMsg(MSG_SETUP + 2), MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then - ' lo salvo - Apply() - End If - End If - - ' Resetto tutti i delegate usati - ExitToolAssociation.m_delIsEnabledBtns = Nothing - ' Reset lua - EgtLuaResetGlobVar("STU") - - ' Chiusura finestra - For Each Window In Application.Current.Windows - If TypeOf Window Is SetUpWindowV Then - Dim SetUpWindow As SetUpWindowV = DirectCast(Window, SetUpWindowV) - SetUpWindow.Close() + Private Function AutoSetUpTool(SelTool As ToolItem, ByRef ErrorList As List(Of String)) As Boolean + ' cerco il TcPos dell'utensile selezionato nella lista di posizioni + For GroupIndex = 0 To m_PositionGroupList.Count - 1 + For PositionIndex = 0 To m_PositionGroupList(GroupIndex).PositionList.Count - 1 + Dim CurrPosition As Position = m_PositionGroupList(GroupIndex).PositionList(PositionIndex) + If CurrPosition.TcPos = SelTool.TcPos Then + AutoSetUpToolFromPos(SelTool, CurrPosition, ErrorList) End If Next - End Sub + Next + Return False + End Function -#End Region ' CloseSetUpCommand - -#Region "ToolDoubleClickCommand" - - ''' - ''' Returns a command that do TreeViewDoubleClick. - ''' - Public ReadOnly Property ToolDoubleClickCommand As ICommand - Get - If m_cmdToolDoubleClick Is Nothing Then - m_cmdToolDoubleClick = New RelayCommand(AddressOf ToolDoubleClick) - End If - Return m_cmdToolDoubleClick - End Get - End Property - - ''' - ''' Execute the TreeViewDoubleClick. This method is invoked by the TreeViewDoubleClickCommand. - ''' - Public Sub ToolDoubleClick(ByVal param As Object) - If TypeOf param Is ToolItem Then - Dim SelTool As ToolItem = DirectCast(param, ToolItem) - Dim ErrorList As New List(Of String) - AutoSetUpTool(SelTool, ErrorList) - ' verifico se ci sono errori - If ErrorList.Count > 0 Then - ' li raccolgo tutti nello stesso messaggio - Dim sError As String = EgtMsg(MSG_SETUPERRORS + 6) & Environment.NewLine - For ErrorIndex = 0 To ErrorList.Count - 1 - sError &= "- " & ErrorList(ErrorIndex) & Environment.NewLine - Next - MessageBox.Show(sError, EgtMsg(MSG_SETUPERRORS + 2), MessageBoxButton.OK, MessageBoxImage.Exclamation) - End If - IsEnabledBtns() - End If - End Sub - - Private Function AutoSetUpTool(SelTool As ToolItem, ByRef ErrorList As List(Of String)) As Boolean - ' cerco il TcPos dell'utensile selezionato nella lista di posizioni - For GroupIndex = 0 To m_PositionGroupList.Count - 1 - For PositionIndex = 0 To m_PositionGroupList(GroupIndex).PositionList.Count - 1 - Dim CurrPosition As Position = m_PositionGroupList(GroupIndex).PositionList(PositionIndex) - If CurrPosition.TcPos = SelTool.TcPos Then - AutoSetUpToolFromPos(SelTool, CurrPosition, ErrorList) - End If - Next - Next + Private Function AutoSetUpToolFromPos(SelTool As ToolItem, Position As Position, ByRef ErrorList As List(Of String)) As Boolean + Dim ExitToolAssociationList As ObservableCollection(Of ExitToolAssociation) = Position.ExitToolAssociationList + EgtLuaSetGlobStringVar("STU.TUUID", SelTool.Uuid) + EgtLuaSetGlobStringVar("STU.TCPOS", Position.TcPos) + EgtLuaCallFunction("STU.GetValidHeadExitForPos") + ' Leggo variabili + Dim sHead As String = String.Empty + EgtLuaGetGlobStringVar("STU.HEAD", sHead) + Dim nExit As Integer = 0 + EgtLuaGetGlobIntVar("STU.EXIT", nExit) + Dim nErr As Integer = 999 + EgtLuaGetGlobIntVar("STU.ERR", nErr) + If nErr <> 0 Then + Dim sToolName As String = String.Empty + EgtTdbGetToolFromUUID(SelTool.Uuid, sToolName) + EgtOutLog("Error in setup! Tool:" & sToolName & " TcPos: " & Position.TcPos) Return False - End Function - - Private Function AutoSetUpToolFromPos(SelTool As ToolItem, Position As Position, ByRef ErrorList As List(Of String)) As Boolean - Dim ExitToolAssociationList As ObservableCollection(Of ExitToolAssociation) = Position.ExitToolAssociationList - EgtLuaSetGlobStringVar("STU.TUUID", SelTool.Uuid) - EgtLuaSetGlobStringVar("STU.TCPOS", Position.TcPos) - EgtLuaCallFunction("STU.GetValidHeadExitForPos") - ' Leggo variabili - Dim sHead As String = String.Empty - EgtLuaGetGlobStringVar("STU.HEAD", sHead) - Dim nExit As Integer = 0 - EgtLuaGetGlobIntVar("STU.EXIT", nExit) - Dim nErr As Integer = 999 - EgtLuaGetGlobIntVar("STU.ERR", nErr) - If nErr <> 0 Then - Dim sToolName As String = String.Empty - EgtTdbGetToolFromUUID(SelTool.Uuid, sToolName) - EgtOutLog("Error in setup! Tool:" & sToolName & " TcPos: " & Position.TcPos) - Return False + End If + ' verifico se la posizione è libera o c'è un utensile attrezzato + Dim PosIsOccupied As Boolean = False + For ExitIndex = 0 To ExitToolAssociationList.Count - 1 + If ExitToolAssociationList(ExitIndex).IsOccupied Then + PosIsOccupied = True + Exit For End If - ' verifico se la posizione è libera o c'è un utensile attrezzato - Dim PosIsOccupied As Boolean = False - For ExitIndex = 0 To ExitToolAssociationList.Count - 1 - If ExitToolAssociationList(ExitIndex).IsOccupied Then - PosIsOccupied = True - Exit For - End If - Next - ' se la posizione non è valida, restituisco errore - If sHead = INVALIDPOS Then - EgtOutLog("SetUp warning: try to set " & SelTool.Name & " on " & Position.TcPos) - MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 5), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error) - Return False - ' altrimenti, se la posizione nell'attrezzaggio è vuota - ElseIf Not PosIsOccupied Then - ' verifico se la testa è la stessa - If Not Position.Head = sHead Then - ' altrimenti la sovrascrivo - Position.Head = sHead - ' e verifico il numero di uscite - For ExitIndex = Position.ExitToolAssociationList.Count + 1 To EgtGetHeadExitCount(sHead) - Position.ExitToolAssociationList.Add(New ExitToolAssociation(ExitIndex.ToString, Position)) - Next - For ExitIndex = Position.ExitToolAssociationList.Count - 1 To EgtGetHeadExitCount(sHead) Step -1 - Position.ExitToolAssociationList.RemoveAt(ExitIndex) - Next - End If + Next + ' se la posizione non è valida, restituisco errore + If sHead = INVALIDPOS Then + EgtOutLog("SetUp warning: try to set " & SelTool.Name & " on " & Position.TcPos) + MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 5), EgtMsg(MSG_SETUPERRORS + 1), MessageBoxButton.OK, MessageBoxImage.Error) + Return False + ' altrimenti, se la posizione nell'attrezzaggio è vuota + ElseIf Not PosIsOccupied Then + ' verifico se la testa è la stessa + If Not Position.Head = sHead Then + ' altrimenti la sovrascrivo + Position.Head = sHead + ' e verifico il numero di uscite + For ExitIndex = Position.ExitToolAssociationList.Count + 1 To EgtGetHeadExitCount(sHead) + Position.ExitToolAssociationList.Add(New ExitToolAssociation(ExitIndex.ToString, Position)) + Next + For ExitIndex = Position.ExitToolAssociationList.Count - 1 To EgtGetHeadExitCount(sHead) Step -1 + Position.ExitToolAssociationList.RemoveAt(ExitIndex) + Next + End If + ' lo aggiungo alla posizione di attrezzaggio e lo tolgo dalla lista utensili + SetToolInPos(SelTool, Position, nExit) + ' altrimenti, se le teste coincidono + ElseIf sHead = Position.Head Then + ' se l'uscita restituita è libera + If Not ExitToolAssociationList(nExit - 1).IsOccupied Then ' lo aggiungo alla posizione di attrezzaggio e lo tolgo dalla lista utensili SetToolInPos(SelTool, Position, nExit) - ' altrimenti, se le teste coincidono - ElseIf sHead = Position.Head Then - ' se l'uscita restituita è libera - If Not ExitToolAssociationList(nExit - 1).IsOccupied Then - ' lo aggiungo alla posizione di attrezzaggio e lo tolgo dalla lista utensili - SetToolInPos(SelTool, Position, nExit) - ' altrimenti restituisco falso - Else - ErrorList.Add(SelTool.Name) - 'MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 9) & " " & SelTool.Name & " " & EgtMsg(MSG_SETUPERRORS + 6), EgtMsg(MSG_SETUPERRORS + 2), MessageBoxButton.OK, MessageBoxImage.Exclamation) - Return False - End If ' altrimenti restituisco falso Else ErrorList.Add(SelTool.Name) 'MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 9) & " " & SelTool.Name & " " & EgtMsg(MSG_SETUPERRORS + 6), EgtMsg(MSG_SETUPERRORS + 2), MessageBoxButton.OK, MessageBoxImage.Exclamation) Return False End If - Return True - End Function + ' altrimenti restituisco falso + Else + ErrorList.Add(SelTool.Name) + 'MessageBox.Show(EgtMsg(MSG_SETUPERRORS + 9) & " " & SelTool.Name & " " & EgtMsg(MSG_SETUPERRORS + 6), EgtMsg(MSG_SETUPERRORS + 2), MessageBoxButton.OK, MessageBoxImage.Exclamation) + Return False + End If + Return True + End Function - Private Function SetToolInPos(SelTool As ToolItem, Position As Position, nExit As Integer) As Boolean - Dim bOk As Boolean = False - ' lo aggiungo alla posizione di attrezzaggio - For ExitIndex = 0 To Position.ExitToolAssociationList.Count - 1 - If ExitIndex = nExit - 1 Then - Position.ExitToolAssociationList(ExitIndex).Tool = SelTool - Position.ExitToolAssociationList(ExitIndex).IsOccupied = True - Position.ExitToolAssociationList(ExitIndex).NotifyPropertyChanged("ToolTipMsg") - bOk = True - Exit For - End If - Next - If Not bOk Then Return False - bOk = False - ' e lo tolgo dalla lista utensili - For Index = 0 To m_ToolsList.Count - 1 - If (SelTool.Type And m_ToolsList(Index).Type) > 0 Then - m_ToolsList(Index).Items.Remove(SelTool) - bOk = True - Exit For - End If - Next - Return bOk - End Function + Private Function SetToolInPos(SelTool As ToolItem, Position As Position, nExit As Integer) As Boolean + Dim bOk As Boolean = False + ' lo aggiungo alla posizione di attrezzaggio + For ExitIndex = 0 To Position.ExitToolAssociationList.Count - 1 + If ExitIndex = nExit - 1 Then + Position.ExitToolAssociationList(ExitIndex).Tool = SelTool + Position.ExitToolAssociationList(ExitIndex).IsOccupied = True + Position.ExitToolAssociationList(ExitIndex).NotifyPropertyChanged("ToolTipMsg") + bOk = True + Exit For + End If + Next + If Not bOk Then Return False + bOk = False + ' e lo tolgo dalla lista utensili + For Index = 0 To m_ToolsList.Count - 1 + If (SelTool.Type And m_ToolsList(Index).Type) > 0 Then + m_ToolsList(Index).Items.Remove(SelTool) + bOk = True + Exit For + End If + Next + Return bOk + End Function #End Region ' ToolDoubleClickCommand #End Region ' Commands - Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged + Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged - Public Sub NotifyPropertyChanged(propName As String) - RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) - End Sub + Public Sub NotifyPropertyChanged(propName As String) + RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName)) + End Sub - End Class - -End Namespace +End Class Public Class PositionGroup diff --git a/ShowPanel/ShowPanelVM.vb b/ShowPanel/ShowPanelVM.vb index 81bbdfa..f8a4961 100644 --- a/ShowPanel/ShowPanelVM.vb +++ b/ShowPanel/ShowPanelVM.vb @@ -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 \ No newline at end of file +End Class diff --git a/Special/GunStockWindow/GunStockWndVM.vb b/Special/GunStockWindow/GunStockWndVM.vb index d3f28d7..2f35d76 100644 --- a/Special/GunStockWindow/GunStockWndVM.vb +++ b/Special/GunStockWindow/GunStockWndVM.vb @@ -3,7 +3,6 @@ Imports System.Collections.ObjectModel Imports System.IO Imports EgtUILib - Public Class GunStockWndVM Implements INotifyPropertyChanged diff --git a/SpecialPanel/SpecialPanelVM.vb b/SpecialPanel/SpecialPanelVM.vb index 7531933..6790cc0 100644 --- a/SpecialPanel/SpecialPanelVM.vb +++ b/SpecialPanel/SpecialPanelVM.vb @@ -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 diff --git a/StatusBar/StatusBarVM.vb b/StatusBar/StatusBarVM.vb index 3af48c1..8163ba0 100644 --- a/StatusBar/StatusBarVM.vb +++ b/StatusBar/StatusBarVM.vb @@ -4,274 +4,272 @@ Imports System.IO Imports EgtUILib Imports System.Threading -Namespace EgtCAM5 - - Public Class StatusBarVM - Inherits ViewModelBase +Public Class StatusBarVM + Inherits ViewModelBase #Region "FIELDS & PROPERTIES" - ' Funzioni di callback per output in interfaccia da LUA - Private m_ProcEventsCallback As New ProcessEventsCallback(AddressOf ProcessEvents) - Private m_OutTextCallback As New OutTextCallback(AddressOf OutText) + ' Funzioni di callback per output in interfaccia da LUA + Private m_ProcEventsCallback As New ProcessEventsCallback(AddressOf ProcessEvents) + Private m_OutTextCallback As New OutTextCallback(AddressOf OutText) - ' GRAPHICAL ELEMENTS - Private m_StatusOutput As String - Public Property StatusOutput As String - Get - Return m_StatusOutput - End Get - Set(value As String) - m_StatusOutput = value - OnPropertyChanged("StatusOutput") - End Set - End Property + ' GRAPHICAL ELEMENTS + Private m_StatusOutput As String + Public Property StatusOutput As String + Get + Return m_StatusOutput + End Get + Set(value As String) + m_StatusOutput = value + OnPropertyChanged("StatusOutput") + End Set + End Property - Private m_StatusCurrPos As String - Public Property StatusCurrPos As String - Get - Return m_StatusCurrPos - End Get - Set(value As String) - m_StatusCurrPos = value - OnPropertyChanged("StatusCurrPos") - End Set - End Property + Private m_StatusCurrPos As String + Public Property StatusCurrPos As String + Get + Return m_StatusCurrPos + End Get + Set(value As String) + m_StatusCurrPos = value + OnPropertyChanged("StatusCurrPos") + End Set + End Property - Private m_StatusProgress As Integer - Public Property StatusProgress As Integer - Get - Return m_StatusProgress - End Get - Set(value As Integer) - m_StatusProgress = value - OnPropertyChanged("StatusProgress") - End Set - End Property + Private m_StatusProgress As Integer + Public Property StatusProgress As Integer + Get + Return m_StatusProgress + End Get + Set(value As Integer) + m_StatusProgress = value + OnPropertyChanged("StatusProgress") + End Set + End Property - Private m_StatusStopIsEnabled As Boolean - Public Property StatusStopIsEnabled As Boolean - Get - Return m_StatusStopIsEnabled - End Get - Set(value As Boolean) - m_StatusStopIsEnabled = value - OnPropertyChanged("StatusStopIsEnabled") - End Set - End Property + Private m_StatusStopIsEnabled As Boolean + Public Property StatusStopIsEnabled As Boolean + Get + Return m_StatusStopIsEnabled + End Get + Set(value As Boolean) + m_StatusStopIsEnabled = value + OnPropertyChanged("StatusStopIsEnabled") + End Set + End Property - Private m_GridDimensionText As String - Public Property GridDimensionText As String - Get - Return m_GridDimensionText - End Get - Set(value As String) - m_GridDimensionText = value - OnPropertyChanged("GridDimensionText") - End Set - End Property + Private m_GridDimensionText As String + Public Property GridDimensionText As String + Get + Return m_GridDimensionText + End Get + Set(value As String) + m_GridDimensionText = value + OnPropertyChanged("GridDimensionText") + End Set + End Property - Private m_StatusGridText As String - Public Property StatusGridText As String - Get - Return m_StatusGridText - End Get - Set(value As String) - m_StatusGridText = value - OnPropertyChanged("StatusGridText") - End Set - End Property + Private m_StatusGridText As String + Public Property StatusGridText As String + Get + Return m_StatusGridText + End Get + Set(value As String) + m_StatusGridText = value + OnPropertyChanged("StatusGridText") + End Set + End Property - Private m_CurrPosTypeText As String - Public Property CurrPosTypeText As String - Get - Return m_CurrPosTypeText - End Get - Set(value As String) - m_CurrPosTypeText = value - OnPropertyChanged("CurrPosTypeText") - End Set - End Property + Private m_CurrPosTypeText As String + Public Property CurrPosTypeText As String + Get + Return m_CurrPosTypeText + End Get + Set(value As String) + m_CurrPosTypeText = value + OnPropertyChanged("CurrPosTypeText") + End Set + End Property - Private m_StatusUnitsText As String - Public Property StatusUnitsText As String - Get - Return m_StatusUnitsText - End Get - Set(value As String) - m_StatusUnitsText = value - OnPropertyChanged("StatusUnitsText") - End Set - End Property + Private m_StatusUnitsText As String + Public Property StatusUnitsText As String + Get + Return m_StatusUnitsText + End Get + Set(value As String) + m_StatusUnitsText = value + OnPropertyChanged("StatusUnitsText") + End Set + End Property - Private m_SnapPointTypeText As String - Public Property SnapPointTypeText As String - Get - Return m_SnapPointTypeText - End Get - Set(value As String) - m_SnapPointTypeText = value - OnPropertyChanged("SnapPointTypeText") - End Set - End Property + Private m_SnapPointTypeText As String + Public Property SnapPointTypeText As String + Get + Return m_SnapPointTypeText + End Get + Set(value As String) + m_SnapPointTypeText = value + OnPropertyChanged("SnapPointTypeText") + End Set + End Property - Private m_SnapPointTypeBackground As SolidColorBrush - Public Property SnapPointTypeBackground As SolidColorBrush - Get - Return m_SnapPointTypeBackground - End Get - Set(value As SolidColorBrush) - m_SnapPointTypeBackground = value - OnPropertyChanged("SnapPointTypeBackground") - End Set - End Property + Private m_SnapPointTypeBackground As SolidColorBrush + Public Property SnapPointTypeBackground As SolidColorBrush + Get + Return m_SnapPointTypeBackground + End Get + Set(value As SolidColorBrush) + m_SnapPointTypeBackground = value + OnPropertyChanged("SnapPointTypeBackground") + End Set + End Property - ' Lista delle macchine disponibili nel programma - Private m_MachinesList As New ObservableCollection(Of Machine) - Public Property MachinesList As ObservableCollection(Of Machine) - Get - Return m_MachinesList - End Get - Set(value As ObservableCollection(Of Machine)) - m_MachinesList = value - End Set - End Property - ' Macchina correntemente selezionata e quindi attiva - Private m_SelectedMachine As Machine - Public Property SelectedMachine As Machine - Get - Return m_SelectedMachine - End Get - Set(value As Machine) - If value IsNot m_SelectedMachine Then - EgtSetCurrentContext(IniFile.m_ProjectSceneContext) - If EgtSetCurrMachine(value.Name) Then - m_SelectedMachine = value - IniFile.m_sMachineName = m_SelectedMachine.Name - IniFile.m_sCurrMachIniFilePath = m_SelectedMachine.MachineDirPath & "\" & m_SelectedMachine.Name & ".ini" - IniFile.m_sCurrMachToolsDirPath = m_SelectedMachine.MachineDirPath & "\Tools" - IniFile.m_sCurrMachSetUpDirPath = m_SelectedMachine.MachineDirPath & "\SetUp" - IniFile.m_sCurrMachScriptsDirPath = m_SelectedMachine.MachineDirPath & "\Scripts" - UpdateToolAndMachDbParamVisibility() - OnPropertyChanged("SelectedMachine") - End If + ' Lista delle macchine disponibili nel programma + Private m_MachinesList As New ObservableCollection(Of Machine) + Public Property MachinesList As ObservableCollection(Of Machine) + Get + Return m_MachinesList + End Get + Set(value As ObservableCollection(Of Machine)) + m_MachinesList = value + End Set + End Property + ' Macchina correntemente selezionata e quindi attiva + Private m_SelectedMachine As Machine + Public Property SelectedMachine As Machine + Get + Return m_SelectedMachine + End Get + Set(value As Machine) + If value IsNot m_SelectedMachine Then + EgtSetCurrentContext(IniFile.m_ProjectSceneContext) + If EgtSetCurrMachine(value.Name) Then + m_SelectedMachine = value + IniFile.m_sMachineName = m_SelectedMachine.Name + IniFile.m_sCurrMachIniFilePath = m_SelectedMachine.MachineDirPath & "\" & m_SelectedMachine.Name & ".ini" + IniFile.m_sCurrMachToolsDirPath = m_SelectedMachine.MachineDirPath & "\Tools" + IniFile.m_sCurrMachSetUpDirPath = m_SelectedMachine.MachineDirPath & "\SetUp" + IniFile.m_sCurrMachScriptsDirPath = m_SelectedMachine.MachineDirPath & "\Scripts" + UpdateToolAndMachDbParamVisibility() + OnPropertyChanged("SelectedMachine") End If - End Set - End Property + End If + End Set + End Property - Private m_MachineListIsEnabled As Boolean - Public Property MachineListIsEnabled As Boolean - Get - Return m_MachineListIsEnabled - End Get - Set(value As Boolean) - m_MachineListIsEnabled = value - OnPropertyChanged("MachineListIsEnabled") - End Set - End Property + Private m_MachineListIsEnabled As Boolean + Public Property MachineListIsEnabled As Boolean + Get + Return m_MachineListIsEnabled + End Get + Set(value As Boolean) + m_MachineListIsEnabled = value + OnPropertyChanged("MachineListIsEnabled") + End Set + End Property - ' Commands definition - Private m_cmdGridDimension As ICommand - Private m_cmdGridDimensionLostFocus As ICommand - Private m_cmdStatusGrid As ICommand - Private m_cmdCurrPosType As ICommand - Private m_cmdStatusUnits As ICommand - Private m_cmdStatusStop As ICommand - Private m_cmdClearStatusOutput As ICommand + ' Commands definition + Private m_cmdGridDimension As ICommand + Private m_cmdGridDimensionLostFocus As ICommand + Private m_cmdStatusGrid As ICommand + Private m_cmdCurrPosType As ICommand + Private m_cmdStatusUnits As ICommand + Private m_cmdStatusStop As ICommand + Private m_cmdClearStatusOutput As ICommand #End Region ' Fields & Properties #Region "CONSTRUCTOR" - Sub New() - ' Creo riferimento a questa classe in EgtCAM5Map - Map.SetRefStatusBarVM(Me) - Application.Msn.Register(Application.NOTIFYCURRPOS, Sub(sCursorPos As String) - StatusCurrPos = sCursorPos - End Sub) - Application.Msn.Register(Application.NOTIFYSTATUSOUTPUT, Sub(sStatusOutput As String) - StatusOutput = sStatusOutput - End Sub) - Application.Msn.Register(Application.NOTIFYSTATUSPROGRESS, Sub(sStatusProgress As Integer) - StatusProgress = sStatusProgress - End Sub) - Application.Msn.Register(Application.NOTIFYSTATUSSTOP, Sub(sStatusStop As Boolean) - StatusStopIsEnabled = sStatusStop - End Sub) - Application.Msn.Register(Application.UPDATESTATUSGRID, Sub(UpdateStatusGridParam As UpdateStatusGridParam) - UpdateStatusGrid(UpdateStatusGridParam.m_bShowGrid, UpdateStatusGridParam.m_bShowGridFrame) - End Sub) - Application.Msn.Register(Application.STATUSCURRPOSTYPETEXT, Sub(sString As String) - CurrPosTypeText = sString - End Sub) - Application.Msn.Register(Application.UPDATESTATUSUNITS, Sub(bMmUnits As Boolean) - StatusUnitsText = If(bMmUnits, "mm", "in") - EgtSetUiUnits(bMmUnits) + Sub New() + ' Creo riferimento a questa classe in EgtCAM5Map + Map.SetRefStatusBarVM(Me) + Application.Msn.Register(Application.NOTIFYCURRPOS, Sub(sCursorPos As String) + StatusCurrPos = sCursorPos + End Sub) + Application.Msn.Register(Application.NOTIFYSTATUSOUTPUT, Sub(sStatusOutput As String) + StatusOutput = sStatusOutput + End Sub) + Application.Msn.Register(Application.NOTIFYSTATUSPROGRESS, Sub(sStatusProgress As Integer) + StatusProgress = sStatusProgress End Sub) - Application.Msn.Register(Application.STATUSSNAPPOINTTYPETEXT, Sub(sString As String) - SnapPointTypeText = sString - End Sub) - Application.Msn.Register(Application.STATUSSNAPPOINTTYPEBACKGROUND, Sub(Color As SolidColorBrush) - SnapPointTypeBackground = Color - End Sub) - SearchMachine() - Application.Msn.Register(Application.LOADCURRENTMACHINE, Sub() - If m_MachinesList.Count = 0 Then Return - Dim CurrMach As String = String.Empty - GetPrivateProfileString(S_MACH, K_CURRMACH, String.Empty, CurrMach) - Dim bFound As Boolean = False - If Not String.IsNullOrEmpty(CurrMach) Then - For Each Mach In MachinesList - If Mach.Name = CurrMach Then - bFound = True - SelectedMachine = Mach - Exit For - End If - Next - End If - If Not bFound And MachinesList.Count > 0 Then - SelectedMachine = MachinesList(0) - End If + Application.Msn.Register(Application.NOTIFYSTATUSSTOP, Sub(sStatusStop As Boolean) + StatusStopIsEnabled = sStatusStop + End Sub) + Application.Msn.Register(Application.UPDATESTATUSGRID, Sub(UpdateStatusGridParam As UpdateStatusGridParam) + UpdateStatusGrid(UpdateStatusGridParam.m_bShowGrid, UpdateStatusGridParam.m_bShowGridFrame) + End Sub) + Application.Msn.Register(Application.STATUSCURRPOSTYPETEXT, Sub(sString As String) + CurrPosTypeText = sString End Sub) - Application.Msn.Register(Application.SAVECURRENTMACHINE, Sub() - If IsNothing(m_SelectedMachine) Then Return - WritePrivateProfileString(S_MACH, K_CURRMACH, SelectedMachine.Name) - End Sub) - Application.Msn.Register(Application.UPDATECURRENTMACHINE, Sub() - EgtSetCurrentContext(IniFile.m_ProjectSceneContext) - Dim sMachName As String = String.Empty - If EgtGetCurrMachineName(sMachName) Then - For Each Mach In MachinesList - If Mach.Name = sMachName Then - SelectedMachine = Mach - Exit For - End If - Next - End If + Application.Msn.Register(Application.UPDATESTATUSUNITS, Sub(bMmUnits As Boolean) + StatusUnitsText = If(bMmUnits, "mm", "in") + EgtSetUiUnits(bMmUnits) + End Sub) + Application.Msn.Register(Application.STATUSSNAPPOINTTYPETEXT, Sub(sString As String) + SnapPointTypeText = sString End Sub) - Application.Msn.Register(Application.MAINWINDOW_CONTENTRENDERED, Sub() - If IniFile.m_bMmUnits Then - GridDimensionText = LenToString(IniFile.dSnapStepMm, 4) - Else - GridDimensionText = LenToString(IniFile.dSnapStepInch, 4) - End If - If IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then - MachineListIsEnabled = False - End If + Application.Msn.Register(Application.STATUSSNAPPOINTTYPEBACKGROUND, Sub(Color As SolidColorBrush) + SnapPointTypeBackground = Color End Sub) - Application.Msn.Register(Application.MACHININGMODE_ISCHECKED, Sub() - StatusOutput = String.Empty - MachineListIsEnabled = False + SearchMachine() + Application.Msn.Register(Application.LOADCURRENTMACHINE, Sub() + If m_MachinesList.Count = 0 Then Return + Dim CurrMach As String = String.Empty + GetPrivateProfileString(S_MACH, K_CURRMACH, String.Empty, CurrMach) + Dim bFound As Boolean = False + If Not String.IsNullOrEmpty(CurrMach) Then + For Each Mach In MachinesList + If Mach.Name = CurrMach Then + bFound = True + SelectedMachine = Mach + Exit For + End If + Next + End If + If Not bFound And MachinesList.Count > 0 Then + SelectedMachine = MachinesList(0) + End If + End Sub) + Application.Msn.Register(Application.SAVECURRENTMACHINE, Sub() + If IsNothing(m_SelectedMachine) Then Return + WritePrivateProfileString(S_MACH, K_CURRMACH, SelectedMachine.Name) + End Sub) + Application.Msn.Register(Application.UPDATECURRENTMACHINE, Sub() + EgtSetCurrentContext(IniFile.m_ProjectSceneContext) + Dim sMachName As String = String.Empty + If EgtGetCurrMachineName(sMachName) Then + For Each Mach In MachinesList + If Mach.Name = sMachName Then + SelectedMachine = Mach + Exit For + End If + Next + End If + End Sub) + Application.Msn.Register(Application.MAINWINDOW_CONTENTRENDERED, Sub() + If IniFile.m_bMmUnits Then + GridDimensionText = LenToString(IniFile.dSnapStepMm, 4) + Else + GridDimensionText = LenToString(IniFile.dSnapStepInch, 4) + End If + If IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then + MachineListIsEnabled = False + End If End Sub) - Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub() - StatusOutput = String.Empty - MachineListIsEnabled = True - End Sub) - ' Installo funzione gestione eventi per lua - EgtSetProcessEvents(m_ProcEventsCallback) - ' Installo funzione output testo su status per lua - EgtSetOutText(m_OutTextCallback) - End Sub + Application.Msn.Register(Application.MACHININGMODE_ISCHECKED, Sub() + StatusOutput = String.Empty + MachineListIsEnabled = False + End Sub) + Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub() + StatusOutput = String.Empty + MachineListIsEnabled = True + End Sub) + ' Installo funzione gestione eventi per lua + EgtSetProcessEvents(m_ProcEventsCallback) + ' Installo funzione output testo su status per lua + EgtSetOutText(m_OutTextCallback) + End Sub #End Region ' Constructor @@ -279,189 +277,189 @@ Namespace EgtCAM5 #Region "GridDimensionCommand" - ''' - ''' Returns a command that set grid status. - ''' - Public ReadOnly Property GridDimensionCommand As ICommand - Get - If m_cmdGridDimension Is Nothing Then - m_cmdGridDimension = New RelayCommand(AddressOf GridDimension) - End If - Return m_cmdGridDimension - End Get - End Property - - ''' - ''' Notify the function to set the status. This method is invoked by the StatusGridCommand. - ''' - Public Sub GridDimension(ByVal param As Object) - If IniFile.m_bMmUnits Then - StringToLen(GridDimensionText, IniFile.dSnapStepMm) - EgtSetGridGeo(IniFile.dSnapStepMm, IniFile.nMinLineSStep, IniFile.nMajLineSStep, IniFile.nExtSStep) - Else - StringToLen(GridDimensionText, IniFile.dSnapStepInch) - EgtSetGridGeo(IniFile.dSnapStepInch, IniFile.nMinLineSStep, IniFile.nMajLineSStep, IniFile.nExtSStep) + ''' + ''' Returns a command that set grid status. + ''' + Public ReadOnly Property GridDimensionCommand As ICommand + Get + If m_cmdGridDimension Is Nothing Then + m_cmdGridDimension = New RelayCommand(AddressOf GridDimension) End If - EgtSetGridColor(IniFile.MinLnColor, IniFile.MajLnColor) - Keyboard.ClearFocus() - EgtDraw() - End Sub + Return m_cmdGridDimension + End Get + End Property + + ''' + ''' Notify the function to set the status. This method is invoked by the StatusGridCommand. + ''' + Public Sub GridDimension(ByVal param As Object) + If IniFile.m_bMmUnits Then + StringToLen(GridDimensionText, IniFile.dSnapStepMm) + EgtSetGridGeo(IniFile.dSnapStepMm, IniFile.nMinLineSStep, IniFile.nMajLineSStep, IniFile.nExtSStep) + Else + StringToLen(GridDimensionText, IniFile.dSnapStepInch) + EgtSetGridGeo(IniFile.dSnapStepInch, IniFile.nMinLineSStep, IniFile.nMajLineSStep, IniFile.nExtSStep) + End If + EgtSetGridColor(IniFile.MinLnColor, IniFile.MajLnColor) + Keyboard.ClearFocus() + EgtDraw() + End Sub #End Region ' GridDimensionCommand #Region "GridDimensionLostFocusCommand" - ''' - ''' Returns a command that set grid status. - ''' - Public ReadOnly Property GridDimensionLostFocusCommand As ICommand - Get - If m_cmdGridDimensionLostFocus Is Nothing Then - m_cmdGridDimensionLostFocus = New RelayCommand(AddressOf GridDimensionLostFocus) - End If - Return m_cmdGridDimensionLostFocus - End Get - End Property - - ''' - ''' Notify the function to set the status. This method is invoked by the StatusGridCommand. - ''' - Public Sub GridDimensionLostFocus(ByVal param As Object) - If IniFile.m_bMmUnits Then - GridDimensionText = LenToString(IniFile.dSnapStepMm, 4) - Else - GridDimensionText = LenToString(IniFile.dSnapStepInch, 4) + ''' + ''' Returns a command that set grid status. + ''' + Public ReadOnly Property GridDimensionLostFocusCommand As ICommand + Get + If m_cmdGridDimensionLostFocus Is Nothing Then + m_cmdGridDimensionLostFocus = New RelayCommand(AddressOf GridDimensionLostFocus) End If - End Sub + Return m_cmdGridDimensionLostFocus + End Get + End Property + + ''' + ''' Notify the function to set the status. This method is invoked by the StatusGridCommand. + ''' + Public Sub GridDimensionLostFocus(ByVal param As Object) + If IniFile.m_bMmUnits Then + GridDimensionText = LenToString(IniFile.dSnapStepMm, 4) + Else + GridDimensionText = LenToString(IniFile.dSnapStepInch, 4) + End If + End Sub #End Region ' GridDimensionLostFocusCommand #Region "StatusGridCommand" - ''' - ''' Returns a command that set grid status. - ''' - Public ReadOnly Property StatusGridCommand As ICommand - Get - If m_cmdStatusGrid Is Nothing Then - m_cmdStatusGrid = New RelayCommand(AddressOf StatusGrid) - End If - Return m_cmdStatusGrid - End Get - End Property - - ''' - ''' Notify the function to set the status. This method is invoked by the StatusGridCommand. - ''' - Public Sub StatusGrid(ByVal param As Object) - Dim bGridState As Boolean - If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then - IniFile.m_bDrawShowGrid = Not IniFile.m_bDrawShowGrid - bGridState = m_bDrawShowGrid - ElseIf IniFile.m_ProjectMode = ProjectModeOpt.MACHINING Then - IniFile.m_bMachiningShowGrid = Not IniFile.m_bMachiningShowGrid - bGridState = m_bMachiningShowGrid + ''' + ''' Returns a command that set grid status. + ''' + Public ReadOnly Property StatusGridCommand As ICommand + Get + If m_cmdStatusGrid Is Nothing Then + m_cmdStatusGrid = New RelayCommand(AddressOf StatusGrid) End If - Application.Msn.NotifyColleagues(Application.UPDATESTATUSGRID, New UpdateStatusGridParam(bGridState, IniFile.m_bShowGridFrame)) - EgtDraw() - End Sub + Return m_cmdStatusGrid + End Get + End Property + + ''' + ''' Notify the function to set the status. This method is invoked by the StatusGridCommand. + ''' + Public Sub StatusGrid(ByVal param As Object) + Dim bGridState As Boolean + If IniFile.m_ProjectMode = ProjectModeOpt.DRAW OrElse IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then + IniFile.m_bDrawShowGrid = Not IniFile.m_bDrawShowGrid + bGridState = m_bDrawShowGrid + ElseIf IniFile.m_ProjectMode = ProjectModeOpt.MACHINING Then + IniFile.m_bMachiningShowGrid = Not IniFile.m_bMachiningShowGrid + bGridState = m_bMachiningShowGrid + End If + Application.Msn.NotifyColleagues(Application.UPDATESTATUSGRID, New UpdateStatusGridParam(bGridState, IniFile.m_bShowGridFrame)) + EgtDraw() + End Sub #End Region ' StatusGridCommand #Region "CurrPosTypeCommand" - ''' - ''' Returns a command that choose the current reference. - ''' - Public ReadOnly Property CurrPosTypeCommand As ICommand - Get - If m_cmdCurrPosType Is Nothing Then - m_cmdCurrPosType = New RelayCommand(AddressOf CurrPosType) - End If - Return m_cmdCurrPosType - End Get - End Property + ''' + ''' Returns a command that choose the current reference. + ''' + Public ReadOnly Property CurrPosTypeCommand As ICommand + Get + If m_cmdCurrPosType Is Nothing Then + m_cmdCurrPosType = New RelayCommand(AddressOf CurrPosType) + End If + Return m_cmdCurrPosType + End Get + End Property - ''' - ''' Execute the Point. This method is invoked by the CurrPosTypeCommand. - ''' - Public Sub CurrPosType(ByVal param As Object) - Application.Msn.NotifyColleagues(Application.STATUSCURRPOSTYPECOMMAND) - End Sub + ''' + ''' Execute the Point. This method is invoked by the CurrPosTypeCommand. + ''' + Public Sub CurrPosType(ByVal param As Object) + Application.Msn.NotifyColleagues(Application.STATUSCURRPOSTYPECOMMAND) + End Sub #End Region ' CurrPosTypeCommand #Region "StatusUnitsCommand" - ''' - ''' Returns a command that choose the current reference. - ''' - Public ReadOnly Property StatusUnitsCommand As ICommand - Get - If m_cmdStatusUnits Is Nothing Then - m_cmdStatusUnits = New RelayCommand(AddressOf StatusUnits) - End If - Return m_cmdStatusUnits - End Get - End Property - - ''' - ''' Execute the Point. This method is invoked by the CurrPosTypeCommand. - ''' - Public Sub StatusUnits(ByVal param As Object) - Application.Msn.NotifyColleagues(Application.STATUSUNITSCOMMAND) - If IniFile.m_bMmUnits Then - GridDimensionText = LenToString(IniFile.dSnapStepMm, 4) - Else - GridDimensionText = LenToString(IniFile.dSnapStepInch, 4) + ''' + ''' Returns a command that choose the current reference. + ''' + Public ReadOnly Property StatusUnitsCommand As ICommand + Get + If m_cmdStatusUnits Is Nothing Then + m_cmdStatusUnits = New RelayCommand(AddressOf StatusUnits) End If - End Sub + Return m_cmdStatusUnits + End Get + End Property + + ''' + ''' Execute the Point. This method is invoked by the CurrPosTypeCommand. + ''' + Public Sub StatusUnits(ByVal param As Object) + Application.Msn.NotifyColleagues(Application.STATUSUNITSCOMMAND) + If IniFile.m_bMmUnits Then + GridDimensionText = LenToString(IniFile.dSnapStepMm, 4) + Else + GridDimensionText = LenToString(IniFile.dSnapStepInch, 4) + End If + End Sub #End Region ' StatusUnitsCommand #Region "StatusStopCommand" - ''' - ''' Returns a command that choose the current reference. - ''' - Public ReadOnly Property StatusStopCommand As ICommand - Get - If m_cmdStatusStop Is Nothing Then - m_cmdStatusStop = New RelayCommand(AddressOf StatusStop) - End If - Return m_cmdStatusStop - End Get - End Property + ''' + ''' Returns a command that choose the current reference. + ''' + Public ReadOnly Property StatusStopCommand As ICommand + Get + If m_cmdStatusStop Is Nothing Then + m_cmdStatusStop = New RelayCommand(AddressOf StatusStop) + End If + Return m_cmdStatusStop + End Get + End Property - ''' - ''' Execute the Point. This method is invoked by the CurrPosTypeCommand. - ''' - Public Sub StatusStop(ByVal param As Object) - m_bStopScript = True - End Sub + ''' + ''' Execute the Point. This method is invoked by the CurrPosTypeCommand. + ''' + Public Sub StatusStop(ByVal param As Object) + m_bStopScript = True + End Sub #End Region ' StatusStopCommand #Region "ClearStatusOutputCommand" - ''' - ''' Returns a command that choose the current reference. - ''' - Public ReadOnly Property ClearStatusOutputCommand As ICommand - Get - If m_cmdClearStatusOutput Is Nothing Then - m_cmdClearStatusOutput = New RelayCommand(AddressOf ClearStatusOutput) - End If - Return m_cmdClearStatusOutput - End Get - End Property + ''' + ''' Returns a command that choose the current reference. + ''' + Public ReadOnly Property ClearStatusOutputCommand As ICommand + Get + If m_cmdClearStatusOutput Is Nothing Then + m_cmdClearStatusOutput = New RelayCommand(AddressOf ClearStatusOutput) + End If + Return m_cmdClearStatusOutput + End Get + End Property - ''' - ''' Execute the Point. This method is invoked by the CurrPosTypeCommand. - ''' - Public Sub ClearStatusOutput(ByVal param As Object) - StatusOutput = String.Empty - End Sub + ''' + ''' Execute the Point. This method is invoked by the CurrPosTypeCommand. + ''' + Public Sub ClearStatusOutput(ByVal param As Object) + StatusOutput = String.Empty + End Sub #End Region ' ClearStatusOutputCommand @@ -469,95 +467,93 @@ Namespace EgtCAM5 #Region "METHODS" - Private Sub UpdateStatusGrid(bShowGrid As Boolean, bShowGridFrame As Boolean) - 'tsStatusGrid.ForeColor = If(m_bShowGrid, Color.Black, Color.Gray) - StatusGridText = If(bShowGrid, "GRID ON ", "GRID OFF") - EgtSetGridShow(bShowGrid, bShowGrid And bShowGridFrame) - End Sub + Private Sub UpdateStatusGrid(bShowGrid As Boolean, bShowGridFrame As Boolean) + 'tsStatusGrid.ForeColor = If(m_bShowGrid, Color.Black, Color.Gray) + StatusGridText = If(bShowGrid, "GRID ON ", "GRID OFF") + EgtSetGridShow(bShowGrid, bShowGrid And bShowGridFrame) + End Sub - ''' - ''' Method that search the machines in the correct folder and add to the MachinesList those valid. - ''' - Private Sub SearchMachine() - ' Se direttorio base macchine non definito o non esiste, ritorno - If String.IsNullOrWhiteSpace(IniFile.m_sMachinesRoot) OrElse - Not Directory.Exists(IniFile.m_sMachinesRoot) OrElse Directory.GetDirectories(IniFile.m_sMachinesRoot).Count = 0 Then - IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW - EgtOutLog(EgtMsg(MSG_STATUSBAR + 1)) - Return + ''' + ''' Method that search the machines in the correct folder and add to the MachinesList those valid. + ''' + Private Sub SearchMachine() + ' Se direttorio base macchine non definito o non esiste, ritorno + If String.IsNullOrWhiteSpace(IniFile.m_sMachinesRoot) OrElse + Not Directory.Exists(IniFile.m_sMachinesRoot) OrElse Directory.GetDirectories(IniFile.m_sMachinesRoot).Count = 0 Then + IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW + EgtOutLog(EgtMsg(MSG_STATUSBAR + 1)) + Return + End If + ' Cerco le macchine + Dim TempArray As String() = Directory.GetDirectories(IniFile.m_sMachinesRoot) + For i As Integer = 0 To TempArray.Count - 1 + Dim MachinePathIni As String = TempArray(i) & "\" & Path.GetFileName(TempArray(i)) & ".ini" + If File.Exists(MachinePathIni) Then + m_MachinesList.Add(New Machine With {.Name = Path.GetFileName(TempArray(i)), .MachineDirPath = TempArray(i)}) End If - ' Cerco le macchine - Dim TempArray As String() = Directory.GetDirectories(IniFile.m_sMachinesRoot) - For i As Integer = 0 To TempArray.Count - 1 - Dim MachinePathIni As String = TempArray(i) & "\" & Path.GetFileName(TempArray(i)) & ".ini" - If File.Exists(MachinePathIni) Then - m_MachinesList.Add(New Machine With {.Name = Path.GetFileName(TempArray(i)), .MachineDirPath = TempArray(i)}) - End If - Next - If m_MachinesList.Count = 0 Then - IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW - EgtOutLog(EgtMsg(MSG_STATUSBAR + 1)) - Return - End If - End Sub + Next + If m_MachinesList.Count = 0 Then + IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW + EgtOutLog(EgtMsg(MSG_STATUSBAR + 1)) + Return + End If + End Sub - ''' - ''' Class that create the association Name/IniPath for the machine's - ''' - Class Machine + ''' + ''' Class that create the association Name/IniPath for the machine's + ''' + Class Machine - Private m_sName As String - Public Property Name As String - Get - Return m_sName - End Get - Set(value As String) - m_sName = value - End Set - End Property + Private m_sName As String + Public Property Name As String + Get + Return m_sName + End Get + Set(value As String) + m_sName = value + End Set + End Property - Friend MachineDirPath As String - - End Class - - Private Sub UpdateToolAndMachDbParamVisibility() - If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_SAWINGONARCS, 0, IniFile.m_sCurrMachIniFilePath) <> 0 Then - Sawing(39) = Visibility.Visible ' StepExtArc - Sawing(40) = Visibility.Visible ' StepIntArc - Else - Sawing(39) = Visibility.Collapsed ' StepExtArc - Sawing(40) = Visibility.Collapsed ' StepIntArc - End If - End Sub - - Public Function OutText(ByRef psText As IntPtr) As Boolean - ' Assegno stringa - StatusOutput = (Marshal.PtrToStringUni(psText)) - ' Costringo ad aggiornare - UpdateUI() - Return True - End Function - - Private Function ProcessEvents(ByVal nProg As Integer, ByVal nPause As Integer) As Integer - ' Se previsto, imposto progress - If nProg > 0 Then StatusProgress = Math.Min(nProg, 100) - ' Notifico a simulazione aggiornamento dati - Application.Msn.NotifyColleagues(Application.SIMULATIONEXPANDER_UPDATE_CNCDATA) - ' Costringo ad aggiornare - UpdateUI() - ' Eventuale attesa - Thread.Sleep(nPause) - ' Ritorno eventuale stop - If m_bStopScript Then - m_bStopScript = False - Return 0 - Else - Return 1 - End If - End Function - -#End Region ' Methods + Friend MachineDirPath As String End Class -End Namespace \ No newline at end of file + Private Sub UpdateToolAndMachDbParamVisibility() + If EgtUILib.GetPrivateProfileInt(S_MACHININGS, K_SAWINGONARCS, 0, IniFile.m_sCurrMachIniFilePath) <> 0 Then + Sawing(39) = Visibility.Visible ' StepExtArc + Sawing(40) = Visibility.Visible ' StepIntArc + Else + Sawing(39) = Visibility.Collapsed ' StepExtArc + Sawing(40) = Visibility.Collapsed ' StepIntArc + End If + End Sub + + Public Function OutText(ByRef psText As IntPtr) As Boolean + ' Assegno stringa + StatusOutput = (Marshal.PtrToStringUni(psText)) + ' Costringo ad aggiornare + UpdateUI() + Return True + End Function + + Private Function ProcessEvents(ByVal nProg As Integer, ByVal nPause As Integer) As Integer + ' Se previsto, imposto progress + If nProg > 0 Then StatusProgress = Math.Min(nProg, 100) + ' Notifico a simulazione aggiornamento dati + Application.Msn.NotifyColleagues(Application.SIMULATIONEXPANDER_UPDATE_CNCDATA) + ' Costringo ad aggiornare + UpdateUI() + ' Eventuale attesa + Thread.Sleep(nPause) + ' Ritorno eventuale stop + If m_bStopScript Then + m_bStopScript = False + Return 0 + Else + Return 1 + End If + End Function + +#End Region ' Methods + +End Class \ No newline at end of file diff --git a/StructureDataForMessenger.vb b/StructureDataForMessenger.vb index d80f211..9e30113 100644 --- a/StructureDataForMessenger.vb +++ b/StructureDataForMessenger.vb @@ -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 \ No newline at end of file diff --git a/ToolsDbWindow/ToolsDbVM.vb b/ToolsDbWindow/ToolsDbVM.vb index 9b5d039..b716558 100644 --- a/ToolsDbWindow/ToolsDbVM.vb +++ b/ToolsDbWindow/ToolsDbVM.vb @@ -5,366 +5,364 @@ Imports System.IO Imports EgtUILib Imports EgtWPFLib5 -Namespace EgtCAM5 +Public Class ToolsDbVM + Inherits TabViewModel - Public Class ToolsDbVM - Inherits TabViewModel + Friend Shared m_bActive As Boolean = False - Friend Shared m_bActive As Boolean = False + Private m_Title As String + Public ReadOnly Property Title As String + Get + Return EgtMsg(MSG_MAINWINDOW + 3) + End Get + End Property - Private m_Title As String - Public ReadOnly Property Title As String - Get - Return EgtMsg(MSG_MAINWINDOW + 3) - End Get - End Property + ' Lista degli utensili + Private m_ToolsList As New ObservableCollection(Of FamilyToolTreeViewItem) + Public Property ToolsList As ObservableCollection(Of FamilyToolTreeViewItem) + Get + Return m_ToolsList + End Get + Set(value As ObservableCollection(Of FamilyToolTreeViewItem)) + m_ToolsList = value + End Set + End Property - ' Lista degli utensili - Private m_ToolsList As New ObservableCollection(Of FamilyToolTreeViewItem) - Public Property ToolsList As ObservableCollection(Of FamilyToolTreeViewItem) - Get - Return m_ToolsList - End Get - Set(value As ObservableCollection(Of FamilyToolTreeViewItem)) - m_ToolsList = value - End Set - End Property + Private m_IsEnabledNewBtn As Boolean + Public ReadOnly Property IsEnabledNewBtn As Boolean + Get + Return m_IsEnabledNewBtn + End Get + End Property - Private m_IsEnabledNewBtn As Boolean - Public ReadOnly Property IsEnabledNewBtn As Boolean - Get - Return m_IsEnabledNewBtn - End Get - End Property + Private m_IsEnabledSaveBtn As Boolean + Public ReadOnly Property IsEnabledSaveBtn As Boolean + Get + Return m_IsEnabledSaveBtn + End Get + End Property - Private m_IsEnabledSaveBtn As Boolean - Public ReadOnly Property IsEnabledSaveBtn As Boolean - Get - Return m_IsEnabledSaveBtn - End Get - End Property + Private m_IsEnabledRemoveBtn As Boolean + Public ReadOnly Property IsEnabledRemoveBtn As Boolean + Get + Return m_IsEnabledRemoveBtn + End Get + End Property - Private m_IsEnabledRemoveBtn As Boolean - Public ReadOnly Property IsEnabledRemoveBtn As Boolean - Get - Return m_IsEnabledRemoveBtn - End Get - End Property - - 'PROJECT PAGE'S SCENE FIELDS AND PROPERTIES - ' Reference to the ProjectScene - Private WithEvents m_ToolScene As New Scene - ' Reference to the ProjectSceneHost - Private SceneHost As WindowsFormsHost - ' Property used to bind the scene to the WindowsFormsHost in XAML - Private m_bfirst As Boolean = True - Public ReadOnly Property ToolSceneHost As WindowsFormsHost - Get - If m_bfirst Then - SceneHost = New WindowsFormsHost() With {.Child = m_ToolScene} - If Not m_ToolScene.Init() Then - EgtOutLog("Error in Tool scene creation") - 'Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATION) - End If - IniFile.m_ToolsDbSceneContext = m_ToolScene.GetCtx() - ' inibisco selezione diretta da Scene - m_ToolScene.SetStatusNull() - 'OnPropertyChanged("SelectedMachine") - m_bfirst = False + 'PROJECT PAGE'S SCENE FIELDS AND PROPERTIES + ' Reference to the ProjectScene + Private WithEvents m_ToolScene As New Scene + ' Reference to the ProjectSceneHost + Private SceneHost As WindowsFormsHost + ' Property used to bind the scene to the WindowsFormsHost in XAML + Private m_bfirst As Boolean = True + Public ReadOnly Property ToolSceneHost As WindowsFormsHost + Get + If m_bfirst Then + SceneHost = New WindowsFormsHost() With {.Child = m_ToolScene} + If Not m_ToolScene.Init() Then + EgtOutLog("Error in Tool scene creation") + 'Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATION) End If - Return SceneHost - End Get - End Property + IniFile.m_ToolsDbSceneContext = m_ToolScene.GetCtx() + ' inibisco selezione diretta da Scene + m_ToolScene.SetStatusNull() + 'OnPropertyChanged("SelectedMachine") + m_bfirst = False + End If + Return SceneHost + End Get + End Property - ' Definizione comandi - Private m_cmdNew As ICommand - Private m_cmdSave As ICommand - Private m_cmdRemove As ICommand - Private m_cmdReloadTool As ICommand - Private m_cmdCloseToolsDb As ICommand + ' Definizione comandi + Private m_cmdNew As ICommand + Private m_cmdSave As ICommand + Private m_cmdRemove As ICommand + Private m_cmdReloadTool As ICommand + Private m_cmdCloseToolsDb As ICommand #Region "MESSAGES" - 'Definizione dei messaggi della pagina - Public ReadOnly Property CorrTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 51) - End Get - End Property + 'Definizione dei messaggi della pagina + Public ReadOnly Property CorrTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 51) + End Get + End Property - Public ReadOnly Property ExitParTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 52) - End Get - End Property + Public ReadOnly Property ExitParTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 52) + End Get + End Property - Public ReadOnly Property TypeTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 53) - End Get - End Property + Public ReadOnly Property TypeTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 53) + End Get + End Property - Public ReadOnly Property CoolantTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 54) - End Get - End Property + Public ReadOnly Property CoolantTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 54) + End Get + End Property - Public ReadOnly Property CornRadTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 55) - End Get - End Property + Public ReadOnly Property CornRadTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 55) + End Get + End Property - Public ReadOnly Property DiamTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 56) - End Get - End Property + Public ReadOnly Property DiamTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 56) + End Get + End Property - Public ReadOnly Property TotDiamTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 57) - End Get - End Property + Public ReadOnly Property TotDiamTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 57) + End Get + End Property - Public ReadOnly Property FeedTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 58) - End Get - End Property + Public ReadOnly Property FeedTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 58) + End Get + End Property - Public ReadOnly Property EndFeedTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 59) - End Get - End Property + Public ReadOnly Property EndFeedTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 59) + End Get + End Property - Public ReadOnly Property StartFeedTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 60) - End Get - End Property + Public ReadOnly Property StartFeedTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 60) + End Get + End Property - Public ReadOnly Property TipFeedTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 61) - End Get - End Property + Public ReadOnly Property TipFeedTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 61) + End Get + End Property - Public ReadOnly Property LenTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 62) - End Get - End Property + Public ReadOnly Property LenTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 62) + End Get + End Property - Public ReadOnly Property TotLenTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 63) - End Get - End Property + Public ReadOnly Property TotLenTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 63) + End Get + End Property - Public ReadOnly Property MaxMatTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 64) - End Get - End Property + Public ReadOnly Property MaxMatTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 64) + End Get + End Property - Public ReadOnly Property LonOffsetTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 65) - End Get - End Property + Public ReadOnly Property LonOffsetTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 65) + End Get + End Property - Public ReadOnly Property RadOffsetTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 66) - End Get - End Property + Public ReadOnly Property RadOffsetTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 66) + End Get + End Property - Public ReadOnly Property SpeedTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 67) - End Get - End Property + Public ReadOnly Property SpeedTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 67) + End Get + End Property - Public ReadOnly Property SideAngTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 68) - End Get - End Property + Public ReadOnly Property SideAngTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 68) + End Get + End Property - Public ReadOnly Property MaxSpeedTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 69) - End Get - End Property + Public ReadOnly Property MaxSpeedTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 69) + End Get + End Property - Public ReadOnly Property ThickTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 70) - End Get - End Property + Public ReadOnly Property ThickTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 70) + End Get + End Property - Public ReadOnly Property MaxAbsorptionTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 71) - End Get - End Property + Public ReadOnly Property MaxAbsorptionTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 71) + End Get + End Property - Public ReadOnly Property MinFeedTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 72) - End Get - End Property + Public ReadOnly Property MinFeedTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 72) + End Get + End Property - Public ReadOnly Property DrawTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 73) - End Get - End Property + Public ReadOnly Property DrawTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 73) + End Get + End Property - Public ReadOnly Property HeadTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 74) - End Get - End Property + Public ReadOnly Property HeadTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 74) + End Get + End Property - Public ReadOnly Property NameParTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 75) - End Get - End Property + Public ReadOnly Property NameParTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 75) + End Get + End Property - Public ReadOnly Property UserNotesTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 76) - End Get - End Property + Public ReadOnly Property UserNotesTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 76) + End Get + End Property - Public ReadOnly Property TcPosTxBl As String - Get - Return EgtMsg(MSG_TOOLSDBPAGE + 77) - End Get - End Property + Public ReadOnly Property TcPosTxBl As String + Get + Return EgtMsg(MSG_TOOLSDBPAGE + 77) + End Get + End Property #End Region #Region "CONSTRUCTOR" - Sub New() + Sub New() - m_bActive = True + m_bActive = True - ' leggo direttorio toolmakers - GetPrivateProfileString(S_MACH, K_TOOLMAKERSDIR, "", IniFile.m_sToolMakersDir) + ' leggo direttorio toolmakers + GetPrivateProfileString(S_MACH, K_TOOLMAKERSDIR, "", IniFile.m_sToolMakersDir) - ' Passo all'item della lista il delegato alla funzuione che permette di cancellare una lavorazione - ToolTreeViewItem.m_delRemoveTool = AddressOf RemoveTool - ' Passo all'item della lista il delegato alla funzuione che permette di disattivare la lista delle lavorazioni - ToolTreeViewItem.m_delErrorOnTool = AddressOf ErrorOnTool - ' Passo all'item della lista il delegato alla funzuione che permette di disattivare la lista delle lavorazioni - ToolTreeViewItem.m_delIsEnabledBtns = AddressOf IsEnabledBtns - FamilyToolTreeViewItem.m_delIsEnabledBtns = AddressOf IsEnabledBtns + ' Passo all'item della lista il delegato alla funzuione che permette di cancellare una lavorazione + ToolTreeViewItem.m_delRemoveTool = AddressOf RemoveTool + ' Passo all'item della lista il delegato alla funzuione che permette di disattivare la lista delle lavorazioni + ToolTreeViewItem.m_delErrorOnTool = AddressOf ErrorOnTool + ' Passo all'item della lista il delegato alla funzuione che permette di disattivare la lista delle lavorazioni + ToolTreeViewItem.m_delIsEnabledBtns = AddressOf IsEnabledBtns + FamilyToolTreeViewItem.m_delIsEnabledBtns = AddressOf IsEnabledBtns - LoadSelectedMachineTools() + LoadSelectedMachineTools() - ' carico lista teste - ToolTreeViewItem.m_HeadList.Clear() - Dim sHeads As String = String.Empty - EgtSetCurrentContext(IniFile.m_ProjectSceneContext) - If EgtGetAllHeadsNames(sHeads) Then - Dim sHeadList() As String = sHeads.Split(","c) - For HeadIndex = 0 To sHeadList.Count - 1 - Dim sHText As String = String.Empty - EgtUILib.GetPrivateProfileString(S_HEADS, sHeadList(HeadIndex), "", sHText, IniFile.m_sCurrMachIniFilePath) - Dim sHTextMsg As String = String.Empty - If IsNumeric(sHText) Then - sHTextMsg = EgtMsg(CInt(sHText)) - If sHTextMsg = ("Msg" & CInt(sHText)) Then - sHTextMsg = sHText - End If - Else + ' carico lista teste + ToolTreeViewItem.m_HeadList.Clear() + Dim sHeads As String = String.Empty + EgtSetCurrentContext(IniFile.m_ProjectSceneContext) + If EgtGetAllHeadsNames(sHeads) Then + Dim sHeadList() As String = sHeads.Split(","c) + For HeadIndex = 0 To sHeadList.Count - 1 + Dim sHText As String = String.Empty + EgtUILib.GetPrivateProfileString(S_HEADS, sHeadList(HeadIndex), "", sHText, IniFile.m_sCurrMachIniFilePath) + Dim sHTextMsg As String = String.Empty + If IsNumeric(sHText) Then + sHTextMsg = EgtMsg(CInt(sHText)) + If sHTextMsg = ("Msg" & CInt(sHText)) Then sHTextMsg = sHText End If - sHTextMsg &= " (" & sHeadList(HeadIndex) & ")" - ToolTreeViewItem.m_HeadList.Add(New HeadItem(sHeadList(HeadIndex), sHTextMsg)) - Next - Else - MessageBox.Show("Impossible loading Head list from machine!", "Error", MessageBoxButton.OK, MessageBoxImage.Error) - EgtOutLog("Error: Impossible loading Head list from machine!") - End If - ' se carico Lua che contiene le funzioni di attrezzaggio - ToolTreeViewItem.m_OrigTcPosList.Clear() - If EgtLuaExecFile(IniFile.m_sCurrMachScriptsDirPath & "\" & SETUP_LUA) Then - ' creo lista di tutti i TcPos - Dim nPosIndex As Integer = 1 - Dim sTcPos As String = String.Empty - Dim nErr As Integer = 0 - While nErr = 0 - EgtLuaSetGlobIntVar("STU.INDEX", nPosIndex) - If Not EgtLuaCallFunction("STU.GetTcPosFromPos") Then Exit While - ' Leggo variabili - EgtLuaGetGlobStringVar("STU.TCPOS", sTcPos) - If Not EgtLuaGetGlobIntVar("STU.ERR", nErr) Then nErr = 999 - If nErr = 0 Then - ToolTreeViewItem.m_OrigTcPosList.Add(sTcPos) - End If - nPosIndex += 1 - End While - ' altrimenti - Else - MessageBox.Show(EgtMsg(MSG_TOOLSERRORS + 25), EgtMsg(MSG_TOOLSERRORS + 26), MessageBoxButton.OK, MessageBoxImage.Error) - EgtOutLog("Error: SetUp configuration file not found!") - End If + Else + sHTextMsg = sHText + End If + sHTextMsg &= " (" & sHeadList(HeadIndex) & ")" + ToolTreeViewItem.m_HeadList.Add(New HeadItem(sHeadList(HeadIndex), sHTextMsg)) + Next + Else + MessageBox.Show("Impossible loading Head list from machine!", "Error", MessageBoxButton.OK, MessageBoxImage.Error) + EgtOutLog("Error: Impossible loading Head list from machine!") + End If + ' se carico Lua che contiene le funzioni di attrezzaggio + ToolTreeViewItem.m_OrigTcPosList.Clear() + If EgtLuaExecFile(IniFile.m_sCurrMachScriptsDirPath & "\" & SETUP_LUA) Then + ' creo lista di tutti i TcPos + Dim nPosIndex As Integer = 1 + Dim sTcPos As String = String.Empty + Dim nErr As Integer = 0 + While nErr = 0 + EgtLuaSetGlobIntVar("STU.INDEX", nPosIndex) + If Not EgtLuaCallFunction("STU.GetTcPosFromPos") Then Exit While + ' Leggo variabili + EgtLuaGetGlobStringVar("STU.TCPOS", sTcPos) + If Not EgtLuaGetGlobIntVar("STU.ERR", nErr) Then nErr = 999 + If nErr = 0 Then + ToolTreeViewItem.m_OrigTcPosList.Add(sTcPos) + End If + nPosIndex += 1 + End While + ' altrimenti + Else + MessageBox.Show(EgtMsg(MSG_TOOLSERRORS + 25), EgtMsg(MSG_TOOLSERRORS + 26), MessageBoxButton.OK, MessageBoxImage.Error) + EgtOutLog("Error: SetUp configuration file not found!") + End If - End Sub + End Sub #End Region ' Constructor #Region "METHODS" - Private Sub IsEnabledBtns(bIsEnabledNewBtn As Boolean, bIsEnabledSaveBtn As Boolean, bIsEnabledDeleteBtn As Boolean) - m_IsEnabledNewBtn = bIsEnabledNewBtn - m_IsEnabledSaveBtn = bIsEnabledSaveBtn - m_IsEnabledRemoveBtn = bIsEnabledDeleteBtn - OnPropertyChanged("IsEnabledNewBtn") - OnPropertyChanged("IsEnabledSaveBtn") - OnPropertyChanged("IsEnabledRemoveBtn") - End Sub + Private Sub IsEnabledBtns(bIsEnabledNewBtn As Boolean, bIsEnabledSaveBtn As Boolean, bIsEnabledDeleteBtn As Boolean) + m_IsEnabledNewBtn = bIsEnabledNewBtn + m_IsEnabledSaveBtn = bIsEnabledSaveBtn + m_IsEnabledRemoveBtn = bIsEnabledDeleteBtn + OnPropertyChanged("IsEnabledNewBtn") + OnPropertyChanged("IsEnabledSaveBtn") + OnPropertyChanged("IsEnabledRemoveBtn") + End Sub - ' Quando chiamato, disattiva tutti gli item dell'albero o li riattiva a seconda che ci sia o meno un errore - Private Sub ErrorOnTool(bIsEnabled As Boolean) - For Each FamilyToolItem In ToolsList - FamilyToolItem.IsEnabled = Not bIsEnabled - Next - End Sub + ' Quando chiamato, disattiva tutti gli item dell'albero o li riattiva a seconda che ci sia o meno un errore + Private Sub ErrorOnTool(bIsEnabled As Boolean) + For Each FamilyToolItem In ToolsList + FamilyToolItem.IsEnabled = Not bIsEnabled + Next + End Sub - ''' - ''' Method that search tools for the currently selected Machine and add it to the ToolsList. - ''' - Private Sub LoadSelectedMachineTools() - Dim ActiveToolsFamilies() As ToolsFamily = MachineModel.ReadActiveToolsFamilies() - For Each ToolsFamily In ActiveToolsFamilies - Dim FamilyTreeView As New FamilyToolTreeViewItem(ToolsFamily.FamilyName, ToolsFamily.FamilyId) - ToolsList.Add(FamilyTreeView) - Dim nType As Integer = 0 - Dim ToolName As String = String.Empty - EgtSetCurrentContext(IniFile.m_ProjectSceneContext) - If EgtTdbGetFirstTool(ToolsFamily.FamilyId, ToolName, nType) Then + ''' + ''' Method that search tools for the currently selected Machine and add it to the ToolsList. + ''' + Private Sub LoadSelectedMachineTools() + Dim ActiveToolsFamilies() As ToolsFamily = MachineModel.ReadActiveToolsFamilies() + For Each ToolsFamily In ActiveToolsFamilies + Dim FamilyTreeView As New FamilyToolTreeViewItem(ToolsFamily.FamilyName, ToolsFamily.FamilyId) + ToolsList.Add(FamilyTreeView) + Dim nType As Integer = 0 + Dim ToolName As String = String.Empty + EgtSetCurrentContext(IniFile.m_ProjectSceneContext) + If EgtTdbGetFirstTool(ToolsFamily.FamilyId, ToolName, nType) Then + FamilyTreeView.Items.Add(New ToolTreeViewItem(ToolName)) + While EgtTdbGetNextTool(ToolsFamily.FamilyId, ToolName, nType) FamilyTreeView.Items.Add(New ToolTreeViewItem(ToolName)) - While EgtTdbGetNextTool(ToolsFamily.FamilyId, ToolName, nType) - FamilyTreeView.Items.Add(New ToolTreeViewItem(ToolName)) - End While - End If - Next - ' Se esiste almeno una famiglia di utensili, la seleziono - If ToolsList.Count > 0 Then - ToolsList(0).IsSelected = True - ToolsList(0).NotifyPropertyChanged("IsSelected") + End While End If + Next + ' Se esiste almeno una famiglia di utensili, la seleziono + If ToolsList.Count > 0 Then + ToolsList(0).IsSelected = True + ToolsList(0).NotifyPropertyChanged("IsSelected") + End If - End Sub + End Sub #End Region ' Methods @@ -372,272 +370,270 @@ Namespace EgtCAM5 #Region "NewCommand" - ''' - ''' Returns a command that create a new tool. - ''' - Public ReadOnly Property NewCommand As ICommand - Get - If m_cmdNew Is Nothing Then - m_cmdNew = New RelayCommand(AddressOf NewPar) - End If - Return m_cmdNew - End Get - End Property - - ''' - ''' Creata the new tool. This method is invoked by the NewCommand. - ''' - Public Sub NewPar(ByVal param As Object) - EgtSetCurrentContext(IniFile.m_ProjectSceneContext) - ' Verifico se sia selezionata una famiglia - Dim NewToolItem As ToolTreeViewItem - If TypeOf param Is FamilyToolTreeViewItem Then - Dim ToolFamily As FamilyToolTreeViewItem = DirectCast(param, FamilyToolTreeViewItem) - Dim NewName As String = ToolFamily.Name - EgtTdbGetToolNewName(NewName) - If EgtTdbAddTool(NewName, ToolFamily.ToolType) Then - NewToolItem = New ToolTreeViewItem(NewName) - ToolFamily.Items.Add(NewToolItem) - EgtTdbSaveCurrTool() - NewToolItem.NewTool = True - If Not ToolFamily.IsExpanded Then ToolFamily.IsExpanded = True - NewToolItem.IsSelected = True - NewToolItem.NotifyPropertyChanged("IsSelected") - End If - ' Verifico se sia selezionato un utensile - ElseIf TypeOf param Is ToolTreeViewItem Then - Dim ToolCopied As ToolTreeViewItem = DirectCast(param, ToolTreeViewItem) - Dim NewName As String = ToolCopied.Name - EgtTdbGetToolNewName(NewName) - If EgtTdbCopyTool(ToolCopied.Name, NewName) Then - ' Elimino disegno che non deve essere copiato - EgtTdbSetCurrToolParam(MCH_TP.DRAW, String.Empty) - Dim CurrType As Integer - EgtTdbGetCurrToolParam(MCH_TP.TYPE, CurrType) - For Each ToolFamily In ToolsList - If (ToolFamily.ToolType And CurrType) <> 0 Then - NewToolItem = New ToolTreeViewItem(NewName) - ToolFamily.Items.Add(NewToolItem) - EgtTdbSaveCurrTool() - NewToolItem.NewTool = True - ' Reimposto l'utensile vecchio nel Db per deselezionarlo e fare le verifiche correttamente - EgtTdbSetCurrTool(ToolCopied.Name) - ToolCopied.IsSelected = False - ToolCopied.NotifyPropertyChanged("IsSelected") - NewToolItem.IsSelected = True - Exit For - End If - Next - End If + ''' + ''' Returns a command that create a new tool. + ''' + Public ReadOnly Property NewCommand As ICommand + Get + If m_cmdNew Is Nothing Then + m_cmdNew = New RelayCommand(AddressOf NewPar) End If + Return m_cmdNew + End Get + End Property - End Sub + ''' + ''' Creata the new tool. This method is invoked by the NewCommand. + ''' + Public Sub NewPar(ByVal param As Object) + EgtSetCurrentContext(IniFile.m_ProjectSceneContext) + ' Verifico se sia selezionata una famiglia + Dim NewToolItem As ToolTreeViewItem + If TypeOf param Is FamilyToolTreeViewItem Then + Dim ToolFamily As FamilyToolTreeViewItem = DirectCast(param, FamilyToolTreeViewItem) + Dim NewName As String = ToolFamily.Name + EgtTdbGetToolNewName(NewName) + If EgtTdbAddTool(NewName, ToolFamily.ToolType) Then + NewToolItem = New ToolTreeViewItem(NewName) + ToolFamily.Items.Add(NewToolItem) + EgtTdbSaveCurrTool() + NewToolItem.NewTool = True + If Not ToolFamily.IsExpanded Then ToolFamily.IsExpanded = True + NewToolItem.IsSelected = True + NewToolItem.NotifyPropertyChanged("IsSelected") + End If + ' Verifico se sia selezionato un utensile + ElseIf TypeOf param Is ToolTreeViewItem Then + Dim ToolCopied As ToolTreeViewItem = DirectCast(param, ToolTreeViewItem) + Dim NewName As String = ToolCopied.Name + EgtTdbGetToolNewName(NewName) + If EgtTdbCopyTool(ToolCopied.Name, NewName) Then + ' Elimino disegno che non deve essere copiato + EgtTdbSetCurrToolParam(MCH_TP.DRAW, String.Empty) + Dim CurrType As Integer + EgtTdbGetCurrToolParam(MCH_TP.TYPE, CurrType) + For Each ToolFamily In ToolsList + If (ToolFamily.ToolType And CurrType) <> 0 Then + NewToolItem = New ToolTreeViewItem(NewName) + ToolFamily.Items.Add(NewToolItem) + EgtTdbSaveCurrTool() + NewToolItem.NewTool = True + ' Reimposto l'utensile vecchio nel Db per deselezionarlo e fare le verifiche correttamente + EgtTdbSetCurrTool(ToolCopied.Name) + ToolCopied.IsSelected = False + ToolCopied.NotifyPropertyChanged("IsSelected") + NewToolItem.IsSelected = True + Exit For + End If + Next + End If + End If + + End Sub #End Region ' NewCommand #Region "SaveCommand" - ''' - ''' Returns a command that save the current selected tool. - ''' - 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 - - ''' - ''' Saves the current tool. This method is invoked by the SaveCommand. - ''' - Public Sub Save(ByVal param As Object) - Dim CurrTool As ToolTreeViewItem = DirectCast(param, ToolTreeViewItem) - CurrTool.WriteToolParam() - CurrTool.m_Name = CurrTool.m_Name.Trim() - CurrTool.WriteToolName() - If IsUUID(Path.GetFileNameWithoutExtension(CurrTool.m_Draw)) Then - CurrTool.SaveToolDraw() + ''' + ''' Returns a command that save the current selected tool. + ''' + Public ReadOnly Property SaveCommand() As ICommand + Get + If m_cmdSave Is Nothing Then + m_cmdSave = New RelayCommand(AddressOf Save) End If - EgtTdbSaveCurrTool() - CurrTool.NewTool = False - CurrTool.IsModifiedReset() - IsEnabledBtns(CurrTool.IsValid And Not CurrTool.IsModified, False, True) - End Sub + Return m_cmdSave + End Get + End Property + + ''' + ''' Saves the current tool. This method is invoked by the SaveCommand. + ''' + Public Sub Save(ByVal param As Object) + Dim CurrTool As ToolTreeViewItem = DirectCast(param, ToolTreeViewItem) + CurrTool.WriteToolParam() + CurrTool.m_Name = CurrTool.m_Name.Trim() + CurrTool.WriteToolName() + If IsUUID(Path.GetFileNameWithoutExtension(CurrTool.m_Draw)) Then + CurrTool.SaveToolDraw() + End If + EgtTdbSaveCurrTool() + CurrTool.NewTool = False + CurrTool.IsModifiedReset() + IsEnabledBtns(CurrTool.IsValid And Not CurrTool.IsModified, False, True) + End Sub #End Region ' SaveCommand #Region "RemoveCommand" - ''' - ''' Returns a command that remove the current selected tool. - ''' - 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 - - ''' - ''' Remove the current selected tools from Db and TreeView. This method is invoked by the RemoveCommand. - ''' - Public Sub Remove(ByVal param As Object) - Dim ToolToRemove As ToolTreeViewItem = DirectCast(param, ToolTreeViewItem) - ' Chiedo conferma cancellazione lavorazione - If MessageBox.Show(EgtMsg(MSG_TOOLSERRORS + 22) & " " & ToolToRemove.Name & EgtMsg(MSG_TOOLSERRORS + 23), EgtMsg(MSG_TOOLSERRORS + 24), MessageBoxButton.YesNo, MessageBoxImage.Question) <> MessageBoxResult.Yes Then - Return + ''' + ''' Returns a command that remove the current selected tool. + ''' + Public ReadOnly Property RemoveCommand() As ICommand + Get + If m_cmdRemove Is Nothing Then + m_cmdRemove = New RelayCommand(AddressOf Remove) End If - RemoveTool(ToolToRemove) - End Sub + Return m_cmdRemove + End Get + End Property - Private Sub RemoveTool(ToolToRemove As ToolTreeViewItem) - EgtSetCurrentContext(IniFile.m_ProjectSceneContext) - ' Cancello disegno dell'utensile - EraseToolDraw() - ' Salvo il tipo di utensile per poterlo cancellare - Dim ToolType As Integer = ToolToRemove.Type - ' Cancello l'utensile - Dim CurrToolOriginalName As String = String.Empty - EgtTdbGetToolFromUUID(ToolToRemove.Uuid, CurrToolOriginalName) - EgtTdbRemoveTool(CurrToolOriginalName) - ' Rimuovo il nome dell'albero - For Each ToolFamily In ToolsList - If (ToolFamily.ToolType And ToolType) <> 0 Then - ToolFamily.Items.Remove(ToolToRemove) - End If - Next - ErrorOnTool(False) - End Sub + ''' + ''' Remove the current selected tools from Db and TreeView. This method is invoked by the RemoveCommand. + ''' + Public Sub Remove(ByVal param As Object) + Dim ToolToRemove As ToolTreeViewItem = DirectCast(param, ToolTreeViewItem) + ' Chiedo conferma cancellazione lavorazione + If MessageBox.Show(EgtMsg(MSG_TOOLSERRORS + 22) & " " & ToolToRemove.Name & EgtMsg(MSG_TOOLSERRORS + 23), EgtMsg(MSG_TOOLSERRORS + 24), MessageBoxButton.YesNo, MessageBoxImage.Question) <> MessageBoxResult.Yes Then + Return + End If + RemoveTool(ToolToRemove) + End Sub - Private Function EraseToolDraw() As Boolean - ' nome e direttorio del file da cancellare - EgtSetCurrentContext(IniFile.m_ProjectSceneContext) - Dim sDrawName As String = String.Empty - EgtTdbGetCurrToolParam(MCH_TP.DRAW, sDrawName) - Dim sPath As String = String.Empty - EgtTdbGetToolDir(sPath) - sPath = sPath & "\" & sDrawName - ' se automatico ed esiste lo cancello - Try - If IsUUID(Path.GetFileNameWithoutExtension(sPath)) And - My.Computer.FileSystem.FileExists(sPath) Then - My.Computer.FileSystem.DeleteFile(sPath) - End If - Return True - Catch ex As Exception - Return False - End Try - End Function + Private Sub RemoveTool(ToolToRemove As ToolTreeViewItem) + EgtSetCurrentContext(IniFile.m_ProjectSceneContext) + ' Cancello disegno dell'utensile + EraseToolDraw() + ' Salvo il tipo di utensile per poterlo cancellare + Dim ToolType As Integer = ToolToRemove.Type + ' Cancello l'utensile + Dim CurrToolOriginalName As String = String.Empty + EgtTdbGetToolFromUUID(ToolToRemove.Uuid, CurrToolOriginalName) + EgtTdbRemoveTool(CurrToolOriginalName) + ' Rimuovo il nome dell'albero + For Each ToolFamily In ToolsList + If (ToolFamily.ToolType And ToolType) <> 0 Then + ToolFamily.Items.Remove(ToolToRemove) + End If + Next + ErrorOnTool(False) + End Sub + + Private Function EraseToolDraw() As Boolean + ' nome e direttorio del file da cancellare + EgtSetCurrentContext(IniFile.m_ProjectSceneContext) + Dim sDrawName As String = String.Empty + EgtTdbGetCurrToolParam(MCH_TP.DRAW, sDrawName) + Dim sPath As String = String.Empty + EgtTdbGetToolDir(sPath) + sPath = sPath & "\" & sDrawName + ' se automatico ed esiste lo cancello + Try + If IsUUID(Path.GetFileNameWithoutExtension(sPath)) And + My.Computer.FileSystem.FileExists(sPath) Then + My.Computer.FileSystem.DeleteFile(sPath) + End If + Return True + Catch ex As Exception + Return False + End Try + End Function #End Region ' RemoveCommand #Region "ReloadToolCommand" - ''' - ''' Returns a command that reload the current selected tool. - ''' - Public ReadOnly Property ReloadToolCommand() As ICommand - Get - If m_cmdReloadTool Is Nothing Then - m_cmdReloadTool = New RelayCommand(AddressOf ReloadTool) - End If - Return m_cmdReloadTool - End Get - End Property - - ''' - ''' Reload the current selected tools. This method is invoked by the RemoveCommand. - ''' - Public Sub ReloadTool(ByVal param As Object) - If TypeOf param Is FamilyToolTreeViewItem Then - Return - ' Verifico se sia selezionato un utensile - ElseIf TypeOf param Is ToolTreeViewItem Then - Dim ToolToReload As ToolTreeViewItem = DirectCast(param, ToolTreeViewItem) - EgtSetCurrentContext(IniFile.m_ProjectSceneContext) - ToolToReload.ReadToolParam() - ToolToReload.ReadToolName() - ToolToReload.IsModifiedReset() + ''' + ''' Returns a command that reload the current selected tool. + ''' + Public ReadOnly Property ReloadToolCommand() As ICommand + Get + If m_cmdReloadTool Is Nothing Then + m_cmdReloadTool = New RelayCommand(AddressOf ReloadTool) End If - End Sub + Return m_cmdReloadTool + End Get + End Property + + ''' + ''' Reload the current selected tools. This method is invoked by the RemoveCommand. + ''' + Public Sub ReloadTool(ByVal param As Object) + If TypeOf param Is FamilyToolTreeViewItem Then + Return + ' Verifico se sia selezionato un utensile + ElseIf TypeOf param Is ToolTreeViewItem Then + Dim ToolToReload As ToolTreeViewItem = DirectCast(param, ToolTreeViewItem) + EgtSetCurrentContext(IniFile.m_ProjectSceneContext) + ToolToReload.ReadToolParam() + ToolToReload.ReadToolName() + ToolToReload.IsModifiedReset() + End If + End Sub #End Region ' ReloadToolCommand #Region "CloseToolDbCommand" - ''' - ''' Returns a command that remove the current selected machining. - ''' - Public ReadOnly Property CloseToolsDbCommand() As ICommand - Get - If m_cmdCloseToolsDb Is Nothing Then - m_cmdCloseToolsDb = New RelayCommand(AddressOf CloseToolsDb) - End If - Return m_cmdCloseToolsDb - End Get - End Property - - ''' - ''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand. - ''' - Public Sub CloseToolsDb(param As Object) - m_bActive = False - ' Imposto contesto di progetto - EgtSetCurrentContext(IniFile.m_ProjectSceneContext) - ' Se selezionata una lavorazione, verifico salvataggio - If TypeOf param Is ToolTreeViewItem Then - Dim CurrTool As ToolTreeViewItem = DirectCast(param, ToolTreeViewItem) - If CurrTool.IsValid Then - CurrTool.WriteToolParam() - If EgtTdbIsCurrToolModified() Or CurrTool.m_IsModifiedName Or CurrTool.NewTool Then - Select Case MsgBox(EgtMsg(MSG_TOOLSERRORS), MsgBoxStyle.YesNo, EgtMsg(MSG_TOOLSERRORS + 1)) - Case MsgBoxResult.Yes - CurrTool.NewTool = False - CurrTool.m_Name = CurrTool.m_Name.Trim() - CurrTool.WriteToolName() - EgtTdbSaveCurrTool() - Case MsgBoxResult.No - If CurrTool.NewTool Then - RemoveTool(CurrTool) - ElseIf CurrTool.m_IsModifiedName Then - Dim DbName As String = String.Empty - EgtTdbGetCurrToolParam(MCH_TP.NAME, DbName) - CurrTool.NamePar = DbName - End If - End Select - End If - Else - MessageBox.Show(EgtMsg(MSG_TOOLSERRORS + 29), EgtMsg(MSG_TOOLSERRORS + 26)) - Return - End If + ''' + ''' Returns a command that remove the current selected machining. + ''' + Public ReadOnly Property CloseToolsDbCommand() As ICommand + Get + If m_cmdCloseToolsDb Is Nothing Then + m_cmdCloseToolsDb = New RelayCommand(AddressOf CloseToolsDb) End If - ' Salvataggio DB utensili - EgtTdbSave() - ' Reset lua - EgtLuaResetGlobVar("STU") - ' Chiusura finestra - ToolTreeViewItem.m_delRemoveTool = Nothing - ToolTreeViewItem.m_delErrorOnTool = Nothing - ToolTreeViewItem.m_delIsEnabledBtns = Nothing - FamilyToolTreeViewItem.m_delIsEnabledBtns = Nothing - For Each Window In Application.Current.Windows - If TypeOf Window Is ToolsDbV Then - Dim ToolsDbWindow As ToolsDbV = DirectCast(Window, ToolsDbV) - ToolsDbWindow.DataContext = Nothing - ToolsDbWindow.Close() + Return m_cmdCloseToolsDb + End Get + End Property + + ''' + ''' Manage the MachiningDb closing. This method is invoked by the CloseMachiningDbCommand. + ''' + Public Sub CloseToolsDb(param As Object) + m_bActive = False + ' Imposto contesto di progetto + EgtSetCurrentContext(IniFile.m_ProjectSceneContext) + ' Se selezionata una lavorazione, verifico salvataggio + If TypeOf param Is ToolTreeViewItem Then + Dim CurrTool As ToolTreeViewItem = DirectCast(param, ToolTreeViewItem) + If CurrTool.IsValid Then + CurrTool.WriteToolParam() + If EgtTdbIsCurrToolModified() Or CurrTool.m_IsModifiedName Or CurrTool.NewTool Then + Select Case MsgBox(EgtMsg(MSG_TOOLSERRORS), MsgBoxStyle.YesNo, EgtMsg(MSG_TOOLSERRORS + 1)) + Case MsgBoxResult.Yes + CurrTool.NewTool = False + CurrTool.m_Name = CurrTool.m_Name.Trim() + CurrTool.WriteToolName() + EgtTdbSaveCurrTool() + Case MsgBoxResult.No + If CurrTool.NewTool Then + RemoveTool(CurrTool) + ElseIf CurrTool.m_IsModifiedName Then + Dim DbName As String = String.Empty + EgtTdbGetCurrToolParam(MCH_TP.NAME, DbName) + CurrTool.NamePar = DbName + End If + End Select End If - Next - End Sub + Else + MessageBox.Show(EgtMsg(MSG_TOOLSERRORS + 29), EgtMsg(MSG_TOOLSERRORS + 26)) + Return + End If + End If + ' Salvataggio DB utensili + EgtTdbSave() + ' Reset lua + EgtLuaResetGlobVar("STU") + ' Chiusura finestra + ToolTreeViewItem.m_delRemoveTool = Nothing + ToolTreeViewItem.m_delErrorOnTool = Nothing + ToolTreeViewItem.m_delIsEnabledBtns = Nothing + FamilyToolTreeViewItem.m_delIsEnabledBtns = Nothing + For Each Window In Application.Current.Windows + If TypeOf Window Is ToolsDbV Then + Dim ToolsDbWindow As ToolsDbV = DirectCast(Window, ToolsDbV) + ToolsDbWindow.DataContext = Nothing + ToolsDbWindow.Close() + End If + Next + End Sub #End Region ' CloseToolsDbCommand #End Region ' Commands - End Class - -End Namespace \ No newline at end of file +End Class \ No newline at end of file diff --git a/TopCommandBar/TopCommandBarVM.vb b/TopCommandBar/TopCommandBarVM.vb index 12c1bc9..2a08591 100644 --- a/TopCommandBar/TopCommandBarVM.vb +++ b/TopCommandBar/TopCommandBarVM.vb @@ -2,227 +2,225 @@ Imports System.IO Imports EgtUILib -Namespace EgtCAM5 - - Public Class TopCommandBarVM - Inherits ViewModelBase +Public Class TopCommandBarVM + Inherits ViewModelBase #Region "FIELDS & PROPERTIES" - Private m_ProjectMode As ProjectModeOpt + Private m_ProjectMode As ProjectModeOpt - Public ReadOnly Property MruFileNames As ObservableCollection(Of String) - Get - Return IniFile.m_MruFiles.m_FileNames - End Get - End Property + Public ReadOnly Property MruFileNames As ObservableCollection(Of String) + Get + Return IniFile.m_MruFiles.m_FileNames + End Get + End Property - ' Definizione comandi - Private m_cmdNew As ICommand - Private m_cmdOpen As ICommand - Private Shared m_cmdOpenMruFile As ICommand - Private m_cmdSave As ICommand - Private m_cmdSaveAs As ICommand - Private m_cmdInsert As ICommand - Private m_cmdImport As ICommand - Private m_cmdExport As ICommand - Private m_cmdOptions As ICommand - Private m_cmdSendFeedback As ICommand + ' Definizione comandi + Private m_cmdNew As ICommand + Private m_cmdOpen As ICommand + Private Shared m_cmdOpenMruFile As ICommand + Private m_cmdSave As ICommand + Private m_cmdSaveAs As ICommand + Private m_cmdInsert As ICommand + Private m_cmdImport As ICommand + Private m_cmdExport As ICommand + Private m_cmdOptions As ICommand + Private m_cmdSendFeedback As ICommand #Region "Messages" - Public ReadOnly Property DrawMsg As String - Get - Return EgtMsg(MSG_MAINWINDOW + 1) - End Get - End Property - Public ReadOnly Property MachiningMsg As String - Get - Return EgtMsg(MSG_MAINWINDOW + 2) - End Get - End Property + Public ReadOnly Property DrawMsg As String + Get + Return EgtMsg(MSG_MAINWINDOW + 1) + End Get + End Property + Public ReadOnly Property MachiningMsg As String + Get + Return EgtMsg(MSG_MAINWINDOW + 2) + End Get + End Property #End Region ' Messages #Region "ToolTip" - 'Proprietà ToolTip - Public ReadOnly Property NewToolTip As String - Get - Return EgtMsg(MSG_TOPCOMMANDBAR + 1) - End Get - End Property - Public ReadOnly Property OpenToolTip As String - Get - Return EgtMsg(MSG_TOPCOMMANDBAR + 2) - End Get - End Property - Public ReadOnly Property SaveToolTip As String - Get - Return EgtMsg(MSG_TOPCOMMANDBAR + 3) - End Get - End Property - Public ReadOnly Property SaveAsToolTip As String - Get - Return EgtMsg(MSG_TOPCOMMANDBAR + 4) - End Get - End Property - Public ReadOnly Property InsertToolTip As String - Get - Return EgtMsg(MSG_TOPCOMMANDBAR + 5) - End Get - End Property - Public ReadOnly Property ImportToolTip As String - Get - Return EgtMsg(MSG_TOPCOMMANDBAR + 6) - End Get - End Property - Public ReadOnly Property ExportToolTip As String - Get - Return EgtMsg(MSG_TOPCOMMANDBAR + 7) - End Get - End Property - Public ReadOnly Property OptionsToolTip As String - Get - Return EgtMsg(MSG_TOPCOMMANDBAR + 9) - End Get - End Property - Public ReadOnly Property SendFeedbackToolTip As String - Get - Return EgtMsg(MSG_TOPCOMMANDBAR + 13) - End Get - End Property + 'Proprietà ToolTip + Public ReadOnly Property NewToolTip As String + Get + Return EgtMsg(MSG_TOPCOMMANDBAR + 1) + End Get + End Property + Public ReadOnly Property OpenToolTip As String + Get + Return EgtMsg(MSG_TOPCOMMANDBAR + 2) + End Get + End Property + Public ReadOnly Property SaveToolTip As String + Get + Return EgtMsg(MSG_TOPCOMMANDBAR + 3) + End Get + End Property + Public ReadOnly Property SaveAsToolTip As String + Get + Return EgtMsg(MSG_TOPCOMMANDBAR + 4) + End Get + End Property + Public ReadOnly Property InsertToolTip As String + Get + Return EgtMsg(MSG_TOPCOMMANDBAR + 5) + End Get + End Property + Public ReadOnly Property ImportToolTip As String + Get + Return EgtMsg(MSG_TOPCOMMANDBAR + 6) + End Get + End Property + Public ReadOnly Property ExportToolTip As String + Get + Return EgtMsg(MSG_TOPCOMMANDBAR + 7) + End Get + End Property + Public ReadOnly Property OptionsToolTip As String + Get + Return EgtMsg(MSG_TOPCOMMANDBAR + 9) + End Get + End Property + Public ReadOnly Property SendFeedbackToolTip As String + Get + Return EgtMsg(MSG_TOPCOMMANDBAR + 13) + End Get + End Property #End Region ' ToolTip - Private m_DrawIsChecked As Boolean - Public Property DrawIsChecked As Boolean - Get - Return m_DrawIsChecked - End Get - Set(value As Boolean) - If value <> m_DrawIsChecked Then - m_DrawIsChecked = value - SetDrawMode(value) - OnPropertyChanged("DrawIsChecked") - End If - End Set - End Property + Private m_DrawIsChecked As Boolean + Public Property DrawIsChecked As Boolean + Get + Return m_DrawIsChecked + End Get + Set(value As Boolean) + If value <> m_DrawIsChecked Then + m_DrawIsChecked = value + SetDrawMode(value) + OnPropertyChanged("DrawIsChecked") + End If + End Set + End Property - Private m_MachiningIsChecked As Boolean - Public Property MachiningIsChecked As Boolean - Get - Return m_MachiningIsChecked - End Get - Set(value As Boolean) - If value <> m_MachiningIsChecked Then - m_MachiningIsChecked = value - SetMachiningMode(value) - End If - End Set - End Property + Private m_MachiningIsChecked As Boolean + Public Property MachiningIsChecked As Boolean + Get + Return m_MachiningIsChecked + End Get + Set(value As Boolean) + If value <> m_MachiningIsChecked Then + m_MachiningIsChecked = value + SetMachiningMode(value) + End If + End Set + End Property - Private m_DrawIsEnabled As Boolean = True - Public Property DrawIsEnabled As Boolean - Get - Return m_DrawIsEnabled - End Get - Set(value As Boolean) - m_DrawIsEnabled = value - OnPropertyChanged("DrawIsEnabled") - End Set - End Property + Private m_DrawIsEnabled As Boolean = True + Public Property DrawIsEnabled As Boolean + Get + Return m_DrawIsEnabled + End Get + Set(value As Boolean) + m_DrawIsEnabled = value + OnPropertyChanged("DrawIsEnabled") + End Set + End Property - Private m_MachiningIsEnabled As Boolean - Public Property MachiningIsEnabled As Boolean - Get - Return m_MachiningIsEnabled - End Get - Set(value As Boolean) - m_MachiningIsEnabled = value - OnPropertyChanged("MachiningIsEnabled") - End Set - End Property + Private m_MachiningIsEnabled As Boolean + Public Property MachiningIsEnabled As Boolean + Get + Return m_MachiningIsEnabled + End Get + Set(value As Boolean) + m_MachiningIsEnabled = value + OnPropertyChanged("MachiningIsEnabled") + End Set + End Property - Private m_SaveIsEnabled As Boolean = True - Public Property SaveIsEnabled As Boolean - Get - Return m_SaveIsEnabled - End Get - Set(value As Boolean) - If value <> m_SaveIsEnabled Then - m_SaveIsEnabled = value - OnPropertyChanged("SaveIsEnabled") - End If - End Set - End Property + Private m_SaveIsEnabled As Boolean = True + Public Property SaveIsEnabled As Boolean + Get + Return m_SaveIsEnabled + End Get + Set(value As Boolean) + If value <> m_SaveIsEnabled Then + m_SaveIsEnabled = value + OnPropertyChanged("SaveIsEnabled") + End If + End Set + End Property #End Region ' Fields & Properties #Region "Get & Set" - Friend Function GetProjectMode() As ProjectModeOpt - Return m_ProjectMode - End Function + Friend Function GetProjectMode() As ProjectModeOpt + Return m_ProjectMode + End Function - Private Sub SetDrawMode(value As Boolean) - If value Then - Application.Msn.NotifyColleagues(Application.DRAWMODE_ISCHECKED) - EgtResetCurrMachGroup() - EgtZoom(ZM.ALL) - Application.Msn.NotifyColleagues(Application.LOADOBJTREE) - IniFile.m_ProjectMode = ProjectModeOpt.DRAW - End If - End Sub + Private Sub SetDrawMode(value As Boolean) + If value Then + Application.Msn.NotifyColleagues(Application.DRAWMODE_ISCHECKED) + EgtResetCurrMachGroup() + EgtZoom(ZM.ALL) + Application.Msn.NotifyColleagues(Application.LOADOBJTREE) + IniFile.m_ProjectMode = ProjectModeOpt.DRAW + End If + End Sub - Private Sub SetMachiningMode(value As Boolean) - If value Then - Application.Msn.NotifyColleagues(Application.INITIALIZEMACHGROUPS) - Else - ' Deevidenzio l'ultima operazione evidenziata - Application.Msn.NotifyColleagues(Application.REMOVEMARKFROMLASTOPERATION) - ' e deseleziono tutto - EgtDeselectAll() - End If - End Sub + Private Sub SetMachiningMode(value As Boolean) + If value Then + Application.Msn.NotifyColleagues(Application.INITIALIZEMACHGROUPS) + Else + ' Deevidenzio l'ultima operazione evidenziata + Application.Msn.NotifyColleagues(Application.REMOVEMARKFROMLASTOPERATION) + ' e deseleziono tutto + EgtDeselectAll() + End If + End Sub #End Region ' Get & Set #Region "CONSTRUCTOR" - Sub New() - ' Creo riferimento a questa classe in EgtCAM5Map - Map.SetRefTopCommandBarVM(Me) - ' Inizializzo la selezione della modilità Draw all'apertura del programma - DrawIsChecked = True - Application.Msn.Register(Application.SETMACHININGMODE, Sub() - MachiningIsChecked = True - OnPropertyChanged("MachiningIsChecked") - End Sub) - Application.Msn.Register(Application.MACHGROUPSRESULT, Sub(bOk As Boolean) - If bOk Then - 'EgtZoom(ZM.ALL) - Application.Msn.NotifyColleagues(Application.UPDATECURRENTMACHINE) - Application.Msn.NotifyColleagues(Application.MACHININGMODE_ISCHECKED) - Application.Msn.NotifyColleagues(Application.UPDATEOPERATIONMACHININGLIST) - IniFile.m_ProjectMode = ProjectModeOpt.MACHINING - Else - m_MachiningIsChecked = False - ' Error loading or creating Machining Group - Error - MessageBox.Show(EgtMsg(10008), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) - End If - End Sub) - Application.Msn.Register(Application.MAINWINDOW_CONTENTRENDERED, Sub() - If IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then - MachiningIsEnabled = False - Else - MachiningIsEnabled = True - End If - End Sub) - Application.Msn.Register(Application.SETDRAWISENABLED, Sub(DrawIsEnabled As Boolean) - Me.DrawIsEnabled = DrawIsEnabled - End Sub) - End Sub + Sub New() + ' Creo riferimento a questa classe in EgtCAM5Map + Map.SetRefTopCommandBarVM(Me) + ' Inizializzo la selezione della modilità Draw all'apertura del programma + DrawIsChecked = True + Application.Msn.Register(Application.SETMACHININGMODE, Sub() + MachiningIsChecked = True + OnPropertyChanged("MachiningIsChecked") + End Sub) + Application.Msn.Register(Application.MACHGROUPSRESULT, Sub(bOk As Boolean) + If bOk Then + 'EgtZoom(ZM.ALL) + Application.Msn.NotifyColleagues(Application.UPDATECURRENTMACHINE) + Application.Msn.NotifyColleagues(Application.MACHININGMODE_ISCHECKED) + Application.Msn.NotifyColleagues(Application.UPDATEOPERATIONMACHININGLIST) + IniFile.m_ProjectMode = ProjectModeOpt.MACHINING + Else + m_MachiningIsChecked = False + ' Error loading or creating Machining Group - Error + MessageBox.Show(EgtMsg(10008), EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) + End If + End Sub) + Application.Msn.Register(Application.MAINWINDOW_CONTENTRENDERED, Sub() + If IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then + MachiningIsEnabled = False + Else + MachiningIsEnabled = True + End If + End Sub) + Application.Msn.Register(Application.SETDRAWISENABLED, Sub(DrawIsEnabled As Boolean) + Me.DrawIsEnabled = DrawIsEnabled + End Sub) + End Sub #End Region @@ -230,368 +228,366 @@ Namespace EgtCAM5 #Region "NewCommand" - ''' - ''' Returns a command that do New. - ''' - Public ReadOnly Property NewCommand As ICommand - Get - If m_cmdNew Is Nothing Then - m_cmdNew = New RelayCommand(AddressOf NewCmd) - End If - Return m_cmdNew - End Get - End Property + ''' + ''' Returns a command that do New. + ''' + Public ReadOnly Property NewCommand As ICommand + Get + If m_cmdNew Is Nothing Then + m_cmdNew = New RelayCommand(AddressOf NewCmd) + End If + Return m_cmdNew + End Get + End Property - ''' - ''' Execute the New. This method is invoked by the NewCommand. - ''' - Friend Sub NewCmd() - Map.refProjectVM.GetController.NewProject(True) - Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREENOMARK, EgtGetCurrLayer()) - OnPropertyChanged("MruFileNames") - End Sub + ''' + ''' Execute the New. This method is invoked by the NewCommand. + ''' + Friend Sub NewCmd() + Map.refProjectVM.GetController.NewProject(True) + Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREENOMARK, EgtGetCurrLayer()) + OnPropertyChanged("MruFileNames") + End Sub #End Region ' NewCommand #Region "OpenCommand" - ''' - ''' Returns a command that do Open. - ''' - Public ReadOnly Property OpenCommand As ICommand - Get - If m_cmdOpen Is Nothing Then - m_cmdOpen = New RelayCommand(AddressOf Open) - End If - Return m_cmdOpen - End Get - End Property - - ''' - ''' Execute the Open. This method is invoked by the OpenCommand. - ''' - Friend Sub Open() - OpenProject(String.Empty) - End Sub - - Friend Sub OpenProject(sFilePath As String) - If String.IsNullOrEmpty(sFilePath) Then - Dim sDir As String = String.Empty - GetPrivateProfileString(S_GENERAL, K_LASTNGEDIR, "", sDir) - Map.refProjectVM.GetController.OpenProject(sDir) - Else - Map.refProjectVM.GetController.OpenProject(sFilePath, False) + ''' + ''' Returns a command that do Open. + ''' + Public ReadOnly Property OpenCommand As ICommand + Get + If m_cmdOpen Is Nothing Then + m_cmdOpen = New RelayCommand(AddressOf Open) End If - Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREENOMARK, EgtGetCurrLayer()) - End Sub + Return m_cmdOpen + End Get + End Property + + ''' + ''' Execute the Open. This method is invoked by the OpenCommand. + ''' + Friend Sub Open() + OpenProject(String.Empty) + End Sub + + Friend Sub OpenProject(sFilePath As String) + If String.IsNullOrEmpty(sFilePath) Then + Dim sDir As String = String.Empty + GetPrivateProfileString(S_GENERAL, K_LASTNGEDIR, "", sDir) + Map.refProjectVM.GetController.OpenProject(sDir) + Else + Map.refProjectVM.GetController.OpenProject(sFilePath, False) + End If + Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREENOMARK, EgtGetCurrLayer()) + End Sub #End Region ' OpenCommand #Region "OpenMruFileCommand" - ''' - ''' Returns a command that do Open. - ''' - Public ReadOnly Property OpenMruFileCommand As ICommand - Get - If m_cmdOpenMruFile Is Nothing Then - m_cmdOpenMruFile = New RelayCommand(AddressOf OpenMruFile) - End If - Return m_cmdOpenMruFile - End Get - End Property + ''' + ''' Returns a command that do Open. + ''' + Public ReadOnly Property OpenMruFileCommand As ICommand + Get + If m_cmdOpenMruFile Is Nothing Then + m_cmdOpenMruFile = New RelayCommand(AddressOf OpenMruFile) + End If + Return m_cmdOpenMruFile + End Get + End Property - ''' - ''' Execute the Open. This method is invoked by the OpenCommand. - ''' - Public Sub OpenMruFile(ByVal param As Object) - OpenProject(DirectCast(param, String).Replace("__", "_")) - End Sub + ''' + ''' Execute the Open. This method is invoked by the OpenCommand. + ''' + Public Sub OpenMruFile(ByVal param As Object) + OpenProject(DirectCast(param, String).Replace("__", "_")) + End Sub #End Region ' OpenMruFileCommand #Region "SaveCommand" - ''' - ''' Returns a command that do Save. - ''' - Public ReadOnly Property SaveCommand As ICommand - Get - If m_cmdSave Is Nothing Then - m_cmdSave = New RelayCommand(AddressOf Save) - End If - Return m_cmdSave - End Get - End Property + ''' + ''' Returns a command that do Save. + ''' + Public ReadOnly Property SaveCommand As ICommand + Get + If m_cmdSave Is Nothing Then + m_cmdSave = New RelayCommand(AddressOf Save) + End If + Return m_cmdSave + End Get + End Property - ''' - ''' Execute the Save. This method is invoked by the SaveCommand. - ''' - Public Sub Save(ByVal param As Object) - Application.Msn.NotifyColleagues(Application.SAVEPROJECT) - End Sub + ''' + ''' Execute the Save. This method is invoked by the SaveCommand. + ''' + Public Sub Save(ByVal param As Object) + Application.Msn.NotifyColleagues(Application.SAVEPROJECT) + End Sub #End Region ' SaveCommand #Region "SaveAsCommand" - ''' - ''' Returns a command that do SaveAs. - ''' - Public ReadOnly Property SaveAsCommand As ICommand - Get - If m_cmdSaveAs Is Nothing Then - m_cmdSaveAs = New RelayCommand(AddressOf SaveAs) - End If - Return m_cmdSaveAs - End Get - End Property + ''' + ''' Returns a command that do SaveAs. + ''' + Public ReadOnly Property SaveAsCommand As ICommand + Get + If m_cmdSaveAs Is Nothing Then + m_cmdSaveAs = New RelayCommand(AddressOf SaveAs) + End If + Return m_cmdSaveAs + End Get + End Property - ''' - ''' Execute the SaveAs. This method is invoked by the SaveAsCommand. - ''' - Public Sub SaveAs(ByVal param As Object) - Application.Msn.NotifyColleagues(Application.SAVEASPROJECT) - End Sub + ''' + ''' Execute the SaveAs. This method is invoked by the SaveAsCommand. + ''' + Public Sub SaveAs(ByVal param As Object) + Application.Msn.NotifyColleagues(Application.SAVEASPROJECT) + End Sub #End Region ' SaveAsCommand #Region "InsertCommand" - ''' - ''' Returns a command that do Insert. - ''' - Public ReadOnly Property InsertCommand As ICommand - Get - If m_cmdInsert Is Nothing Then - m_cmdInsert = New RelayCommand(AddressOf Insert) - End If - Return m_cmdInsert - End Get - End Property + ''' + ''' Returns a command that do Insert. + ''' + Public ReadOnly Property InsertCommand As ICommand + Get + If m_cmdInsert Is Nothing Then + m_cmdInsert = New RelayCommand(AddressOf Insert) + End If + Return m_cmdInsert + End Get + End Property - ''' - ''' Execute the Insert. This method is invoked by the InsertCommand. - ''' - Public Sub Insert(ByVal param As Object) - Application.Msn.NotifyColleagues(Application.INSERTPROJECT) - End Sub + ''' + ''' Execute the Insert. This method is invoked by the InsertCommand. + ''' + Public Sub Insert(ByVal param As Object) + Application.Msn.NotifyColleagues(Application.INSERTPROJECT) + End Sub #End Region ' InsertCommand #Region "ImportCommand" - ''' - ''' Returns a command that do Import. - ''' - Public ReadOnly Property ImportCommand As ICommand - Get - If m_cmdImport Is Nothing Then - m_cmdImport = New RelayCommand(AddressOf Import) - End If - Return m_cmdImport - End Get - End Property + ''' + ''' Returns a command that do Import. + ''' + Public ReadOnly Property ImportCommand As ICommand + Get + If m_cmdImport Is Nothing Then + m_cmdImport = New RelayCommand(AddressOf Import) + End If + Return m_cmdImport + End Get + End Property - ''' - ''' Execute the Import. This method is invoked by the ImportCommand. - ''' - Public Sub Import(ByVal param As Object) - Application.Msn.NotifyColleagues(Application.IMPORTPROJECT) - End Sub + ''' + ''' Execute the Import. This method is invoked by the ImportCommand. + ''' + Public Sub Import(ByVal param As Object) + Application.Msn.NotifyColleagues(Application.IMPORTPROJECT) + End Sub #End Region ' ImportCommand #Region "ExportCommand" - ''' - ''' Returns a command that do Export. - ''' - Public ReadOnly Property ExportCommand As ICommand - Get - If m_cmdExport Is Nothing Then - m_cmdExport = New RelayCommand(AddressOf Export) - End If - Return m_cmdExport - End Get - End Property + ''' + ''' Returns a command that do Export. + ''' + Public ReadOnly Property ExportCommand As ICommand + Get + If m_cmdExport Is Nothing Then + m_cmdExport = New RelayCommand(AddressOf Export) + End If + Return m_cmdExport + End Get + End Property - ''' - ''' Execute the Export. This method is invoked by the ExportCommand. - ''' - Public Sub Export(ByVal param As Object) - Application.Msn.NotifyColleagues(Application.EXPORTPROJECT) - End Sub + ''' + ''' Execute the Export. This method is invoked by the ExportCommand. + ''' + Public Sub Export(ByVal param As Object) + Application.Msn.NotifyColleagues(Application.EXPORTPROJECT) + End Sub #End Region ' ExportCommand #Region "OptionsCommand" - ''' - ''' Returns a command that do Export. - ''' - Public ReadOnly Property OptionsCommand As ICommand - Get - If m_cmdOptions Is Nothing Then - m_cmdOptions = New RelayCommand(AddressOf Options) - End If - Return m_cmdOptions - End Get - End Property + ''' + ''' Returns a command that do Export. + ''' + Public ReadOnly Property OptionsCommand As ICommand + Get + If m_cmdOptions Is Nothing Then + m_cmdOptions = New RelayCommand(AddressOf Options) + End If + Return m_cmdOptions + End Get + End Property - ''' - ''' Execute the Export. This method is invoked by the ExportCommand. - ''' - Public Sub Options(ByVal param As Object) - Dim OptionsWindow As New OptionWindowV - OptionsWindow.Height = 614 - OptionsWindow.Width = 1024 - OptionsWindow.DataContext = New OptionWindowVM - OptionsWindow.Owner = Application.Current.MainWindow - OptionsWindow.ShowDialog() - End Sub + ''' + ''' Execute the Export. This method is invoked by the ExportCommand. + ''' + Public Sub Options(ByVal param As Object) + Dim OptionsWindow As New OptionWindowV + OptionsWindow.Height = 614 + OptionsWindow.Width = 1024 + OptionsWindow.DataContext = New OptionWindowVM + OptionsWindow.Owner = Application.Current.MainWindow + OptionsWindow.ShowDialog() + End Sub #End Region ' OptionsCommand #Region "SendFeedbackCommand" - ''' - ''' Returns a command that do SendFeedback. - ''' - Public ReadOnly Property SendFeedbackCommand As ICommand - Get - If m_cmdSendFeedback Is Nothing Then - m_cmdSendFeedback = New RelayCommand(AddressOf SendFeedback) - End If - Return m_cmdSendFeedback - End Get - End Property - - ''' - ''' Execute the SendFeedback. This method is invoked by the SendFeedbackCommand. - ''' - Public Sub SendFeedback(ByVal param As Object) - ' Recupero indirizzo a cui spedire la mail - Dim sSupportAddress As String = String.Empty - GetPrivateProfileString(S_GENERAL, K_SUPPORT, "support@egaltech.com", sSupportAddress) - ' se vuoto do messaggio di errore ed esco - If String.IsNullOrWhiteSpace(sSupportAddress) Then - MessageBox.Show(EgtMsg(MSG_TOPCOMMANDBAR + 10), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error) - Return + ''' + ''' Returns a command that do SendFeedback. + ''' + Public ReadOnly Property SendFeedbackCommand As ICommand + Get + If m_cmdSendFeedback Is Nothing Then + m_cmdSendFeedback = New RelayCommand(AddressOf SendFeedback) + End If + Return m_cmdSendFeedback + End Get + End Property + + ''' + ''' Execute the SendFeedback. This method is invoked by the SendFeedbackCommand. + ''' + Public Sub SendFeedback(ByVal param As Object) + ' Recupero indirizzo a cui spedire la mail + Dim sSupportAddress As String = String.Empty + GetPrivateProfileString(S_GENERAL, K_SUPPORT, "support@egaltech.com", sSupportAddress) + ' se vuoto do messaggio di errore ed esco + If String.IsNullOrWhiteSpace(sSupportAddress) Then + MessageBox.Show(EgtMsg(MSG_TOPCOMMANDBAR + 10), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error) + Return + End If + ' Recupero numero chiave + Dim sKey As String = String.Empty + EgtGetKeyInfo(sKey) + ' Recupero file del progetto corrente + Dim sCurrProject As String = String.Empty + EgtGetCurrFilePath(sCurrProject) + ' se nome file vuoto, chiedo se si vuole salvare + If String.IsNullOrWhiteSpace(sCurrProject) Then + If MessageBox.Show(EgtMsg(MSG_TOPCOMMANDBAR + 11), "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then + Application.Msn.NotifyColleagues(Application.SAVEPROJECT) End If - ' Recupero numero chiave - Dim sKey As String = String.Empty - EgtGetKeyInfo(sKey) - ' Recupero file del progetto corrente - Dim sCurrProject As String = String.Empty EgtGetCurrFilePath(sCurrProject) - ' se nome file vuoto, chiedo se si vuole salvare - If String.IsNullOrWhiteSpace(sCurrProject) Then + ' se modificato, chiedo se si vuole salvare + Else + If EgtGetModified() Then If MessageBox.Show(EgtMsg(MSG_TOPCOMMANDBAR + 11), "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then Application.Msn.NotifyColleagues(Application.SAVEPROJECT) End If - EgtGetCurrFilePath(sCurrProject) - ' se modificato, chiedo se si vuole salvare - Else - If EgtGetModified() Then - If MessageBox.Show(EgtMsg(MSG_TOPCOMMANDBAR + 11), "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then - Application.Msn.NotifyColleagues(Application.SAVEPROJECT) + End If + End If + ' Verifico se il progetto corrente è una porta + Dim nPartId As Integer = EgtGetFirstPart() + If nPartId = GDB_ID.NULL Then + nPartId = EgtGetFirstPartInRawPart(EgtGetFirstRawPart()) + End If + Dim sPartName As String = String.Empty + EgtGetName(nPartId, sPartName) + Dim bPrjIsDoor As Boolean = (String.Compare(sPartName, "DOOR") = 0) + ' Recupero macchine dei gruppi di lavoro del progetto + Dim Machines As New List(Of String) + Dim nMchGrpId As Integer = EgtGetFirstMachGroup() + While nMchGrpId <> GDB_ID.NULL + Dim sMachineName As String = String.Empty + EgtGetMachGroupMachineName(nMchGrpId, sMachineName) + If Not String.IsNullOrWhiteSpace(sMachineName) Then + Machines.Add(sMachineName) + End If + nMchGrpId = EgtGetNextMachGroup(nMchGrpId) + End While + ' Recupero altri file con lo stesso nome del progetto + Dim OtherFiles As New List(Of String) + If Not String.IsNullOrWhiteSpace(sCurrProject) Then + Dim sCurrProjectDir As String = Path.GetDirectoryName(sCurrProject) + If Not String.IsNullOrWhiteSpace(sCurrProjectDir) Then + Dim TempFiles() As String = Directory.GetFiles(sCurrProjectDir) + For FileIndex = 0 To TempFiles.Count - 1 + If Path.GetFileNameWithoutExtension(TempFiles(FileIndex)).Contains(Path.GetFileNameWithoutExtension(sCurrProject)) AndAlso TempFiles(FileIndex) <> sCurrProject Then + OtherFiles.Add(TempFiles(FileIndex)) End If - End If + Next End If - ' Verifico se il progetto corrente è una porta - Dim nPartId As Integer = EgtGetFirstPart() - If nPartId = GDB_ID.NULL Then - nPartId = EgtGetFirstPartInRawPart(EgtGetFirstRawPart()) - End If - Dim sPartName As String = String.Empty - EgtGetName(nPartId, sPartName) - Dim bPrjIsDoor As Boolean = (String.Compare(sPartName, "DOOR") = 0) - ' Recupero macchine dei gruppi di lavoro del progetto - Dim Machines As New List(Of String) - Dim nMchGrpId As Integer = EgtGetFirstMachGroup() - While nMchGrpId <> GDB_ID.NULL - Dim sMachineName As String = String.Empty - EgtGetMachGroupMachineName(nMchGrpId, sMachineName) - If Not String.IsNullOrWhiteSpace(sMachineName) Then - Machines.Add(sMachineName) - End If - nMchGrpId = EgtGetNextMachGroup(nMchGrpId) - End While - ' Recupero altri file con lo stesso nome del progetto - Dim OtherFiles As New List(Of String) - If Not String.IsNullOrWhiteSpace(sCurrProject) Then - Dim sCurrProjectDir As String = Path.GetDirectoryName(sCurrProject) - If Not String.IsNullOrWhiteSpace(sCurrProjectDir) Then - Dim TempFiles() As String = Directory.GetFiles(sCurrProjectDir) - For FileIndex = 0 To TempFiles.Count - 1 - If Path.GetFileNameWithoutExtension(TempFiles(FileIndex)).Contains(Path.GetFileNameWithoutExtension(sCurrProject)) AndAlso TempFiles(FileIndex) <> sCurrProject Then - OtherFiles.Add(TempFiles(FileIndex)) - End If - Next - End If - End If - ' Creo zip file da allegare - Dim sZipToCreate As String = IniFile.m_sTempDir & "\Feedback.zip" - If File.Exists(sZipToCreate) Then - File.Delete(sZipToCreate) - End If - Try - Using zip As New Ionic.Zip.ZipFile(sZipToCreate, Console.Out) - ' aggiungo file macchine - For Each sMachineName As String In Machines - Dim sMachineDir As String = IniFile.m_sMachinesRoot & "\" & sMachineName - If Directory.Exists(sMachineDir) Then - zip.AddItem(sMachineDir, sMachineName) - End If - Next - ' aggiungo progetto corrente - If File.Exists(sCurrProject) Then - zip.AddItem(sCurrProject, "") + End If + ' Creo zip file da allegare + Dim sZipToCreate As String = IniFile.m_sTempDir & "\Feedback.zip" + If File.Exists(sZipToCreate) Then + File.Delete(sZipToCreate) + End If + Try + Using zip As New Ionic.Zip.ZipFile(sZipToCreate, Console.Out) + ' aggiungo file macchine + For Each sMachineName As String In Machines + Dim sMachineDir As String = IniFile.m_sMachinesRoot & "\" & sMachineName + If Directory.Exists(sMachineDir) Then + zip.AddItem(sMachineDir, sMachineName) End If - ' aggiungo file log - If File.Exists(IniFile.m_sLogFile) Then - zip.AddItem(IniFile.m_sLogFile, "") - End If - ' aggiungo file ausiliari - For Each sOther As String In OtherFiles - zip.AddItem(sOther, "") - Next - ' se door attivo, progetto corrente è una porta e definito direttorio base di Doors - If IniFile.IsActiveDoors And bPrjIsDoor And Directory.Exists(IniFile.m_sDoorsDirPath) Then - ' aggiungo Doors completo - zip.AddItem(IniFile.m_sDoorsDirPath, "Doors") - End If - ' salvo lo zip - zip.Save() - End Using - Catch ex1 As Exception - EgtOutLog("Exception in zip: " & ex1.ToString()) - End Try - ' preparo la mail per il supporto - Dim bEx As Boolean = False - Try - Dim SendFeedbackWindow As New EgtWPFLib5.MapiMailMessage("EgtCAM5 Feedback - " & sKey) - SendFeedbackWindow.Recipients.Add(sSupportAddress) - If Not String.IsNullOrWhiteSpace(sZipToCreate) AndAlso File.Exists(sZipToCreate) Then - SendFeedbackWindow.Files.Add(IniFile.m_sTempDir & "\Feedback.zip") + Next + ' aggiungo progetto corrente + If File.Exists(sCurrProject) Then + zip.AddItem(sCurrProject, "") End If - SendFeedbackWindow.ShowDialog() - Catch ex As Exception - EgtOutLog("Feedback exception: " & ex.ToString) - bEx = True - End Try - If bEx OrElse EgtWPFLib5.MapiMailMessage.m_ErrorCode <> 0 Then - MessageBox.Show(String.Format(EgtMsg(MSG_TOPCOMMANDBAR + 12), sSupportAddress, sZipToCreate), EgtMsg(MSG_MESSAGEBOX + 3), MessageBoxButton.OK, MessageBoxImage.Information) - Else - Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, EgtMsg(MSG_TOPCOMMANDBAR + 14)) + ' aggiungo file log + If File.Exists(IniFile.m_sLogFile) Then + zip.AddItem(IniFile.m_sLogFile, "") + End If + ' aggiungo file ausiliari + For Each sOther As String In OtherFiles + zip.AddItem(sOther, "") + Next + ' se door attivo, progetto corrente è una porta e definito direttorio base di Doors + If IniFile.IsActiveDoors And bPrjIsDoor And Directory.Exists(IniFile.m_sDoorsDirPath) Then + ' aggiungo Doors completo + zip.AddItem(IniFile.m_sDoorsDirPath, "Doors") + End If + ' salvo lo zip + zip.Save() + End Using + Catch ex1 As Exception + EgtOutLog("Exception in zip: " & ex1.ToString()) + End Try + ' preparo la mail per il supporto + Dim bEx As Boolean = False + Try + Dim SendFeedbackWindow As New EgtWPFLib5.MapiMailMessage("EgtCAM5 Feedback - " & sKey) + SendFeedbackWindow.Recipients.Add(sSupportAddress) + If Not String.IsNullOrWhiteSpace(sZipToCreate) AndAlso File.Exists(sZipToCreate) Then + SendFeedbackWindow.Files.Add(IniFile.m_sTempDir & "\Feedback.zip") End If - End Sub + SendFeedbackWindow.ShowDialog() + Catch ex As Exception + EgtOutLog("Feedback exception: " & ex.ToString) + bEx = True + End Try + If bEx OrElse EgtWPFLib5.MapiMailMessage.m_ErrorCode <> 0 Then + MessageBox.Show(String.Format(EgtMsg(MSG_TOPCOMMANDBAR + 12), sSupportAddress, sZipToCreate), EgtMsg(MSG_MESSAGEBOX + 3), MessageBoxButton.OK, MessageBoxImage.Information) + Else + Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, EgtMsg(MSG_TOPCOMMANDBAR + 14)) + End If + End Sub #End Region ' SendFeedbackCommand #End Region ' Commands - End Class - -End Namespace \ No newline at end of file +End Class \ No newline at end of file diff --git a/Utility/Dictionary.xaml b/Utility/Dictionary.xaml index 183ebdd..bb311b6 100644 --- a/Utility/Dictionary.xaml +++ b/Utility/Dictionary.xaml @@ -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"> @@ -13,7 +12,7 @@ This template applies a ProjectView to an instance of the ProjectViewModel class shown in the main window. --> - + @@ -21,28 +20,28 @@ Assign a Key to every Panel ViewModel to use it in xaml file(ProjectView.xaml). --> - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + @@ -786,22 +785,22 @@ --> diff --git a/Utility/Map.vb b/Utility/Map.vb index e22662d..98856f8 100644 --- a/Utility/Map.vb +++ b/Utility/Map.vb @@ -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 diff --git a/ViewPanel/ViewPanelVM.vb b/ViewPanel/ViewPanelVM.vb index 9a4b41b..8ff91a6 100644 --- a/ViewPanel/ViewPanelVM.vb +++ b/ViewPanel/ViewPanelVM.vb @@ -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" - ''' - ''' Returns a command that do ZoomAll. - ''' - 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 + ''' + ''' Returns a command that do ZoomAll. + ''' + 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 - ''' - ''' Execute the ZoomAll. This method is invoked by the ZoomAllCommand. - ''' - Public Sub ZoomAll(ByVal param As Object) - Map.refProjectVM.GetScene.ZoomAll() - End Sub + ''' + ''' Execute the ZoomAll. This method is invoked by the ZoomAllCommand. + ''' + Public Sub ZoomAll(ByVal param As Object) + Map.refProjectVM.GetScene.ZoomAll() + End Sub #End Region ' ZoomAllCommand #Region "TopViewCommand" - ''' - ''' Returns a command that do TopView. - ''' - 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 + ''' + ''' Returns a command that do TopView. + ''' + 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 - ''' - ''' Execute the TopView. This method is invoked by the TopViewCommand. - ''' - Public Sub TopView(ByVal param As Object) - Map.refProjectVM.GetScene.TopView() - End Sub + ''' + ''' Execute the TopView. This method is invoked by the TopViewCommand. + ''' + Public Sub TopView(ByVal param As Object) + Map.refProjectVM.GetScene.TopView() + End Sub #End Region ' TopViewCommand #Region "FrontViewCommand" - ''' - ''' Returns a command that do FrontView. - ''' - 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 + ''' + ''' Returns a command that do FrontView. + ''' + 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 - ''' - ''' Execute the FrontView. This method is invoked by the FrontViewCommand. - ''' - Public Sub FrontView(ByVal param As Object) - Map.refProjectVM.GetScene.FrontView() - End Sub + ''' + ''' Execute the FrontView. This method is invoked by the FrontViewCommand. + ''' + Public Sub FrontView(ByVal param As Object) + Map.refProjectVM.GetScene.FrontView() + End Sub #End Region ' FrontViewCommand #Region "LeftViewCommand" - ''' - ''' Returns a command that do LeftView. - ''' - 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 + ''' + ''' Returns a command that do LeftView. + ''' + 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 - ''' - ''' Execute the LeftView. This method is invoked by the LeftViewCommand. - ''' - Public Sub LeftView(ByVal param As Object) - Map.refProjectVM.GetScene.LeftView() - End Sub + ''' + ''' Execute the LeftView. This method is invoked by the LeftViewCommand. + ''' + Public Sub LeftView(ByVal param As Object) + Map.refProjectVM.GetScene.LeftView() + End Sub #End Region ' LeftViewCommand #Region "BackViewCommand" - ''' - ''' Returns a command that do BackView. - ''' - 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 + ''' + ''' Returns a command that do BackView. + ''' + 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 - ''' - ''' Execute the BackView. This method is invoked by the BackViewCommand. - ''' - Public Sub BackView(ByVal param As Object) - Map.refProjectVM.GetScene.BackView() - End Sub + ''' + ''' Execute the BackView. This method is invoked by the BackViewCommand. + ''' + Public Sub BackView(ByVal param As Object) + Map.refProjectVM.GetScene.BackView() + End Sub #End Region ' BackViewCommand #Region "RightViewCommand" - ''' - ''' Returns a command that do RightView. - ''' - 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 + ''' + ''' Returns a command that do RightView. + ''' + 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 - ''' - ''' Execute the RightView. This method is invoked by the RightViewCommand. - ''' - Public Sub RightView(ByVal param As Object) - Map.refProjectVM.GetScene.RightView() - End Sub + ''' + ''' Execute the RightView. This method is invoked by the RightViewCommand. + ''' + Public Sub RightView(ByVal param As Object) + Map.refProjectVM.GetScene.RightView() + End Sub #End Region ' RightViewCommand #Region "IsoViewSWCommand" - ''' - ''' Returns a command that do IsoViewSW. - ''' - 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 + ''' + ''' Returns a command that do IsoViewSW. + ''' + 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 - ''' - ''' Execute the IsoViewSW. This method is invoked by the IsoViewSWCommand. - ''' - Public Sub IsoViewSW(ByVal param As Object) - Map.refProjectVM.GetScene.IsoViewSW() - End Sub + ''' + ''' Execute the IsoViewSW. This method is invoked by the IsoViewSWCommand. + ''' + Public Sub IsoViewSW(ByVal param As Object) + Map.refProjectVM.GetScene.IsoViewSW() + End Sub #End Region ' IsoViewSWCommand #End Region ' COMMANDS - End Class - -End Namespace \ No newline at end of file +End Class \ No newline at end of file