diff --git a/EgtCAM5.vbproj b/EgtCAM5.vbproj
index 10796fd..321c8ed 100644
--- a/EgtCAM5.vbproj
+++ b/EgtCAM5.vbproj
@@ -155,6 +155,11 @@
CurrSetUpV.xaml
+
+
+ EstimationsExpanderV.xaml
+
+ StoneMillingParameterExpanderV.xaml
@@ -194,6 +199,22 @@
StoneSawingParameterExpanderV.xaml
+
+ DrawOptionPanelV.xaml
+
+
+
+ MachiningOptionPanelV.xaml
+
+
+
+ OperationParametersExpanderV.xaml
+
+
+
+ OperationsListExpanderV.xaml
+
+ MachineBox.xaml
@@ -239,6 +260,10 @@
SpecialPanelV.xaml
+
+ StatusBarV.xaml
+
+
@@ -264,7 +289,7 @@
MachinePanelV.xaml
-
+ DoorPanelV.xaml
@@ -291,10 +316,6 @@
Code
-
- MachGroupPanelV.xaml
-
- MachiningTreeExpanderV.xaml
@@ -355,14 +376,10 @@
-
- OperationExpanderV.xaml
+
+ SimulationExpanderV.xaml
-
-
- SimulationExpanderView.xaml
-
-
+ ProjectV.xaml
@@ -378,10 +395,6 @@
GunStockWndV.xaml
-
- StatusBarV.xaml
-
-
@@ -413,6 +426,10 @@
DesignerMSBuild:Compile
+
+ MSBuild:Compile
+ Designer
+ MSBuild:CompileDesigner
@@ -465,6 +482,22 @@
MSBuild:CompileDesigner
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ XamlIntelliSenseFileGenerator
+
+
+ Designer
+ XamlIntelliSenseFileGenerator
+ MSBuild:CompileDesigner
@@ -529,6 +562,10 @@
DesignerMSBuild:Compile
+
+ Designer
+ XamlIntelliSenseFileGenerator
+ MSBuild:CompileDesigner
@@ -549,10 +586,6 @@
DesignerMSBuild:Compile
-
- Designer
- MSBuild:Compile
- DesignerMSBuild:Compile
@@ -605,11 +638,7 @@
MSBuild:CompileDesigner
-
- Designer
- MSBuild:Compile
-
-
+ DesignerMSBuild:Compile
@@ -625,10 +654,6 @@
DesignerMSBuild:Compile
-
- Designer
- MSBuild:Compile
- DesignerMSBuild:Compile
diff --git a/InstrumentPanel/InstrumentPanelVM.vb b/InstrumentPanel/InstrumentPanelVM.vb
index 4b3e185..087801a 100644
--- a/InstrumentPanel/InstrumentPanelVM.vb
+++ b/InstrumentPanel/InstrumentPanelVM.vb
@@ -80,6 +80,7 @@ Public Class InstrumentPanelVM
#Region "CONSTRUCTOR"
Sub New()
+ Map.SetRefInstrumentPanelVM(Me)
Application.Msn.Register(Application.MACHININGMODE_ISCHECKED, Sub()
AnalyzeIsChecked = False
AnalyzeIsEnabled = False
diff --git a/MachGroupPanel/MachGroupPanelVM.vb b/MachGroupPanel/MyMachGroupPanelVM.vb
similarity index 74%
rename from MachGroupPanel/MachGroupPanelVM.vb
rename to MachGroupPanel/MyMachGroupPanelVM.vb
index dd96343..ec676f4 100644
--- a/MachGroupPanel/MachGroupPanelVM.vb
+++ b/MachGroupPanel/MyMachGroupPanelVM.vb
@@ -3,81 +3,34 @@ Imports System.IO
Imports EgtUILib
Imports EgtWPFLib5
-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_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
-
- ' Definizione comandi
- Private m_cmdSetCurrMachGroup As ICommand
- Private m_cmdAddMachGroup As ICommand
- Private m_cmdRemoveMachGroup As ICommand
-
-#End Region ' FIELDS & PROPERTIES
+Public Class MyMachGroupPanelVM
+ Inherits EgtWPFLib5.MachGroupPanelVM
#Region "CONSTRUCTOR"
Sub New()
- Application.Msn.Register(Application.INITIALIZEMACHGROUPS, Sub(bAllowEmpty As Boolean)
- InitializeMachGroups(bAllowEmpty)
- End Sub)
- Application.Msn.Register(Application.MACHGROUPSISENABLED, Sub(MgpIsEnabled As Boolean)
- Me.MachGroupPanelIsEnabled = MgpIsEnabled
- End Sub)
+ MyBase.New()
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
- Private Sub InitializeMachGroups(bAllowEmpty As Boolean)
+ Public Overloads Sub InitMachGroupList(bAllowEmpty As Boolean)
Dim nGroupId As Integer = GDB_ID.NULL
Dim nErr As Integer = ManageDisposition(nGroupId, bAllowEmpty)
If nErr = 0 Then
- LoadMachGroups()
+ LoadMachGroupList()
Dim MachGroupName As String = ""
EgtGetMachGroupName(nGroupId, MachGroupName)
- SelectedMachGroup = MachGroupList(MachGroupList.IndexOf(MachGroupName))
+ SelectedMachGroup = MachGroupList.First(Function(x) x.Name = MachGroupName)
If IniFile.m_bShowOnlyTable Then EgtShowOnlyTable(True)
End If
Application.Msn.NotifyColleagues(Application.MACHGROUPSRESULT, nErr)
' Setto il Materiale in base alla Macchina associata al MachGroup selezionato
LoadMaterialType()
If nErr <> 0 Then EgtDraw()
+ Map.refMachGroupPanelVM.SetMachGroupState(True)
End Sub
Private Function ManageDisposition(ByRef nGroupId As Integer, bAllowEmpty As Boolean) As Integer
@@ -137,7 +90,7 @@ Public Class MachGroupPanelVM
End Select
Return If(bOk, 0, 1)
End If
- ' altrimenti creo il primo gruppo
+ ' altrimenti creo il primo gruppo
Else
' Vuoi creare un nuovo Gruppo di Lavoro con i pezzi selezionati ? - LAVORA
If MessageBox.Show(EgtMsg(5552), EgtMsg(5002), MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then
@@ -146,16 +99,16 @@ Public Class MachGroupPanelVM
Return -2
End If
End If
- ' Se non ci sono pezzi selezionati
+ ' Se non ci sono pezzi selezionati
Else
' se ci sono gruppi di lavorazione
If bMachGroup Then
nGroupId = EgtGetLastMachGroup()
Return If(EgtSetCurrMachGroup(nGroupId), 0, 1)
- ' se altrimenti ammessi gruppi di lavoro vuoti
+ ' se altrimenti ammessi gruppi di lavoro vuoti
ElseIf bAllowEmpty Then
Return If(AddNewMachGroup(nGroupId, vPart), 0, 1)
- ' altrimenti esco
+ ' altrimenti esco
Else
Return -1
End If
@@ -296,15 +249,17 @@ Public Class MachGroupPanelVM
End While
End Sub
- Private Sub LoadMachGroups()
+ Public Overrides Sub LoadMachGroupList()
' 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
+ Dim sMachine As String = String.Empty
EgtGetMachGroupName(nId, sName)
- MachGroupList.Add(sName)
+ EgtGetMachGroupMachineName(nId, sMachine)
+ MachGroupList.Add(New MachGroup(nId, sName, sMachine))
nId = EgtGetNextMachGroup(nId)
End While
End Sub
@@ -344,51 +299,7 @@ Public Class MachGroupPanelVM
#End Region
-#Region "COMMANDS"
-
-#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
-
- 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, GDB_ID.NULL)
- Application.Msn.NotifyColleagues(Application.UPDATECURRENTMACHINE)
- Map.refSimulationExpanderVM.Estimation_IsEnabled =
- (EgtUILib.GetPrivateProfileInt(S_ESTIMATIONS, K_EST_ENABLE, 0, IniFile.m_sCurrMachIniFilePath) <> 0)
- ' Setto il Materiale in base alla Macchina associata al MachGroup corrente
- LoadMaterialType()
- 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()
+ Public Overrides Sub AddMachGroup()
'If AddNewMachGroup() Then
' Dim sMachName As String = String.Empty
' EgtGetMachGroupName(EgtGetCurrMachGroup(), sMachName)
@@ -400,23 +311,7 @@ Public Class MachGroupPanelVM
'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()
+ Public Overrides Sub RemoveMachGroup()
' Calcolo indice del gruppo da cancellare
Dim nSelectedMachGroupIndex As Integer = MachGroupList.IndexOf(SelectedMachGroup)
If nSelectedMachGroupIndex = 0 And MachGroupList.Count = 1 Then
@@ -424,7 +319,7 @@ Public Class MachGroupPanelVM
Select Case MessageBox.Show(EgtMsg(MSG_MACHGROUP + 2), "", MessageBoxButton.YesNo, MessageBoxImage.Question)
Case MessageBoxResult.Yes
' cancello il gruppo corrente
- EgtRemoveMachGroup(EgtGetMachGroupId(MachGroupList(nSelectedMachGroupIndex)))
+ EgtRemoveMachGroup(EgtGetMachGroupId(MachGroupList(nSelectedMachGroupIndex).Name))
' aggiorno la lista dei gruppi
MachGroupList.RemoveAt(nSelectedMachGroupIndex)
' ritorno alla modalità disegno
@@ -443,15 +338,15 @@ Public Class MachGroupPanelVM
nNewInd = nSelectedMachGroupIndex - 1
End If
If nNewInd >= 0 Then
- EgtSetCurrMachGroup(EgtGetMachGroupId(MachGroupList(nNewInd)))
+ EgtSetCurrMachGroup(EgtGetMachGroupId(MachGroupList(nNewInd).Id.ToString()))
SelectedMachGroup = MachGroupList(nNewInd)
If IniFile.m_bShowOnlyTable Then EgtShowOnlyTable(True)
EgtZoom(ZM.ALL)
- Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, GDB_ID.NULL)
+ Map.refOperationsListExpanderVM.LoadOperationList(GDB_ID.NULL)
Application.Msn.NotifyColleagues(Application.UPDATECURRENTMACHINE)
End If
' cancello quello selezionato
- EgtRemoveMachGroup(EgtGetMachGroupId(MachGroupList(nSelectedMachGroupIndex)))
+ EgtRemoveMachGroup(EgtGetMachGroupId(MachGroupList(nSelectedMachGroupIndex).Name))
' aggiorno la lista dei gruppi
MachGroupList.RemoveAt(nSelectedMachGroupIndex)
Case MessageBoxResult.No
@@ -461,8 +356,21 @@ Public Class MachGroupPanelVM
End Sub
-#End Region ' RemoveMachGroupCommand
+ Public Overrides Function OnPostSetCurrMachGroup() As Boolean
+ ' Se gli Expander sono Nothing vuol dire che siamo appena entrati in Machining Mode e quindi non eseguo il codice seguente
+ If Not IsNothing(Map.refOperationsListExpanderVM) Or Not IsNothing(Map.refEstimationsExpanderVM) Then
+ If IniFile.m_bShowOnlyTable Then EgtShowOnlyTable(True)
-#End Region ' COMMANDS
+ Map.refOperationsListExpanderVM.LoadOperationList(GDB_ID.NULL)
+ Application.Msn.NotifyColleagues(Application.UPDATECURRENTMACHINE)
+ Application.Msn.NotifyColleagues(Application.UPDATEOPERATIONMACHININGLIST)
+ Map.refEstimationsExpanderVM.Estimation_IsEnabled =
+ (EgtUILib.GetPrivateProfileInt(S_ESTIMATIONS, K_EST_ENABLE, 0, IniFile.m_sCurrMachIniFilePath) <> 0)
+ ' Setto il Materiale in base alla Macchina associata al MachGroup corrente
+ LoadMaterialType()
+ End If
+
+ Return True
+ End Function
End Class
\ No newline at end of file
diff --git a/MachinePanel/MachinePanelV.xaml b/MachinePanel/MachinePanelV.xaml
index 766467f..c23306e 100644
--- a/MachinePanel/MachinePanelV.xaml
+++ b/MachinePanel/MachinePanelV.xaml
@@ -3,7 +3,11 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-
+
+
diff --git a/MachinePanel/MachinePanelVM.vb b/MachinePanel/MachinePanelVM.vb
deleted file mode 100644
index 0e2092a..0000000
--- a/MachinePanel/MachinePanelVM.vb
+++ /dev/null
@@ -1,283 +0,0 @@
-Imports System.IO
-Imports EgtUILib
-
-Public Class MachinePanelVM
- Inherits VMBase
-
-#Region "FIELDS & PROPERTIES"
-
- ' Definizione comandi
- Private m_cmdToolDb As ICommand
- Private m_cmdMachDb As ICommand
- Private m_cmdSetUpDb As ICommand
- Private m_cmdMachOptions As ICommand
-
- Private m_ToolDb_IsEnabled As Boolean = True
- Public ReadOnly Property ToolDb_IsEnabled As Boolean
- Get
- Return m_ToolDb_IsEnabled
- End Get
- End Property
-
- Private m_MachDb_IsEnabled As Boolean = True
- Public ReadOnly Property MachDb_IsEnabled As Boolean
- Get
- Return m_MachDb_IsEnabled
- End Get
- End Property
-
- Private m_SetUpDb_IsEnabled As Boolean = True
- Public ReadOnly Property SetUpDb_IsEnabled As Boolean
- Get
- Return m_SetUpDb_IsEnabled
- End Get
- End Property
-
-#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 SetUpDbMsg As String
- Get
- Return EgtMsg(MSG_MAINWINDOW + 9)
- 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 SetUpDbToolTip As String
- Get
- Return EgtMsg(MSG_MAINWINDOW + 10)
- End Get
- End Property
- Public ReadOnly Property MachOptionsToolTip As String
- Get
- Return EgtMsg(MSG_MAINWINDOW + 8)
- End Get
- End Property
-
-#End Region ' ToolTip
-
-#End Region 'FIELDS & PROPERTIES
-
-#Region "CONSTRUCTOR"
-
- Sub New()
- ' Creo riferimento a questa classe in Map
- Map.SetRefMachinePanelVM(Me)
- End Sub
-
-#End Region ' Constructor
-
-#Region "METHODS"
-
- Friend Sub ToolMachSetUpIsEnabled(ToolDb_IsEnabled As Boolean, MachDb_IsEnabled As Boolean, SetUpDb_IsEnabled As Boolean)
- m_ToolDb_IsEnabled = ToolDb_IsEnabled
- m_MachDb_IsEnabled = MachDb_IsEnabled
- m_SetUpDb_IsEnabled = SetUpDb_IsEnabled
- NotifyPropertyChanged("ToolDb_IsEnabled")
- NotifyPropertyChanged("MachDb_IsEnabled")
- NotifyPropertyChanged("SetUpDb_IsEnabled")
- End Sub
-#End Region ' Methods
-
-#Region "COMMANDS"
-
-#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 Shared Sub ToolDb()
- 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()
-
- Dim sMachineDir As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName
- Dim ToolDbWindowVM As New MyToolDbWindowVM(sMachineDir, IniFile.m_sCurrMachIniFilePath, IniFile.m_ProjectSceneContext, "Wood")
- Dim ToolDbWindowV As New EgtWPFLib5.ToolDbWindowV(Application.Current.MainWindow, ToolDbWindowVM)
- If ToolDbWindowVM.MatType <> 0 Then
- ToolDbWindowV.Height = 674
- ToolDbWindowV.Width = 1024
- ToolDbWindowV.Owner = Application.Current.MainWindow
- ToolDbWindowV.ShowDialog()
- End If
-
- 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 Shared Sub MachDb()
- 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 MachDbWindowVM As New EgtWPFLib5.MachiningDbWindowVM(IniFile.m_sCurrMachIniFilePath, IniFile.m_ProjectSceneContext, "Wood")
- Dim MachDbWindowV As New EgtWPFLib5.MachiningDbWindowV(Application.Current.MainWindow, MachDbWindowVM)
- If EgtWPFLib5.MachiningTreeViewItem.m_MatType <> 0 Then
- MachDbWindowV.Height = 784 '674
- MachDbWindowV.Width = 1024
- MachDbWindowV.Owner = Application.Current.MainWindow
- MachDbWindowV.ShowDialog()
- End If
- End Sub
-
-#End Region ' MachDbCommand
-
-#Region "SetUpDb"
-
- '''
- ''' Returns a command that do Exec.
- '''
- Public ReadOnly Property SetUpDb_Command As ICommand
- Get
- If m_cmdSetUpDb Is Nothing Then
- m_cmdSetUpDb = New RelayCommand(AddressOf SetUpDb)
- End If
- Return m_cmdSetUpDb
- End Get
- End Property
-
- '''
- ''' Execute the Exec. This method is invoked by the ExecCommand.
- '''
- Public Shared Sub SetUpDb()
- ' 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
- ' Verifico esistenza direttorio per attrezzaggi
- Dim sDir As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\SetUp"
- If Not Directory.Exists(sDir) Then
- Try
- Directory.CreateDirectory(sDir)
- Catch ex As Exception
- EgtOutLog("Error in SetupDir creation " & ex.ToString())
- Return
- End Try
- End If
- ' creo ed apro finestra SetUp
- Dim SetUpDbWindow As New SetUpDbV(Application.Current.MainWindow, New SetUpDbVM)
- SetUpDbWindow.ShowDialog()
- Application.Msn.NotifyColleagues(Application.EMITTITLE)
- End Sub
-
-#End Region ' SetUpDb
-
-#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
-
- '''
- ''' 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
\ No newline at end of file
diff --git a/MachinePanel/MyMachinePanelVM.vb b/MachinePanel/MyMachinePanelVM.vb
new file mode 100644
index 0000000..3e02e19
--- /dev/null
+++ b/MachinePanel/MyMachinePanelVM.vb
@@ -0,0 +1,464 @@
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class MyMachinePanelVM
+ Inherits MachinePanelVM
+
+#Region "FIELDS & PROPERTIES"
+
+ ' Definizione comandi
+ Private m_cmdToolDb As ICommand
+ Private m_cmdMachDb As ICommand
+ Private m_cmdSetUpDb As ICommand
+ Private m_cmdMachOptions As ICommand
+
+ Private m_ToolDb_IsEnabled As Boolean = True
+ Public ReadOnly Property ToolDb_IsEnabled As Boolean
+ Get
+ Return m_ToolDb_IsEnabled
+ End Get
+ End Property
+
+ Private m_MachDb_IsEnabled As Boolean = True
+ Public ReadOnly Property MachDb_IsEnabled As Boolean
+ Get
+ Return m_MachDb_IsEnabled
+ End Get
+ End Property
+
+ Private m_SetUpDb_IsEnabled As Boolean = True
+ Public ReadOnly Property SetUpDb_IsEnabled As Boolean
+ Get
+ Return m_SetUpDb_IsEnabled
+ End Get
+ 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 Overloads Property SelectedMachine As Machine
+ Get
+ Return m_SelectedMachine
+ End Get
+ Set(value As Machine)
+ If IsNothing(value) Then
+ m_SelectedMachine = Nothing
+ ElseIf 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()
+ NotifyPropertyChanged("SelectedMachine")
+ End If
+ 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
+ NotifyPropertyChanged("MachineListIsEnabled")
+ End Set
+ End Property
+
+#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 SetUpDbMsg As String
+ Get
+ Return EgtMsg(MSG_MAINWINDOW + 9)
+ 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 SetUpDbToolTip As String
+ Get
+ Return EgtMsg(MSG_MAINWINDOW + 10)
+ End Get
+ End Property
+ Public ReadOnly Property MachOptionsToolTip As String
+ Get
+ Return EgtMsg(MSG_MAINWINDOW + 8)
+ End Get
+ End Property
+
+#End Region ' ToolTip
+
+#End Region 'FIELDS & PROPERTIES
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ ' Creo riferimento a questa classe in Map
+ Map.SetRefMachinePanelVM(Me)
+
+ SearchMachines()
+ 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.MACHININGMODE_ISCHECKED, Sub()
+ 'OutputMessage = String.Empty
+ MachineListIsEnabled = False
+ End Sub)
+ Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub()
+ 'OutputMessage = String.Empty
+ MachineListIsEnabled = True
+ End Sub)
+ End Sub
+
+#End Region ' Constructor
+
+#Region "METHODS"
+
+ Friend Sub ToolMachSetUpIsEnabled(ToolDb_IsEnabled As Boolean, MachDb_IsEnabled As Boolean, SetUpDb_IsEnabled As Boolean)
+ m_ToolDb_IsEnabled = ToolDb_IsEnabled
+ m_MachDb_IsEnabled = MachDb_IsEnabled
+ m_SetUpDb_IsEnabled = SetUpDb_IsEnabled
+ NotifyPropertyChanged("ToolDb_IsEnabled")
+ NotifyPropertyChanged("MachDb_IsEnabled")
+ NotifyPropertyChanged("SetUpDb_IsEnabled")
+ End Sub
+#End Region ' Methods
+
+#Region "COMMANDS"
+
+#Region "ToolDbCommand"
+
+ Public Overloads Shared Sub ToolDb()
+ 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 sMachineDir As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName
+ Dim ToolDbWindowVM As New MyToolDbWindowVM(sMachineDir, IniFile.m_sCurrMachIniFilePath, IniFile.m_ProjectSceneContext, "Wood")
+ Dim ToolDbWindowV As New EgtWPFLib5.ToolDbWindowV(Application.Current.MainWindow, ToolDbWindowVM)
+ If ToolDbWindowVM.MatType <> 0 Then
+ ToolDbWindowV.Height = 674
+ ToolDbWindowV.Width = 1024
+ ToolDbWindowV.Owner = Application.Current.MainWindow
+ ToolDbWindowV.ShowDialog()
+ End If
+ End Sub
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Overrides 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()
+
+ Dim sMachineDir As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName
+ Dim ToolDbWindowVM As New MyToolDbWindowVM(sMachineDir, IniFile.m_sCurrMachIniFilePath, IniFile.m_ProjectSceneContext, "Wood")
+ Dim ToolDbWindowV As New EgtWPFLib5.ToolDbWindowV(Application.Current.MainWindow, ToolDbWindowVM)
+ If ToolDbWindowVM.MatType <> 0 Then
+ ToolDbWindowV.Height = 674
+ ToolDbWindowV.Width = 1024
+ ToolDbWindowV.Owner = Application.Current.MainWindow
+ ToolDbWindowV.ShowDialog()
+ End If
+
+ End Sub
+
+#End Region ' ToolDbCommand
+
+#Region "MachDbCommand"
+
+ Public Overloads Shared Sub MachDb()
+ 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 MachDbWindowVM As New EgtWPFLib5.MachiningDbWindowVM(IniFile.m_sCurrMachIniFilePath, IniFile.m_ProjectSceneContext, "Wood")
+ Dim MachDbWindowV As New EgtWPFLib5.MachiningDbWindowV(Application.Current.MainWindow, MachDbWindowVM)
+ If EgtWPFLib5.MachiningTreeViewItem.m_MatType <> 0 Then
+ MachDbWindowV.Height = 784 '674
+ MachDbWindowV.Width = 1024
+ MachDbWindowV.Owner = Application.Current.MainWindow
+ MachDbWindowV.ShowDialog()
+ End If
+ End Sub
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Overrides 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 MachDbWindowVM As New EgtWPFLib5.MachiningDbWindowVM(IniFile.m_sCurrMachIniFilePath, IniFile.m_ProjectSceneContext, "Wood")
+ Dim MachDbWindowV As New EgtWPFLib5.MachiningDbWindowV(Application.Current.MainWindow, MachDbWindowVM)
+ If EgtWPFLib5.MachiningTreeViewItem.m_MatType <> 0 Then
+ MachDbWindowV.Height = 784 '674
+ MachDbWindowV.Width = 1024
+ MachDbWindowV.Owner = Application.Current.MainWindow
+ MachDbWindowV.ShowDialog()
+ End If
+ End Sub
+
+#End Region ' MachDbCommand
+
+#Region "SetUpCommand"
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Overrides Sub SetUp(ByVal param As Object)
+ ' 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
+ ' Verifico esistenza direttorio per attrezzaggi
+ Dim sDir As String = IniFile.m_sMachinesRoot & "\" & IniFile.m_sMachineName & "\SetUp"
+ If Not Directory.Exists(sDir) Then
+ Try
+ Directory.CreateDirectory(sDir)
+ Catch ex As Exception
+ EgtOutLog("Error in SetupDir creation " & ex.ToString())
+ Return
+ End Try
+ End If
+ ' creo ed apro finestra SetUp
+ Dim SetUpDbWindow As New SetUpDbV(Application.Current.MainWindow, New SetUpDbVM)
+ SetUpDbWindow.ShowDialog()
+ Application.Msn.NotifyColleagues(Application.EMITTITLE)
+ End Sub
+
+#End Region ' SetUpCommand
+
+#Region "MachOptionsCommand"
+
+ '''
+ ''' Execute the Exec. This method is invoked by the ExecCommand.
+ '''
+ Public Overrides 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
+
+ '''
+ ''' Method that search the machines in the correct folder and add to the MachinesList those valid.
+ '''
+ Private Sub SearchMachines()
+ ' Svuoto la lista delle macchine
+ m_MachinesList.Clear()
+ ' 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
+ AddMachine(TempArray(i))
+ Next
+ If m_MachinesList.Count = 0 Then
+ IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW
+ EgtOutLog(EgtMsg(MSG_STATUSBAR + 1))
+ Return
+ End If
+ End Sub
+
+ Private Function AddMachine(sPath As String) As Boolean
+ ' Verifico presenza file caratteristici
+ Dim sName As String = Path.GetFileName(sPath)
+ Dim MachineIniPath As String = sPath & "\" & sName & ".ini"
+ Dim MachineMldePath As String = sPath & "\" & sName & ".mlde"
+ If Not File.Exists(MachineIniPath) Or Not File.Exists(MachineMldePath) Then Return False
+ ' Aggiungo alla lista
+ m_MachinesList.Add(New Machine With {.Name = sName, .MachineDirPath = sPath})
+ Return True
+ End Function
+
+ Friend Function InsertMachine(sPath As String) As Boolean
+ ' Verifico presenza file caratteristici
+ Dim sName As String = Path.GetFileName(sPath)
+ Dim MachineIniPath As String = sPath & "\" & sName & ".ini"
+ Dim MachineMldePath As String = sPath & "\" & sName & ".mlde"
+ If Not File.Exists(MachineIniPath) Or Not File.Exists(MachineMldePath) Then Return False
+ ' Cerco la posizione di inserimento
+ Dim nPos As Integer = 0
+ For nI As Integer = 0 To m_MachinesList.Count() - 1
+ Dim nRes As Integer = String.Compare(sName, m_MachinesList(nI).Name, True)
+ If nRes = 0 Then
+ Return True
+ ElseIf nRes < 0 Then
+ Exit For
+ Else
+ nPos += 1
+ End If
+ Next
+ ' Inserisco nella lista
+ m_MachinesList.Insert(nPos, New Machine With {.Name = sName, .MachineDirPath = sPath})
+ Return True
+ End Function
+
+ '''
+ ''' 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
+
+ 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
+
+End Class
\ No newline at end of file
diff --git a/MainWindow/MainWindowVM.vb b/MainWindow/MainWindowVM.vb
index a6230a2..9fc540a 100644
--- a/MainWindow/MainWindowVM.vb
+++ b/MainWindow/MainWindowVM.vb
@@ -66,7 +66,7 @@ Public Class MainWindowVM
If m_bfirst Then
m_bfirst = False
m_StatusBar = New StatusBarV
- m_StatusBar.DataContext = New StatusBarVM
+ m_StatusBar.DataContext = New MyStatusBarVM
End If
Return m_StatusBar
End Get
diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb
index ad184ac..15c335e 100644
--- a/My Project/AssemblyInfo.vb
+++ b/My Project/AssemblyInfo.vb
@@ -70,6 +70,6 @@ Imports System.Windows
' by using the '*' as shown below:
'
-
-
+
+
diff --git a/OptionPanel/DrawOptionPanelV.xaml b/OptionPanel/DrawOptionPanelV.xaml
new file mode 100644
index 0000000..808bf97
--- /dev/null
+++ b/OptionPanel/DrawOptionPanelV.xaml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OptionPanel/DrawOptionPanelV.xaml.vb b/OptionPanel/DrawOptionPanelV.xaml.vb
new file mode 100644
index 0000000..da226b1
--- /dev/null
+++ b/OptionPanel/DrawOptionPanelV.xaml.vb
@@ -0,0 +1,7 @@
+Public Class DrawOptionPanelV
+
+ Private Sub Me_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
+ Dim x = ciao.MaxHeight
+ End Sub
+
+End Class
diff --git a/OptionPanel/DrawOptionPanelVM.vb b/OptionPanel/DrawOptionPanelVM.vb
new file mode 100644
index 0000000..56dbea7
--- /dev/null
+++ b/OptionPanel/DrawOptionPanelVM.vb
@@ -0,0 +1,63 @@
+Imports EgtUILib
+
+Public Class DrawOptionPanelVM
+ Inherits ViewModelBase
+
+ ' GRAPHICAL ELEMENTS
+ Private m_ManageLayerExpander As ManageLayerExpanderV
+ Public ReadOnly Property ManageLayerExpander As ContentControl
+ Get
+ If IsNothing(m_ManageLayerExpander) Then
+ m_ManageLayerExpander = New ManageLayerExpanderV
+ m_ManageLayerExpander.DataContext = New ManageLayerExpanderVM
+ End If
+ Return m_ManageLayerExpander
+ End Get
+ End Property
+
+ Private m_InfoExpander As InfoExpanderV
+ Public ReadOnly Property InfoExpander As ContentControl
+ Get
+ If IsNothing(m_InfoExpander) Then
+ m_InfoExpander = New InfoExpanderV
+ m_InfoExpander.DataContext = New InfoExpanderVM
+ End If
+ Return m_InfoExpander
+ End Get
+ End Property
+
+ Private m_InputExpander As InputExpanderV
+ Public ReadOnly Property InputExpander As ContentControl
+ Get
+ If IsNothing(m_InputExpander) Then
+ m_InputExpander = New InputExpanderV
+ m_InputExpander.DataContext = New InputExpanderVM
+ End If
+ Return m_InputExpander
+ End Get
+ End Property
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ ' Creo riferimento a questa classe in Map
+ Map.SetRefDrawOptionPanelVM(Me)
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+ Friend Function InitDrawOptionPanel() As Boolean
+ 'EgtZoom(ZM.ALL)
+ Return True
+ End Function
+
+ Friend Function ExitDrawOptionPanel() As Boolean
+
+ Return True
+ End Function
+
+#End Region ' METHODS
+
+End Class
\ No newline at end of file
diff --git a/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpanderV.xaml b/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpanderV.xaml
new file mode 100644
index 0000000..79b2f56
--- /dev/null
+++ b/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpanderV.xaml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpanderV.xaml.vb b/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpanderV.xaml.vb
new file mode 100644
index 0000000..0560514
--- /dev/null
+++ b/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpanderV.xaml.vb
@@ -0,0 +1,3 @@
+Public Class EstimationsExpanderV
+
+End Class
diff --git a/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpanderVM.vb b/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpanderVM.vb
new file mode 100644
index 0000000..8fd1a22
--- /dev/null
+++ b/OptionPanel/MachiningOptionPanel/EstimationsExpander/EstimationsExpanderVM.vb
@@ -0,0 +1,300 @@
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports EgtUILib
+
+Public Class EstimationsExpanderVM
+ Inherits ViewModelBase
+
+#Region "FIELDS & PROPERTIES"
+
+ 'GRAPHICAL PROPERTIES
+
+ Private m_Estimation_IsExpanded As Boolean
+ Public Property Estimation_IsExpanded As Boolean
+ Get
+ Return m_Estimation_IsExpanded
+ End Get
+ Set(value As Boolean)
+ If value <> m_Estimation_IsExpanded Then
+ Map.refMachiningOptionPanelVM.Set_IsExpanded(MachiningOptionPanelVM.MachiningOptionPanelExpander.ESTIMATIONS, value)
+ End If
+ End Set
+ End Property
+
+ Private m_Estimation_IsEnabled As Boolean = False
+ Public Property Estimation_IsEnabled As Boolean
+ Get
+ Return m_Estimation_IsEnabled And Not Map.refSimulationExpanderVM.bSimExecuting
+ End Get
+ Set(value As Boolean)
+ m_Estimation_IsEnabled = value
+ OnPropertyChanged("Estimation_IsEnabled")
+ End Set
+ End Property
+
+ Public ReadOnly Property TotalTime As String
+ Get
+ Dim nTotalTime As Integer = 0
+ EgtGetInfo(EgtGetCurrMachGroup(), "Ttot", nTotalTime)
+ Dim sTotalTime As New TimeSpan(0, 0, nTotalTime)
+ Return sTotalTime.ToString("hh\:mm\:ss")
+ End Get
+ End Property
+
+ Public ReadOnly Property TotalLength As String
+ Get
+ Dim dTotalLength As Double = 0
+ EgtGetInfo(EgtGetCurrMachGroup(), "Ltot", dTotalLength)
+ Dim sTotalLength As String = ""
+ If EgtUiUnitsAreMM() Then
+ sTotalLength = DoubleToString(dTotalLength / 1000, 1) & " m"
+ Else
+ sTotalLength = DoubleToString(dTotalLength / (ONEINCH * 12), 1) & " ft"
+ End If
+ Return sTotalLength
+ End Get
+ End Property
+
+ ' Definizione comandi
+ Private m_cmdDetails As ICommand
+
+#Region "Messages"
+
+ Public ReadOnly Property SimulationMsg As String
+ Get
+ Return EgtMsg(MSG_SIMULATION + 7) 'Simulazione
+ End Get
+ End Property
+
+ Public ReadOnly Property EstimationMsg As String
+ Get
+ Return EgtMsg(MSG_SIMULATION + 40) 'Stime
+ End Get
+ End Property
+
+ Public ReadOnly Property TotalTimeMsg As String
+ Get
+ Return EgtMsg(MSG_SIMULATION + 41) 'Tempo totale
+ End Get
+ End Property
+
+ Public ReadOnly Property TotalLengthMsg As String
+ Get
+ Return EgtMsg(MSG_SIMULATION + 42) 'Lunghezza totale
+ End Get
+ End Property
+ Public ReadOnly Property DetailsMsg As String
+ Get
+ Return EgtMsg(MSG_SIMULATION + 43) 'Dettagli
+ 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
+
+#End Region
+
+#End Region
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ SetRefEstimationsExpanderVM(Me)
+ End Sub
+
+#End Region
+
+#Region "COMMANDS"
+
+#Region "Details"
+
+ '''
+ ''' Returns a command that create a new tool.
+ '''
+ Public ReadOnly Property Details_Command As ICommand
+ Get
+ If m_cmdDetails Is Nothing Then
+ m_cmdDetails = New RelayCommand(AddressOf Details)
+ End If
+ Return m_cmdDetails
+ End Get
+ End Property
+
+ '''
+ ''' Creata the new tool. This method is invoked by the NewCommand.
+ '''
+ Public Sub Details(ByVal param As Object)
+ ' Determino il nome del file contenente le stime
+ Dim sEstFile As String = ""
+ Dim sInfo As String = ""
+ GetEstimationFileName(False, sEstFile, sInfo)
+ ' Verifico che il file esista
+ If Not File.Exists(sEstFile) Then
+ ' File delle stime non trovato
+ MessageBox.Show(EgtMsg(MSG_SIMULATION + 18), EgtMsg(MSG_SIMULATION + 15), MessageBoxButton.OK, MessageBoxImage.Warning)
+ Return
+ End If
+ ' Visualizzazione
+ Dim EstimationsWnd As New EstimationsDetailsWndV(Application.Current.MainWindow, New EstimationsDetailsWndVM(sEstFile))
+ EstimationsWnd.ShowDialog()
+ End Sub
+
+#End Region ' Details
+
+#End Region
+
+#Region "METHODS"
+
+ Friend Function InitEstimations() As Boolean
+ EgtDeselectAll()
+ Map.refInstrumentPanelVM.GetDistIsChecked = False
+ ' Disabilito la selezione dei Percorsi di Lavorazione
+ Map.refProjectVM.SceneSelType = SceneSelTypeOpt.NULL
+ ' Abilito la selezione di tutti i tipi di geometria
+ Map.refProjectVM.SceneSelMode = SceneSelModeOpt.PARTCURVESANDSURFACES
+ CalcEstimation()
+ OnPropertyChanged("TotalTime")
+ OnPropertyChanged("TotalLength")
+
+ m_Estimation_IsExpanded = True
+ Map.refOperationParametersExpanderVM.OperParamsViewIsEnabled = False
+ Map.refOperationsListExpanderVM.EstimationExpander_Get_IsExpanded(True)
+ OnPropertyChanged("Estimation_IsExpanded")
+ Map.refMachiningOptionPanelVM.OnPropertyChanged("GenerateIsEnabled")
+ ' disattivo database utensili, lavorazioni e setup se vado in stima
+ Map.refMachinePanelVM.ToolMachSetUpIsEnabled(False, False, False)
+ Return True
+ End Function
+
+ Friend Function ExitEstimations() As Boolean
+ m_Estimation_IsExpanded = False
+ Map.refOperationParametersExpanderVM.OperParamsViewIsEnabled = True
+ Map.refOperationsListExpanderVM.EstimationExpander_Get_IsExpanded(False)
+ OnPropertyChanged("Estimation_IsExpanded")
+ Map.refMachiningOptionPanelVM.OnPropertyChanged("GenerateIsEnabled")
+ ' disattivo database utensili, lavorazioni e setup se vado in stima
+ Map.refMachinePanelVM.ToolMachSetUpIsEnabled(True, True, True)
+ Return True
+ End Function
+
+ 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 Function GetEstimationFileName(bAskSave As Boolean, ByRef sEstFile As String, ByRef sInfo As String) As Boolean
+ Dim bOk As Boolean = True
+ ' Recupero e verifico la path del progetto corrente
+ Dim sCurrFilePath As String = String.Empty
+ EgtGetCurrFilePath(sCurrFilePath)
+ If bAskSave Then
+ 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
+ bOk = False
+ Else
+ ' Lancio salvataggio
+ Application.Msn.NotifyColleagues(Application.SAVEPROJECT)
+ ' Se non salvato, abbandono
+ If EgtGetModified() Then bOk = False
+ ' Aggiorno path
+ EgtGetCurrFilePath(sCurrFilePath)
+ End If
+ End If
+ Else
+ If String.IsNullOrEmpty(sCurrFilePath) Then
+ ' File delle stime non trovato
+ MessageBox.Show(EgtMsg(MSG_SIMULATION + 18), EgtMsg(MSG_SIMULATION + 15), MessageBoxButton.OK, MessageBoxImage.Warning)
+ bOk = False
+ End If
+ End If
+ ' Creo la path del file di stima e relativo info (con nome gruppo se gestiti)
+ If Not String.IsNullOrEmpty(sCurrFilePath) Then
+ sInfo = "EgtCAM5 - " & sCurrFilePath
+ If EgtGetInfo(EgtGetCurrMachGroup(), KEY_MCHGRP_NCNAME, sEstFile) AndAlso Not String.IsNullOrWhiteSpace(sEstFile) Then
+ sEstFile = Path.ChangeExtension(Path.GetDirectoryName(sCurrFilePath) & "\" & sEstFile, ".html")
+ Else
+ sEstFile = Path.ChangeExtension(sCurrFilePath, Nothing)
+ If IniFile.m_bMachiningGroup Then
+ Dim sMGrpName As String = String.Empty
+ If EgtGetMachGroupName(EgtGetCurrMachGroup(), sMGrpName) Then
+ sEstFile &= "_" & sMGrpName & ".html"
+ sInfo &= "-" & sMGrpName
+ End If
+ Else
+ sEstFile &= ".html"
+ End If
+ End If
+ End If
+ Return bOk
+ End Function
+
+ Private Function CalcEstimation() As Boolean
+ ' Recupero la fase corrente
+ Dim nPhase As Integer = EgtGetCurrPhase()
+ ' Aggiorno le lavorazioni
+ If Not UpdateAllMachinings() Then
+ EgtSetCurrPhase(If(nPhase = 0, 1, nPhase), True)
+ Return False
+ End If
+ ' Determino il nome del file contenente le stime
+ Dim sEstFile As String = ""
+ Dim sInfo As String = ""
+ Dim bOk As Boolean = GetEstimationFileName(True, sEstFile, sInfo)
+ ' Cancello tutte le stime
+ If File.Exists(sEstFile) Then File.Delete(sEstFile)
+ Dim bOldEnMod As Boolean = EgtGetEnableModified()
+ EgtDisableModified()
+ EgtRemoveInfo(EgtGetCurrMachGroup(), "Ttot")
+ EgtRemoveInfo(EgtGetCurrMachGroup(), "Ltot")
+ If bOldEnMod Then EgtEnableModified()
+ If Not bOk Then Return False
+ ' Calcolo della stima
+ If Not EgtEstimate(sEstFile, sInfo) Then
+ If EgtGetLastMachMgrErrorId() <> 0 Then
+ Dim sErr As String = EgtGetLastMachMgrErrorString()
+ sErr = sErr.Replace("Cnc", "Est")
+ MessageBox.Show(sErr, EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Exclamation)
+ Else
+ MessageBox.Show(EgtMsg(MSG_SIMULATION + 17), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Error)
+ End If
+ bOk = False
+ End If
+ ' Torno alla fase originale (o alla prima se non definita)
+ EgtSetCurrPhase(If(nPhase = 0, 1, nPhase), True)
+ Return bOk
+ End Function
+
+#End Region
+
+End Class
\ No newline at end of file
diff --git a/OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderVM.vb b/OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderVM.vb
index 0ba3eed..5a56daf 100644
--- a/OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderVM.vb
+++ b/OptionPanel/MachiningOptionPanel/MachiningsTreeViewExpander/MachiningTreeExpanderVM.vb
@@ -6,7 +6,8 @@ Public Class MachiningTreeExpanderVM
#Region "FIELDS & PROPERTIES"
- Private m_CodeCommand As Boolean = False
+ Friend CodeCommand As Boolean = False
+
Private m_IsEnabled As Boolean
Public Property IsEnabled As Boolean
Get
@@ -14,12 +15,7 @@ Public Class MachiningTreeExpanderVM
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")
+ Map.refMachiningOptionPanelVM.Set_IsExpanded(MachiningOptionPanelVM.MachiningOptionPanelExpander.NEWMACHININGS, value)
End If
End Set
End Property
@@ -36,7 +32,7 @@ Public Class MachiningTreeExpanderVM
End Property
' Operazione correntemente selezionata, che permette di aggiungere al posto giusto quella nuova
- Private m_nSelectedOperationId As Integer = GDB_ID.NULL
+ Friend nSelectedOperationId As Integer = GDB_ID.NULL
Public ReadOnly Property MachListHdr As String
Get
@@ -54,6 +50,7 @@ Public Class MachiningTreeExpanderVM
#Region "CONSTRUCTOR"
Sub New()
+ Map.SetRefMachiningTreeExpanderVM(Me)
' Per caricare l'albero la prima volta che viene aperto
IsEnabled = False
LoadSelectedMachineMachinings()
@@ -61,13 +58,9 @@ Public Class MachiningTreeExpanderVM
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)
+ 'Application.Msn.Register(Application.SELECTEDOPERATION, Sub(SelectedOperation As OperationListBoxItem)
+ ' nSelectedOperationId = SelectedOperation.Id
+ ' End Sub)
End Sub
#End Region
@@ -106,7 +99,7 @@ Public Class MachiningTreeExpanderVM
' 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)
+ EgtRelocate(MachiningId, nSelectedOperationId, GDB_POS.AFTER)
End If
' Recupero geometria correntemente selezionata e la metto in un vettore
Dim SelectedEntities As New List(Of Integer)
@@ -132,7 +125,7 @@ Public Class MachiningTreeExpanderVM
EgtApplyMachining(True)
EgtDraw()
' Ricarico la lista operazioni per avere quella nuova
- Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, MachiningId)
+ Map.refOperationsListExpanderVM.LoadOperationList(MachiningId)
' disabilito la modalità nuova lavorazione
Application.Msn.NotifyColleagues(Application.NEWMACHININGMODEISACTIVE, New NewMachOpParam(False, MachiningId))
End If
@@ -188,6 +181,41 @@ Public Class MachiningTreeExpanderVM
#Region "METHODS"
+ Friend Function InitMachiningTreeExpander() As Boolean
+ m_IsEnabled = True
+
+ Map.refOperationParametersExpanderVM.OperParamsViewIsEnabled = False
+ Map.refSimulationExpanderVM.Simulation_IsEnabled = False
+ Map.refEstimationsExpanderVM.Estimation_IsEnabled = False
+
+ ' Abilito la selezione delle geometrie di lavorazione
+ Map.refProjectVM.SceneSelType = SceneSelTypeOpt.MACHINING
+ ' Abilito la selezione di curve e superfici del pezzo
+ Map.refProjectVM.SceneSelMode = SceneSelModeOpt.ALL
+
+ CodeCommand = False
+ OnPropertyChanged("IsEnabled")
+ Return True
+ End Function
+
+ Friend Function ExitMachiningTreeExpander() As Boolean
+ m_IsEnabled = False
+
+ Map.refOperationParametersExpanderVM.OperParamsViewIsEnabled = True
+ Map.refSimulationExpanderVM.Simulation_IsEnabled = True
+ Map.refEstimationsExpanderVM.Estimation_IsEnabled = True
+
+ If Not CodeCommand Then
+ Application.Msn.NotifyColleagues(Application.CANCELOPERATIONCOMMAND)
+ CodeCommand = False
+ OnPropertyChanged("IsEnabled")
+ Return False
+ End If
+ CodeCommand = False
+ OnPropertyChanged("IsEnabled")
+ Return True
+ End Function
+
'''
''' Method that search the machines in the correct folder and add to the MachinesList those valid.
'''
diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderVM.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderVM.vb
index a1ee8f8..f5d0447 100644
--- a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderVM.vb
+++ b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/DispositionParameterExpanderVM.vb
@@ -61,10 +61,10 @@ Public Class DispositionParameterExpanderVM
' 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)
+ Map.refProjectVM.SceneSelType = SceneSelTypeOpt.RAWPARTWITHFIXTURE
Else
' Abilito la selezione dei RawPart
- Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPART)
+ Map.refProjectVM.SceneSelType = SceneSelTypeOpt.RAWPART
End If
If m_MoveIsChecked Then
m_RawRefGroupVisibility = Visibility.Visible
@@ -122,7 +122,7 @@ Public Class DispositionParameterExpanderVM
RawPartIsExpanded = False
PartIsExpanded = False
' Abilito la selezione delle Fixture
- Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.FIXTURE)
+ Map.refProjectVM.SceneSelType = SceneSelTypeOpt.FIXTURE
m_ExpandFixtureFunction()
Else
' smarco la prima entità selezionata
@@ -177,7 +177,7 @@ Public Class DispositionParameterExpanderVM
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)
+ Map.refProjectVM.SceneSelType = SceneSelTypeOpt.RAWPARTWITHFIXTURE
' Seleziono le ventose associate ad uno dei grezzi selezionati
' ciclo sui grezzi selezionati
Dim nSelRawPartId As Integer = EgtGetFirstSelectedObj()
@@ -188,7 +188,7 @@ Public Class DispositionParameterExpanderVM
End While
Else
' Abilito la selezione di RawPart
- Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPART)
+ Map.refProjectVM.SceneSelType = SceneSelTypeOpt.RAWPART
' ciclo sui grezzi selezionati
Dim nSelRawPartId As Integer = EgtGetFirstSelectedObj()
While nSelRawPartId <> GDB_ID.NULL
@@ -310,10 +310,10 @@ Public Class DispositionParameterExpanderVM
Select Case m_ActiveObject
Case ObjectType.RAWPART
' Abilito la selezione delle Fixture
- Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPART)
+ Map.refProjectVM.SceneSelType = SceneSelTypeOpt.RAWPART
Case ObjectType.FIXTURE
' Abilito la selezione delle Fixture
- Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.FIXTURE)
+ Map.refProjectVM.SceneSelType = SceneSelTypeOpt.FIXTURE
End Select
m_MoveWithFixture = False
OnPropertyChanged("MoveWithFixture")
diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionVM.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionVM.vb
index 9671e3e..64e348f 100644
--- a/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionVM.vb
+++ b/OptionPanel/MachiningOptionPanel/OperationExpander/DispositionParameterExpander/RawPartOption/RawPartOptionVM.vb
@@ -12,7 +12,7 @@ Public Class RawPartOptionVM
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)
+ Map.refProjectVM.SceneSelType = SceneSelTypeOpt.RAWPARTWITHFIXTURE
' Seleziono le ventose associate ad uno dei grezzi selezionati
' ciclo sui grezzi selezionati
Dim nSelRawPartId As Integer = EgtGetFirstSelectedObj()
@@ -23,7 +23,7 @@ Public Class RawPartOptionVM
End While
Else
' Abilito la selezione di RawPart
- Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.RAWPART)
+ Map.refProjectVM.SceneSelType = SceneSelTypeOpt.RAWPART
' ciclo sui grezzi selezionati
Dim nSelRawPartId As Integer = EgtGetFirstSelectedObj()
While nSelRawPartId <> GDB_ID.NULL
diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderVM.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderVM.vb
index 7c23bbd..3ec97d4 100644
--- a/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderVM.vb
+++ b/OptionPanel/MachiningOptionPanel/OperationExpander/OperationExpanderVM.vb
@@ -78,6 +78,41 @@ Public Class OperationExpanderVM
ESTIMATIONS
End Enum
+ 'Private m_OpenExpander As Integer = MachiningOptionPanelExpander.OPERATIONLIST
+ 'Public Property OpenExpander As Integer
+ ' Get
+ ' Return m_OpenExpander
+ ' End Get
+ ' Set(value As Integer)
+ ' ' Esco dallo stato corrente
+ ' Select Case m_OpenExpander
+ ' Case MachiningOptionPanelExpander.OPERATIONLIST
+ ' Map.refOperationListVM.ExitOperationList()
+ ' Case MachiningOptionPanelExpander.OPERATIONPARAMETERS
+ ' Map.refOperationParametersVM.ExitOperationParameters()
+ ' Case MachiningOptionPanelExpander.SIMULATION
+ ' Map.refSimulationVM.ExitSimulation()
+ ' Case MachiningOptionPanelExpander.ESTIMATIONS
+ ' Map.refEstimationsVM.ExitEstimations()
+ ' End Select
+ ' ' Entro nel nuovo stato
+ ' m_OpenExpander = value
+ ' Select Case m_OpenExpander
+ ' Case MachiningOptionPanelExpander.OPERATIONLIST
+ ' 'OmagOFFICEMap.refMachGroupPanelVM.SetMachGroupState(False)
+ ' Map.refOperationListVM.InitOperationList()
+ ' 'OmagOFFICEMap.refTopCommandBarVM.IsEnabled = False
+ ' Case MachiningOptionPanelExpander.OPERATIONPARAMETERS
+ ' Map.refOperationParametersVM.InitOperationParameters()
+ ' Case MachiningOptionPanelExpander.SIMULATION
+ ' Map.refSimulationVM.InitSimulation()
+ ' Case MachiningOptionPanelExpander.ESTIMATIONS
+ ' Map.refEstimationsVM.InitEstimations()
+ ' End Select
+ ' NotifyPropertyChanged("OpenExpander")
+ ' End Set
+ 'End Property
+
Private m_OperViewIsEnabled As Boolean = True
Public Property OperViewIsEnabled As Boolean
Get
@@ -459,8 +494,9 @@ Public Class OperationExpanderVM
' Creo riferimento a questa classe in Map
Map.SetRefOperationExpanderVM(Me)
Me.ListIsExpanded = True
- OperationListBoxItem.m_RefOperationExpanderVM = Me
- SimulationExpanderVM.m_RefOperationExpanderVM = Me
+ 'OperationListBoxItem.m_RefOperationExpanderVM = Me
+ 'SimulationExpanderVM.m_RefOperationExpanderVM = Me
+ 'EstimationsExpanderVM.m_RefOperationExpanderVM = Me
Application.Msn.Register(Application.LOADOPERATIONLIST, Sub(nSelectedOperation As Integer)
LoadOperationList()
SelectOperation(nSelectedOperation)
@@ -473,44 +509,44 @@ Public Class OperationExpanderVM
EndNewMachining(Params.SelMachOpId)
End If
End Sub)
- Application.Msn.Register(Application.OPERATIONVIEWEXPANDERISENABLED, Sub(bEnable As Boolean)
- OperViewIsEnabled = bEnable
- 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 bValue Then
- If m_NewMachining Then EndNewMachining(GDB_ID.NULL)
- ListIsExpanded = False
- ParametersIsExpanded = False
- m_CurrExpandedExpander = MachiningOptionPanelExpander.SIMULATION
- Else
- ListIsExpanded = True
- ' Deseleziono e riseleziono le operazioni correnti per ripristinare il mark
- For Each Operation In OperationList
- If Operation.IsSelected Then
- Operation.IsSelected = False
- Operation.IsSelected = True
- End If
- Next
- End If
- End Sub)
- Application.Msn.Register(Application.ESTIMATIONEXPANDER_GET_ISEXPANDED, Sub(bValue As Boolean)
- If bValue Then
- If m_NewMachining Then EndNewMachining(GDB_ID.NULL)
- ListIsExpanded = False
- ParametersIsExpanded = False
- m_CurrExpandedExpander = MachiningOptionPanelExpander.ESTIMATIONS
- Else
- ListIsExpanded = True
- ' Deseleziono e riseleziono le operazioni correnti per ripristinare il mark
- For Each Operation In OperationList
- If Operation.IsSelected Then
- Operation.IsSelected = False
- Operation.IsSelected = True
- End If
- Next
- End If
- End Sub)
+ 'Application.Msn.Register(Application.SIMULATIONEXPANDER_GET_ISEXPANDED, Sub(bValue As Boolean)
+ ' If bValue Then
+ ' If m_NewMachining Then EndNewMachining(GDB_ID.NULL)
+ ' ListIsExpanded = False
+ ' ParametersIsExpanded = False
+ ' m_CurrExpandedExpander = MachiningOptionPanelExpander.SIMULATION
+ ' Else
+ ' ListIsExpanded = True
+ ' ' Deseleziono e riseleziono le operazioni correnti per ripristinare il mark
+ ' For Each Operation In OperationList
+ ' If Operation.IsSelected Then
+ ' Operation.IsSelected = False
+ ' Operation.IsSelected = True
+ ' End If
+ ' Next
+ ' End If
+ ' End Sub)
+ 'Application.Msn.Register(Application.ESTIMATIONEXPANDER_GET_ISEXPANDED, Sub(bValue As Boolean)
+ ' If bValue Then
+ ' If m_NewMachining Then EndNewMachining(GDB_ID.NULL)
+ ' ListIsExpanded = False
+ ' ParametersIsExpanded = False
+ ' m_CurrExpandedExpander = MachiningOptionPanelExpander.ESTIMATIONS
+ ' Else
+ ' ListIsExpanded = True
+ ' ' Deseleziono e riseleziono le operazioni correnti per ripristinare il mark
+ ' For Each Operation In OperationList
+ ' If Operation.IsSelected Then
+ ' Operation.IsSelected = False
+ ' Operation.IsSelected = True
+ ' End If
+ ' Next
+ ' End If
+ ' End Sub)
Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub()
' Annullo creazione nuova lavorazione
If m_NewMachining Then EndNewMachining(GDB_ID.NULL)
diff --git a/OptionPanel/MachiningOptionPanel/OperationExpander/OperationListBoxItem/OperationListBoxItem.vb b/OptionPanel/MachiningOptionPanel/OperationExpander/OperationListBoxItem/OperationListBoxItem.vb
index 5193c60..d4e83bc 100644
--- a/OptionPanel/MachiningOptionPanel/OperationExpander/OperationListBoxItem/OperationListBoxItem.vb
+++ b/OptionPanel/MachiningOptionPanel/OperationExpander/OperationListBoxItem/OperationListBoxItem.vb
@@ -4,8 +4,6 @@ Imports EgtUILib
Public Class OperationListBoxItem
Implements INotifyPropertyChanged
- Friend Shared m_RefOperationExpanderVM As OperationExpanderVM
-
Friend m_Type As Integer
Public ReadOnly Property Type As Integer
Get
@@ -40,7 +38,7 @@ Public Class OperationListBoxItem
Dim indexes As List(Of OperationListBoxItem) = New List(Of OperationListBoxItem)
Dim Count As Integer = 0
- For Each OperationListBoxItem In m_RefOperationExpanderVM.OperationList
+ For Each OperationListBoxItem In Map.refOperationsListExpanderVM.OperationList
If OperationListBoxItem.IsSelected And OperationListBoxItem.Id <> m_Id Then
Count = Count + 1
indexes.Add(OperationListBoxItem)
@@ -70,8 +68,8 @@ Public Class OperationListBoxItem
' Ne deseleziono la geometria
EgtDeselectAll()
- m_RefOperationExpanderVM.OnPropertyChanged("MoveUp_IsEnabled")
- m_RefOperationExpanderVM.OnPropertyChanged("MoveDown_IsEnabled")
+ Map.refOperationsListExpanderVM.OnPropertyChanged("MoveUp_IsEnabled")
+ Map.refOperationsListExpanderVM.OnPropertyChanged("MoveDown_IsEnabled")
NotifyPropertyChanged("IsSelected")
' Aggiorno visualizzazione
EgtDraw()
@@ -80,9 +78,9 @@ Public Class OperationListBoxItem
' Imposto la fase di lavorazione corrente
EgtSetCurrPhase(EgtGetOperationPhase(Id))
' Abilito la selezione dei Percorsi di Lavorazione
- Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.MACHPATH)
+ Map.refProjectVM.SceneSelType = SceneSelTypeOpt.MACHPATH
' Abilito la selezione delle curve
- Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.ALL)
+ Map.refProjectVM.SceneSelMode = SceneSelModeOpt.ALL
' Se l'operazione è una disposizione
If EgtGetOperationType(Id) = MCH_OY.DISP Then
'' Abilito la selezione delle Fixture
@@ -112,18 +110,18 @@ Public Class OperationListBoxItem
End While
End If
' Notifico al contentcontrol OperationParameter di aggiornarsi
- m_RefOperationExpanderVM.OnPropertyChanged("OperationParameters")
- m_RefOperationExpanderVM.OnPropertyChanged("MoveUp_IsEnabled")
- m_RefOperationExpanderVM.OnPropertyChanged("MoveDown_IsEnabled")
+ Map.refOperationParametersExpanderVM.OnPropertyChanged("OperationParameters")
+ Map.refOperationsListExpanderVM.OnPropertyChanged("MoveUp_IsEnabled")
+ Map.refOperationsListExpanderVM.OnPropertyChanged("MoveDown_IsEnabled")
' Notifico l'operazione selezionata all'expander con l'albero delle lavorazioni aggiungibili
- Application.Msn.NotifyColleagues(Application.SELECTEDOPERATION, Me)
+ Map.refMachiningTreeExpanderVM.nSelectedOperationId = Me.Id
' Aggiorno visualizzazione
EgtDraw()
End If
'OnPropertyChanged("ToolExpanderHeader")
- m_RefOperationExpanderVM.OnPropertyChanged("DuplicateCmd_IsEnabled")
- m_RefOperationExpanderVM.OnPropertyChanged("MachToDb_IsEnabled")
- m_RefOperationExpanderVM.OnPropertyChanged("Rename_IsEnabled")
+ Map.refOperationsListExpanderVM.OnPropertyChanged("DuplicateCmd_IsEnabled")
+ Map.refOperationsListExpanderVM.OnPropertyChanged("MachToDb_IsEnabled")
+ Map.refOperationsListExpanderVM.OnPropertyChanged("Rename_IsEnabled")
NotifyPropertyChanged("IsSelected")
End Set
End Property
diff --git a/OptionPanel/MachiningOptionPanel/OperationParametersExpander/OperationParametersExpanderV.xaml b/OptionPanel/MachiningOptionPanel/OperationParametersExpander/OperationParametersExpanderV.xaml
new file mode 100644
index 0000000..e4f2dbf
--- /dev/null
+++ b/OptionPanel/MachiningOptionPanel/OperationParametersExpander/OperationParametersExpanderV.xaml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OptionPanel/MachiningOptionPanel/OperationParametersExpander/OperationParametersExpanderV.xaml.vb b/OptionPanel/MachiningOptionPanel/OperationParametersExpander/OperationParametersExpanderV.xaml.vb
new file mode 100644
index 0000000..2994cb7
--- /dev/null
+++ b/OptionPanel/MachiningOptionPanel/OperationParametersExpander/OperationParametersExpanderV.xaml.vb
@@ -0,0 +1,180 @@
+Imports EgtWPFLib5
+Imports EgtWPFLib5.EgtFloating
+
+Public Class OperationParametersExpanderV
+
+ ' Private m_OperationExpanderVM As OperationExpanderVM
+
+ ' Private EgtFloatingTray As EgtFloatingTray
+ ' Private OptionPanelView As UserControl
+ ' Private OptionPanelViewStackPanel As StackPanel
+ ' 'Private OperationParameters As ContentPresenter
+ ' Private MachiningTreeContentPresenter As ContentPresenter
+ ' Private MachiningTreeUserControl As UserControl
+ ' Private MachiningTreeExpander As Expander
+ ' Private SimulationContentPresenter As ContentPresenter
+ ' Private SimulationUserControl As UserControl
+ ' Private SimulationExpanderStackPanel As StackPanel
+ ' Private SimulationExpander As Expander
+ ' Private GenerateButton As Button
+
+ ' Private m_bFirst As Boolean = True
+
+ '#Region "CONSTRUCTOR"
+
+ ' Sub New()
+ ' ' Funzione che interpreta l'xaml
+ ' InitializeComponent()
+ ' ' Assegno al riferimento locale al VM il VM preso dal DataContext
+ ' m_OperationExpanderVM = DirectCast(Me.DataContext, OperationExpanderVM)
+ ' End Sub
+
+ '#End Region ' CONSTRUCTOR
+
+ '#Region "EVENTS"
+
+ ' Private Sub MachiningOpListBoxItem_LostKeyboardFocus(sender As Object, e As KeyboardFocusChangedEventArgs)
+ ' Dim TextBox As TextBox = TryCast(sender, TextBox)
+ ' If IsNothing(TextBox) Then Return
+ ' Dim SelOp As MachiningOpListBoxItem = TryCast(TextBox.DataContext, MachiningOpListBoxItem)
+ ' If IsNothing(SelOp) Then Return
+ ' If MachiningOpListBoxItem.m_CloseModifyLostFocus Then
+ ' SelOp.ModifyNameEsc()
+ ' Else
+ ' If MachiningOpListBoxItem.m_Spy Then
+ ' MachiningOpListBoxItem.m_CloseModifyLostFocus = True
+ ' MachiningOpListBoxItem.m_Spy = False
+ ' End If
+ ' Keyboard.Focus(TextBox)
+ ' End If
+ ' End Sub
+
+ ' Private Sub MachiningOpListBoxItem_IsVisibleChanged(sender As Object, e As DependencyPropertyChangedEventArgs)
+ ' Dim bNewVal As Boolean = False
+ ' Try
+ ' bNewVal = CType(e.NewValue, Boolean)
+ ' Catch
+ ' End Try
+ ' If bNewVal Then
+ ' Dim inElem As IInputElement = TryCast(sender, IInputElement)
+ ' If Not IsNothing(inElem) Then Keyboard.Focus(inElem)
+ ' End If
+ ' End Sub
+
+ '#End Region ' EVENTS
+
+ ' Private Sub OperationExpanderView_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
+ ' If m_bFirst Then
+ ' EgtFloatingTray = FindAncestor(Of EgtFloatingTray)(Me)
+ ' OptionPanelView = FindAncestor(Of UserControl)(Me)
+ ' OptionPanelViewStackPanel = DirectCast(OptionPanelView.Content, StackPanel)
+ ' MachiningTreeContentPresenter = DirectCast(OptionPanelViewStackPanel.Children(1), ContentPresenter)
+ ' MachiningTreeUserControl = DirectCast(MachiningTreeContentPresenter.Content, UserControl)
+ ' MachiningTreeExpander = DirectCast(MachiningTreeUserControl.Content, Expander)
+ ' SimulationContentPresenter = DirectCast(OptionPanelViewStackPanel.Children(2), ContentPresenter)
+ ' SimulationUserControl = DirectCast(SimulationContentPresenter.Content, UserControl)
+ ' SimulationExpanderStackPanel = DirectCast(SimulationUserControl.Content, StackPanel)
+ ' SimulationExpander = DirectCast(SimulationExpanderStackPanel.Children(0), Expander)
+ ' GenerateButton = DirectCast(SimulationExpanderStackPanel.Children(2), Button)
+ ' ' Gestisco l'evento SizeChanged della Tray
+ ' AddHandler EgtFloatingTray.SizeChanged, AddressOf OperationExpanderTray_SizeChanged
+ ' m_bFirst = False
+ ' End If
+ ' CalculateOperationParametersStackPanelMaxHeight()
+ ' End Sub
+
+ ' Private Sub OperationExpanderTray_SizeChanged(sender As Object, e As System.Windows.SizeChangedEventArgs)
+ ' CalculateOperationParametersStackPanelMaxHeight()
+ ' 'For Each Expander In OperationParametersStackPanel.Children
+ ' ' If TypeOf Expander Is Expander Then
+ ' ' Dim CurrExpander As Expander = DirectCast(Expander, Expander)
+ ' ' CurrExpander.IsExpanded = False
+ ' ' End If
+ ' 'Next
+ ' End Sub
+
+ ' Private Sub CalculateOperationParametersStackPanelMaxHeight()
+ ' Dim OccupiedHeight As Double = 0
+ ' If Not MachiningTreeExpander.IsExpanded Then
+ ' OccupiedHeight += MachiningTreeExpander.ActualHeight
+ ' Else
+ ' Dim MachiningTreeExpanderContent As FrameworkElement = DirectCast(MachiningTreeExpander.Content, FrameworkElement)
+ ' MachiningTreeExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
+ ' OccupiedHeight += (MachiningTreeExpander.ActualHeight - MachiningTreeExpanderContent.DesiredSize.Height)
+ ' End If
+ ' If Not SimulationExpander.IsExpanded Then
+ ' OccupiedHeight += SimulationExpander.ActualHeight
+ ' Else
+ ' Dim SimulationExpanderContent As FrameworkElement = DirectCast(SimulationExpander.Content, FrameworkElement)
+ ' SimulationExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
+ ' OccupiedHeight += (SimulationExpander.ActualHeight - SimulationExpanderContent.DesiredSize.Height)
+ ' End If
+ ' OccupiedHeight += GenerateButton.ActualHeight
+ ' 'Aggiungo altezza OperationsList header Expander
+ ' If Not OperationsListExpander.IsExpanded Then
+ ' OccupiedHeight += OperationsListExpander.ActualHeight
+ ' Else
+ ' Dim OperationsListExpanderContent As FrameworkElement = DirectCast(OperationsListExpander.Content, FrameworkElement)
+ ' OperationsListExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
+ ' OccupiedHeight += (OperationsListExpander.ActualHeight - OperationsListExpanderContent.DesiredSize.Height)
+ ' End If
+ ' If Not OperationParametersExpander.IsExpanded Then
+ ' OccupiedHeight += OperationParametersExpander.ActualHeight
+ ' Else
+ ' Dim OperationParametersExpanderContent As FrameworkElement = DirectCast(OperationParametersExpander.Content, FrameworkElement)
+ ' OperationParametersExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
+ ' OccupiedHeight += (OperationParametersExpander.ActualHeight - OperationParametersExpanderContent.DesiredSize.Height)
+ ' End If
+ ' '' Aggiungo altezza contenuto OperationParameters che però è fuori dallo Stackpanel
+ ' 'OperationFirstParametersStackPanel.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
+ ' 'If OperationFirstParametersStackPanel.DesiredSize.Height <> 0 Then
+ ' ' OccupiedHeight += OperationFirstParametersStackPanel.DesiredSize.Height
+ ' 'Else
+ ' ' ' aggiungo il valore calcolato provando se non viene calcolato dal sistema al momento
+ ' ' OccupiedHeight += 10
+ ' 'End If
+ ' 'OperationParametersStackPanel.MaxHeight = OptionPanelViewStackPanel.MaxHeight - OccupiedHeight
+ ' End Sub
+
+ ' ' Funzione che permette di trovare il primo contenitore di tipo T di un elemento grafico dependencyObject
+ ' Public Function FindAncestor(Of T As Class)(dependencyObject As DependencyObject) As T
+ ' Dim target As DependencyObject = dependencyObject
+ ' Do
+ ' target = LogicalTreeHelper.GetParent(target)
+ ' Loop While target IsNot Nothing AndAlso Not (TypeOf target Is T)
+ ' If IsNothing(target) Then
+ ' target = dependencyObject
+ ' Do
+ ' target = VisualTreeHelper.GetParent(target)
+ ' Loop While target IsNot Nothing AndAlso Not (TypeOf target Is T)
+ ' End If
+ ' Return TryCast(target, T)
+ ' End Function
+
+ ' 'Public Sub ItemsControl_SelectionChanged(sender As Object, e As SelectionChangedEventArgs)
+ ' ' Dim ListControl As ListBox = DirectCast(sender, ListBox)
+ ' ' If Not IsNothing(ListControl.SelectedItem) Then
+ ' ' Dim SelectedItemIndex As Integer = ListControl.Items.IndexOf(ListControl.SelectedItem)
+ ' ' ListControl.Dispatcher.BeginInvoke(DirectCast(Sub()
+ ' ' ListControl.UpdateLayout()
+ ' ' If ListControl.SelectedItem IsNot Nothing Then
+ ' ' ListControl.ScrollIntoView(ListControl.SelectedItem)
+ ' ' End If
+ ' ' End Sub, Action))
+ ' ' If SelectedItemIndex > 0 Then
+ ' ' ListControl.Dispatcher.BeginInvoke(DirectCast(Sub()
+ ' ' ListControl.UpdateLayout()
+ ' ' ListControl.ScrollIntoView(ListControl.Items(SelectedItemIndex - 1))
+ ' ' End Sub, Action))
+ ' ' End If
+ ' ' If SelectedItemIndex < ListControl.Items.Count - 2 Then
+ ' ' ListControl.Dispatcher.BeginInvoke(DirectCast(Sub()
+ ' ' ListControl.UpdateLayout()
+ ' ' ListControl.ScrollIntoView(ListControl.Items(SelectedItemIndex + 1))
+ ' ' End Sub, Action))
+ ' ' End If
+ ' ' End If
+
+ ' 'End Sub
+
+End Class
diff --git a/OptionPanel/MachiningOptionPanel/OperationParametersExpander/OperationParametersExpanderVM.vb b/OptionPanel/MachiningOptionPanel/OperationParametersExpander/OperationParametersExpanderVM.vb
new file mode 100644
index 0000000..7707aee
--- /dev/null
+++ b/OptionPanel/MachiningOptionPanel/OperationParametersExpander/OperationParametersExpanderVM.vb
@@ -0,0 +1,214 @@
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class OperationParametersExpanderVM
+ Inherits ViewModelBase
+
+ Private m_OperParamsViewIsEnabled As Boolean = True
+ Public Property OperParamsViewIsEnabled As Boolean
+ Get
+ Return m_OperParamsViewIsEnabled
+ End Get
+ Set(value As Boolean)
+ m_OperParamsViewIsEnabled = value
+ OnPropertyChanged("OperParamsViewIsEnabled")
+ 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
+ Map.refMachiningOptionPanelVM.Set_IsExpanded(MachiningOptionPanelVM.MachiningOptionPanelExpander.OPERATIONPARAMETERS, value)
+ End If
+ Application.Msn.NotifyColleagues(Application.EMITTITLE)
+ ' disattivo database utensili, lavorazioni e setup se vado sulla modifica di una lavorazione
+ Map.refMachinePanelVM.ToolMachSetUpIsEnabled(Not m_ParametersIsExpanded, Not m_ParametersIsExpanded, Not m_ParametersIsExpanded)
+ 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
+
+ Public ReadOnly Property OperationParameters As ContentControl
+ Get
+ ' Cerco l'operazione selezionata all'interno di OperationList
+ Dim selOperation As OperationListBoxItem = Nothing
+ For Each Operation In Map.refOperationsListExpanderVM.OperationList
+ If Operation.IsSelected Then
+ selOperation = Operation
+ Exit For
+ End If
+ Next
+ If selOperation.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_MachiningParameterExpanderVM = New MachiningParameterExpanderVM()
+ m_MachiningParameterExpander.DataContext = m_MachiningParameterExpanderVM
+ End If
+ m_MachiningParameterExpanderVM.NotifyPropertyChanged("ParamExpanderPageV")
+ Return m_MachiningParameterExpander
+ End If
+ End Get
+ End Property
+
+ ' Actions
+ Private m_OpenDispositionFunction As Action(Of Boolean)
+
+ Private m_MachiningParameterExpander As MachiningParameterExpanderV
+ Private m_MachiningParameterExpanderVM As MachiningParameterExpanderVM
+ Private m_DispositionParameterExpander As DispositionParameterExpanderV
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ ' Creo riferimento a questa classe in Map
+ Map.SetRefOperationParametersExpanderVM(Me)
+ Map.refOperationsListExpanderVM.ListIsExpanded = True
+ End Sub
+
+#End Region ' Constructor
+
+#Region "METHODS"
+
+ Friend Function InitOperationParameters() As Boolean
+ m_ParametersIsExpanded = True
+ ' Cerco l'operazione selezionata all'interno di OperationList
+ Dim selOperation As OperationListBoxItem = Nothing
+ For Each Operation In Map.refOperationsListExpanderVM.OperationList
+ If Operation.IsSelected Then
+ selOperation = Operation
+ Exit For
+ End If
+ Next
+
+ If IsValidDispositionType(selOperation.m_Type) Then
+ ParametersExpanderName = selOperation.Name
+ ' Abilito la selezione di tutti i tipi di geometria
+ Map.refProjectVM.SceneSelMode = 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(selOperation.m_Type) Then
+ ' Leggo il tipo di operazione per impostare il tipo di selezione
+ EgtSetCurrMachining(selOperation.m_Id)
+ Dim sOpMach As String = String.Empty
+ EgtGetMachiningParam(MCH_MP.NAME, sOpMach)
+ ParametersExpanderName = selOperation.Name & " (" & sOpMach & ")"
+ Dim OperationType As Integer = -1
+ EgtGetMachiningParam(MCH_MP.TYPE, OperationType)
+ ' Abilito la selezione delle lavorazioni
+ Map.refProjectVM.SceneSelType = SceneSelTypeOpt.MACHINING
+ ' Abilito la selezione dei giusti tipi di geometria
+ Select Case OperationType
+ Case MCH_OY.SAWING
+ Map.refProjectVM.SceneSelMode = OptionModule.m_SelGeomSawing
+ Case MCH_OY.DRILLING
+ Map.refProjectVM.SceneSelMode = OptionModule.m_SelGeomDrilling
+ Case MCH_OY.MILLING
+ Map.refProjectVM.SceneSelMode = OptionModule.m_SelGeomMilling
+ Case MCH_OY.POCKETING
+ Map.refProjectVM.SceneSelMode = OptionModule.m_SelGeomPocketing
+ Case MCH_OY.MORTISING
+ Map.refProjectVM.SceneSelMode = OptionModule.m_SelGeomMortising
+ Case MCH_OY.SAWROUGHING
+ Map.refProjectVM.SceneSelMode = OptionModule.m_SelGeomSawRoughing
+ Case MCH_OY.SAWFINISHING
+ Map.refProjectVM.SceneSelMode = OptionModule.m_SelGeomSawFinishing
+ Case MCH_OY.GENMACHINING
+ Map.refProjectVM.SceneSelMode = OptionModule.m_SelGeomGenMachining
+ Case MCH_OY.CHISELING
+ Map.refProjectVM.SceneSelMode = OptionModule.m_SelGeomChiseling
+ Case MCH_OY.SURFFINISHING
+ Map.refProjectVM.SceneSelMode = OptionModule.m_SelGeomSurfFinishing
+ Case MCH_OY.WATERJETTING
+ Map.refProjectVM.SceneSelMode = OptionModule.m_SelGeomWaterJetting
+ End Select
+ ' Imposto visualizzazione utensile
+ DirectCast(m_MachiningParameterExpander.DataContext, MachiningParameterExpanderVM).ViewTool = True
+ End If
+ OnPropertyChanged("ParametersIsExpanded")
+ Return True
+ End Function
+
+ Friend Function ExitOperationParameters() As Boolean
+ m_ParametersIsExpanded = False
+ ' Cerco l'operazione selezionata all'interno di OperationList
+ Dim selOperation As OperationListBoxItem = Nothing
+ For Each Operation In Map.refOperationsListExpanderVM.OperationList
+ If Operation.IsSelected Then
+ selOperation = Operation
+ Exit For
+ End If
+ Next
+
+ If selOperation.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
+ Map.refProjectVM.SceneSelType = SceneSelTypeOpt.NULL
+ ' Resetto il tipo di selezione
+ Map.refProjectVM.SceneSelMode = SceneSelModeOpt.NULL
+ OnPropertyChanged("ParametersIsExpanded")
+ Return True
+ End Function
+
+#End Region
+
+End Class
\ No newline at end of file
diff --git a/OptionPanel/MachiningOptionPanel/OperationsListExpander/OperationsListExpanderV.xaml b/OptionPanel/MachiningOptionPanel/OperationsListExpander/OperationsListExpanderV.xaml
new file mode 100644
index 0000000..c73fc9a
--- /dev/null
+++ b/OptionPanel/MachiningOptionPanel/OperationsListExpander/OperationsListExpanderV.xaml
@@ -0,0 +1,157 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OptionPanel/MachiningOptionPanel/OperationsListExpander/OperationsListExpanderV.xaml.vb b/OptionPanel/MachiningOptionPanel/OperationsListExpander/OperationsListExpanderV.xaml.vb
new file mode 100644
index 0000000..f54b5b8
--- /dev/null
+++ b/OptionPanel/MachiningOptionPanel/OperationsListExpander/OperationsListExpanderV.xaml.vb
@@ -0,0 +1,180 @@
+Imports EgtWPFLib5
+Imports EgtWPFLib5.EgtFloating
+
+Public Class OperationsListExpanderV
+
+ ' Private m_OperationExpanderVM As OperationExpanderVM
+
+ ' Private EgtFloatingTray As EgtFloatingTray
+ ' Private OptionPanelView As UserControl
+ ' Private OptionPanelViewStackPanel As StackPanel
+ ' 'Private OperationParameters As ContentPresenter
+ ' Private MachiningTreeContentPresenter As ContentPresenter
+ ' Private MachiningTreeUserControl As UserControl
+ ' Private MachiningTreeExpander As Expander
+ ' Private SimulationContentPresenter As ContentPresenter
+ ' Private SimulationUserControl As UserControl
+ ' Private SimulationExpanderStackPanel As StackPanel
+ ' Private SimulationExpander As Expander
+ ' Private GenerateButton As Button
+
+ ' Private m_bFirst As Boolean = True
+
+ '#Region "CONSTRUCTOR"
+
+ ' Sub New()
+ ' ' Funzione che interpreta l'xaml
+ ' InitializeComponent()
+ ' ' Assegno al riferimento locale al VM il VM preso dal DataContext
+ ' m_OperationExpanderVM = DirectCast(Me.DataContext, OperationExpanderVM)
+ ' End Sub
+
+ '#End Region ' CONSTRUCTOR
+
+ '#Region "EVENTS"
+
+ ' Private Sub MachiningOpListBoxItem_LostKeyboardFocus(sender As Object, e As KeyboardFocusChangedEventArgs)
+ ' Dim TextBox As TextBox = TryCast(sender, TextBox)
+ ' If IsNothing(TextBox) Then Return
+ ' Dim SelOp As MachiningOpListBoxItem = TryCast(TextBox.DataContext, MachiningOpListBoxItem)
+ ' If IsNothing(SelOp) Then Return
+ ' If MachiningOpListBoxItem.m_CloseModifyLostFocus Then
+ ' SelOp.ModifyNameEsc()
+ ' Else
+ ' If MachiningOpListBoxItem.m_Spy Then
+ ' MachiningOpListBoxItem.m_CloseModifyLostFocus = True
+ ' MachiningOpListBoxItem.m_Spy = False
+ ' End If
+ ' Keyboard.Focus(TextBox)
+ ' End If
+ ' End Sub
+
+ ' Private Sub MachiningOpListBoxItem_IsVisibleChanged(sender As Object, e As DependencyPropertyChangedEventArgs)
+ ' Dim bNewVal As Boolean = False
+ ' Try
+ ' bNewVal = CType(e.NewValue, Boolean)
+ ' Catch
+ ' End Try
+ ' If bNewVal Then
+ ' Dim inElem As IInputElement = TryCast(sender, IInputElement)
+ ' If Not IsNothing(inElem) Then Keyboard.Focus(inElem)
+ ' End If
+ ' End Sub
+
+ '#End Region ' EVENTS
+
+ ' Private Sub OperationExpanderView_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
+ ' If m_bFirst Then
+ ' EgtFloatingTray = FindAncestor(Of EgtFloatingTray)(Me)
+ ' OptionPanelView = FindAncestor(Of UserControl)(Me)
+ ' OptionPanelViewStackPanel = DirectCast(OptionPanelView.Content, StackPanel)
+ ' MachiningTreeContentPresenter = DirectCast(OptionPanelViewStackPanel.Children(1), ContentPresenter)
+ ' MachiningTreeUserControl = DirectCast(MachiningTreeContentPresenter.Content, UserControl)
+ ' MachiningTreeExpander = DirectCast(MachiningTreeUserControl.Content, Expander)
+ ' SimulationContentPresenter = DirectCast(OptionPanelViewStackPanel.Children(2), ContentPresenter)
+ ' SimulationUserControl = DirectCast(SimulationContentPresenter.Content, UserControl)
+ ' SimulationExpanderStackPanel = DirectCast(SimulationUserControl.Content, StackPanel)
+ ' SimulationExpander = DirectCast(SimulationExpanderStackPanel.Children(0), Expander)
+ ' GenerateButton = DirectCast(SimulationExpanderStackPanel.Children(2), Button)
+ ' ' Gestisco l'evento SizeChanged della Tray
+ ' AddHandler EgtFloatingTray.SizeChanged, AddressOf OperationExpanderTray_SizeChanged
+ ' m_bFirst = False
+ ' End If
+ ' CalculateOperationParametersStackPanelMaxHeight()
+ ' End Sub
+
+ ' Private Sub OperationExpanderTray_SizeChanged(sender As Object, e As System.Windows.SizeChangedEventArgs)
+ ' CalculateOperationParametersStackPanelMaxHeight()
+ ' 'For Each Expander In OperationParametersStackPanel.Children
+ ' ' If TypeOf Expander Is Expander Then
+ ' ' Dim CurrExpander As Expander = DirectCast(Expander, Expander)
+ ' ' CurrExpander.IsExpanded = False
+ ' ' End If
+ ' 'Next
+ ' End Sub
+
+ ' Private Sub CalculateOperationParametersStackPanelMaxHeight()
+ ' Dim OccupiedHeight As Double = 0
+ ' If Not MachiningTreeExpander.IsExpanded Then
+ ' OccupiedHeight += MachiningTreeExpander.ActualHeight
+ ' Else
+ ' Dim MachiningTreeExpanderContent As FrameworkElement = DirectCast(MachiningTreeExpander.Content, FrameworkElement)
+ ' MachiningTreeExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
+ ' OccupiedHeight += (MachiningTreeExpander.ActualHeight - MachiningTreeExpanderContent.DesiredSize.Height)
+ ' End If
+ ' If Not SimulationExpander.IsExpanded Then
+ ' OccupiedHeight += SimulationExpander.ActualHeight
+ ' Else
+ ' Dim SimulationExpanderContent As FrameworkElement = DirectCast(SimulationExpander.Content, FrameworkElement)
+ ' SimulationExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
+ ' OccupiedHeight += (SimulationExpander.ActualHeight - SimulationExpanderContent.DesiredSize.Height)
+ ' End If
+ ' OccupiedHeight += GenerateButton.ActualHeight
+ ' 'Aggiungo altezza OperationsList header Expander
+ ' If Not OperationsListExpander.IsExpanded Then
+ ' OccupiedHeight += OperationsListExpander.ActualHeight
+ ' Else
+ ' Dim OperationsListExpanderContent As FrameworkElement = DirectCast(OperationsListExpander.Content, FrameworkElement)
+ ' OperationsListExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
+ ' OccupiedHeight += (OperationsListExpander.ActualHeight - OperationsListExpanderContent.DesiredSize.Height)
+ ' End If
+ ' If Not OperationParametersExpander.IsExpanded Then
+ ' OccupiedHeight += OperationParametersExpander.ActualHeight
+ ' Else
+ ' Dim OperationParametersExpanderContent As FrameworkElement = DirectCast(OperationParametersExpander.Content, FrameworkElement)
+ ' OperationParametersExpanderContent.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
+ ' OccupiedHeight += (OperationParametersExpander.ActualHeight - OperationParametersExpanderContent.DesiredSize.Height)
+ ' End If
+ ' '' Aggiungo altezza contenuto OperationParameters che però è fuori dallo Stackpanel
+ ' 'OperationFirstParametersStackPanel.Measure(New Size(Double.PositiveInfinity, Double.PositiveInfinity))
+ ' 'If OperationFirstParametersStackPanel.DesiredSize.Height <> 0 Then
+ ' ' OccupiedHeight += OperationFirstParametersStackPanel.DesiredSize.Height
+ ' 'Else
+ ' ' ' aggiungo il valore calcolato provando se non viene calcolato dal sistema al momento
+ ' ' OccupiedHeight += 10
+ ' 'End If
+ ' 'OperationParametersStackPanel.MaxHeight = OptionPanelViewStackPanel.MaxHeight - OccupiedHeight
+ ' End Sub
+
+ ' ' Funzione che permette di trovare il primo contenitore di tipo T di un elemento grafico dependencyObject
+ ' Public Function FindAncestor(Of T As Class)(dependencyObject As DependencyObject) As T
+ ' Dim target As DependencyObject = dependencyObject
+ ' Do
+ ' target = LogicalTreeHelper.GetParent(target)
+ ' Loop While target IsNot Nothing AndAlso Not (TypeOf target Is T)
+ ' If IsNothing(target) Then
+ ' target = dependencyObject
+ ' Do
+ ' target = VisualTreeHelper.GetParent(target)
+ ' Loop While target IsNot Nothing AndAlso Not (TypeOf target Is T)
+ ' End If
+ ' Return TryCast(target, T)
+ ' End Function
+
+ Public Sub ItemsControl_SelectionChanged(sender As Object, e As SelectionChangedEventArgs)
+ Dim ListControl As ListBox = DirectCast(sender, ListBox)
+ If Not IsNothing(ListControl.SelectedItem) Then
+ Dim SelectedItemIndex As Integer = ListControl.Items.IndexOf(ListControl.SelectedItem)
+ ListControl.Dispatcher.BeginInvoke(DirectCast(Sub()
+ ListControl.UpdateLayout()
+ If ListControl.SelectedItem IsNot Nothing Then
+ ListControl.ScrollIntoView(ListControl.SelectedItem)
+ End If
+ End Sub, Action))
+ If SelectedItemIndex > 0 Then
+ ListControl.Dispatcher.BeginInvoke(DirectCast(Sub()
+ ListControl.UpdateLayout()
+ ListControl.ScrollIntoView(ListControl.Items(SelectedItemIndex - 1))
+ End Sub, Action))
+ End If
+ If SelectedItemIndex < ListControl.Items.Count - 2 Then
+ ListControl.Dispatcher.BeginInvoke(DirectCast(Sub()
+ ListControl.UpdateLayout()
+ ListControl.ScrollIntoView(ListControl.Items(SelectedItemIndex + 1))
+ End Sub, Action))
+ End If
+ End If
+
+ End Sub
+
+End Class
diff --git a/OptionPanel/MachiningOptionPanel/OperationsListExpander/OperationsListExpanderVM.vb b/OptionPanel/MachiningOptionPanel/OperationsListExpander/OperationsListExpanderVM.vb
new file mode 100644
index 0000000..22508cd
--- /dev/null
+++ b/OptionPanel/MachiningOptionPanel/OperationsListExpander/OperationsListExpanderVM.vb
@@ -0,0 +1,1161 @@
+Imports System.Collections.ObjectModel
+Imports System.IO
+Imports EgtUILib
+Imports EgtWPFLib5
+
+Public Class OperationsListExpanderVM
+ Inherits ViewModelBase
+
+ ' Modalità di aggiunta attiva/disattiva
+ Private m_NewMachining As Boolean = False
+
+ Private Sub StartNewMachining()
+ m_NewMachining = True
+ ' Deseleziono le geometrie
+ EgtDeselectAll()
+ EgtDraw()
+ ' Reset lista facce
+ SelData.ClearIdSub()
+ ' Blocco la lista operazioni
+ IsEnabledOperationList = False
+ ' Abilito la selezione delle geometrie da lavorare
+ Map.refProjectVM.SceneSelType = SceneSelTypeOpt.MACHINING
+ ' Abilito la selezione di curve e superfici
+ Map.refProjectVM.SceneSelMode = SceneSelModeOpt.PARTCURVESANDSURFACES
+ ' Abilito ed apro l'expander con l'albero delle lavorazioni
+ Map.refMachiningTreeExpanderVM.CodeCommand = True
+ Map.refMachiningTreeExpanderVM.IsEnabled = 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
+ Map.refMachiningTreeExpanderVM.CodeCommand = True
+ Map.refMachiningTreeExpanderVM.IsEnabled = 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
+ Map.refOperationParametersExpanderVM.ParametersIsExpanded = True
+ m_NewMachining = False
+ ' Riseleziono geometria della lavorazione
+ If SelOpId <> GDB_ID.NULL Then
+ For Index = 0 To OperationList.Count - 1
+ If OperationList(Index).Id = SelOpId Then
+ OperationList(Index).IsSelected = True
+ Exit For
+ Else
+ OperationList(Index).IsSelected = False
+ End If
+ Next
+ End If
+ ' Abilito la selezione delle geometrie di lavorazione
+ Map.refProjectVM.SceneSelType = SceneSelTypeOpt.MACHINING
+ ' Abilito la selezione di curve e superfici del pezzo
+ Map.refProjectVM.SceneSelMode = SceneSelModeOpt.ALL
+ End Sub
+
+ Private m_NewPositioning As Boolean = False
+
+ Private m_OpersListViewIsEnabled As Boolean = True
+ Public Property OpersListViewIsEnabled As Boolean
+ Get
+ Return m_OpersListViewIsEnabled
+ End Get
+ Set(value As Boolean)
+ m_OpersListViewIsEnabled = value
+ OnPropertyChanged("OpersListViewIsEnabled")
+ 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
+ Map.refMachiningOptionPanelVM.Set_IsExpanded(MachiningOptionPanelVM.MachiningOptionPanelExpander.OPERATIONLIST, value)
+ End If
+ 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
+
+ Public ReadOnly Property DuplicateCmd_IsEnabled As Boolean
+ Get
+ Dim SelType As Integer = MCH_OY.NONE
+ For Each Operation In OperationList
+ If Operation.IsSelected Then
+ If SelType <> MCH_OY.NONE Then Return False
+ SelType = Operation.Type
+ If SelType = MCH_OY.DISP Then Return False
+ End If
+ Next
+ Return SelType <> MCH_OY.NONE
+ End Get
+ End Property
+
+ Public ReadOnly Property MachToDb_IsEnabled As Boolean
+ Get
+ Dim SelType As Integer = MCH_OY.NONE
+ For Each Operation In OperationList
+ If Operation.IsSelected Then
+ If SelType <> MCH_OY.NONE Then Return False
+ SelType = Operation.Type
+ If SelType = MCH_OY.DISP Then Return False
+ End If
+ Next
+ Return SelType <> MCH_OY.NONE
+ End Get
+ End Property
+
+ Public ReadOnly Property Rename_IsEnabled As Boolean
+ Get
+ Dim SelType As Integer = MCH_OY.NONE
+ For Each Operation In OperationList
+ If Operation.IsSelected Then
+ If SelType <> MCH_OY.NONE Then Return False
+ SelType = Operation.Type
+ If SelType = MCH_OY.DISP Then Return False
+ End If
+ Next
+ Return SelType <> MCH_OY.NONE
+ End Get
+ End Property
+
+ Public ReadOnly Property MoveUp_IsEnabled As Boolean
+ Get
+ Return MoveUp_SelectionOperation()
+ End Get
+ End Property
+
+ Public ReadOnly Property MoveDown_IsEnabled As Boolean
+ Get
+ Return MoveDown_SelectionOperation()
+ End Get
+ End Property
+
+ ' Actions
+ Private m_OpenDispositionFunction As Action(Of Boolean)
+
+ Private m_MachiningParameterExpander As MachiningParameterExpanderV
+ Private m_MachiningParameterExpanderVM As MachiningParameterExpanderVM
+ Private m_DispositionParameterExpander As DispositionParameterExpanderV
+
+#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
+
+ Public ReadOnly Property DuplicateMachMsg As String
+ Get
+ Return EgtMsg(MSG_OPERATION + 16)
+ End Get
+ End Property
+
+ Public ReadOnly Property MachToDbMsg As String
+ Get
+ Return EgtMsg(MSG_OPERATION + 17)
+ End Get
+ End Property
+
+ Public ReadOnly Property RenameMsg As String
+ Get
+ Return EgtMsg(MSG_OPERATION + 20)
+ 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
+ Private m_cmdDuplicateMach As ICommand
+ Private m_cmdMachToDb As ICommand
+ Private m_cmdRename As ICommand
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ ' Creo riferimento a questa classe in Map
+ Map.SetRefOperationsListExpanderVM(Me)
+ Me.ListIsExpanded = True
+ Application.Msn.Register(Application.LOADOPERATIONLIST, Sub(nSelectedOperation As Integer)
+ LoadOperationList()
+ SelectOperation(nSelectedOperation)
+ ListIsExpanded = True
+ 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.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
+ ' Deseleziono le operazioni correnti per eliminare il mark
+ For Each Operation In OperationList
+ If Operation.IsSelected Then
+ Operation.IsSelected = False
+ End If
+ Next
+ End Sub)
+ Application.Msn.Register(Application.CANCELOPERATIONCOMMAND, Sub()
+ CancelOperation(String.Empty)
+ End Sub)
+ End Sub
+
+#End Region ' Constructor
+
+#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
+ 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)
+ Map.refOperationParametersExpanderVM.ParametersIsExpanded = False
+ ListIsExpanded = True
+ End If
+ Return
+ End If
+ ' Se sto inserendo una nuova lavorazione
+ If m_NewMachining Then
+ EndNewMachining(GDB_ID.NULL)
+ Map.refOperationParametersExpanderVM.ParametersIsExpanded = False
+ ListIsExpanded = True
+ ' altrimenti sto cancellandone una vecchia
+ Else
+ Dim nPrevOperId As Integer = -1
+ For Each Operation In OperationList
+ If Operation.IsSelected Then
+ ' Salvo indice operazione precedente a selezionata
+ nPrevOperId = EgtGetPrevOperation(Operation.Id)
+ If Operation.Type = MCH_OY.DISP Then
+ ' Posso cancellare solo l'ultima disposizione
+ If EgtGetOperationPhase(Operation.Id) = EgtGetPhaseCount() Then
+ EgtRemoveLastPhase()
+ 'Else
+ ' Return
+ End If
+ Else
+ ' Deseleziono la geometria selezionata
+ EgtDeselectAll()
+ EgtDraw()
+ ' Rimuovo l'operazione selezionata
+ EgtRemoveOperation(Operation.Id)
+ End If
+ End If
+ Next
+ ' Ricarico la lista delle operazioni
+ LoadOperationList(nPrevOperId)
+ 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()
+ ' Cerco l'operazione selezionata all'interno di OperationList
+ Dim selOperation As OperationListBoxItem = Nothing
+ For Each Operation In OperationList
+ If Operation.IsSelected Then
+ selOperation = Operation
+ End If
+ Next
+
+ If EgtGetOperationMode(selOperation.Id) Then
+ Map.refOperationParametersExpanderVM.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 MoveUp. This method is invoked by the MoveUpCommand.
+ '''
+ Public Sub MoveUp()
+ ' Verifico il numero di elementi selezionati
+ Dim indexes As New List(Of Integer)()
+ For index As Integer = 0 To OperationList.Count - 1
+ ' Verifico gli elementi selezionati
+ If OperationList.Item(index).IsSelected Then
+ ' Se presente una disposizione esco
+ If EgtGetOperationType(OperationList.Item(index).Id) = MCH_OY.DISP Then Return
+ ' Aggiungo l'operazione
+ indexes.Add(index)
+ End If
+ Next
+ Dim lenIndexes As Integer = indexes.Count
+ ' Recupero Id ultima entità selezionata e precedente a quelle selezionate
+ Dim LastSelectedId As Integer = OperationList(indexes(lenIndexes - 1)).Id
+ Dim PreviousId As Integer = OperationList(indexes(0) - 1).Id
+ ' Sposto l'operazione precedente a quelle selezionate nell'ambiente Egt
+ If EgtRelocate(PreviousId, LastSelectedId, GDB_POS.AFTER) Then
+ ' Sposto l'operazione precedente a quelle selezionate nella grafica
+ OperationList.Move(indexes(0) - 1, indexes(lenIndexes - 1)) ' + 1)
+ ' Ricalcolo la lavorazioni selezionate e quella che era precedente (e ora è seguente)
+ For index As Integer = 0 To indexes.Count - 1
+ EgtSetCurrMachining(OperationList(indexes(index)).Id)
+ EgtApplyMachining(False)
+ Next
+ EgtSetCurrMachining(PreviousId)
+ EgtApplyMachining(False)
+ EgtDraw()
+ OnPropertyChanged("MoveUp_IsEnabled")
+ OnPropertyChanged("MoveDown_IsEnabled")
+ 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 MoveDown. This method is invoked by the MoveDownCommand.
+ '''
+ Public Sub MoveDown()
+ ' Verifico il numero di elementi selezionati
+ Dim indexes As New List(Of Integer)()
+ For index As Integer = 0 To OperationList.Count - 1
+ ' Verifico gli elementi selezionati
+ If OperationList.Item(index).IsSelected Then
+ ' Se presente una disposizione esco
+ If EgtGetOperationType(OperationList.Item(index).Id) = MCH_OY.DISP Then Return
+ ' Aggiungo l'operazione
+ indexes.Add(index)
+ End If
+ Next
+ Dim lenIndexes As Integer = indexes.Count
+ ' Recupero Id prima entità selezionata e successiva a quelle selezionate
+ Dim FirstSelectedId As Integer = OperationList(indexes(0)).Id
+ Dim NextId As Integer = OperationList(indexes(lenIndexes - 1) + 1).Id
+ ' Sposto l'operazione successiva a quelle selezionate nell'ambiente Egt
+ If EgtRelocate(NextId, FirstSelectedId, GDB_POS.BEFORE) Then
+ ' Sposto l'operazione successiva a quelle selezionate nella grafica
+ OperationList.Move(indexes(lenIndexes - 1) + 1, indexes(0))
+ ' Ricalcolo la lavorazioni selezionate e quella che era seguente (e ora è precedente)
+ For index As Integer = 0 To indexes.Count - 1
+ EgtSetCurrMachining(OperationList(indexes(index)).Id)
+ EgtApplyMachining(False)
+ Next
+ EgtSetCurrMachining(NextId)
+ EgtApplyMachining(False)
+ EgtDraw()
+ OnPropertyChanged("MoveUp_IsEnabled")
+ OnPropertyChanged("MoveDown_IsEnabled")
+ 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 SetUpDbWindow As New CurrSetUpV(Application.Current.MainWindow, New CurrSetUpVM)
+ SetUpDbWindow.ShowDialog()
+ Application.Msn.NotifyColleagues(Application.EMITTITLE)
+ End Sub
+
+#End Region ' SetUpCommand
+
+#Region "DuplicateMachCommand"
+
+ '''
+ ''' Returns a command that do Point.
+ '''
+ Public ReadOnly Property DuplicateMachCommand As ICommand
+ Get
+ If m_cmdDuplicateMach Is Nothing Then
+ m_cmdDuplicateMach = New RelayCommand(AddressOf DuplicateMach)
+ End If
+ Return m_cmdDuplicateMach
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Point. This method is invoked by the PointCommand.
+ '''
+ Public Sub DuplicateMach()
+ ' Cerco l'operazione selezionata all'interno di OperationList
+ Dim selOperation As OperationListBoxItem = Nothing
+ For Each Operation In OperationList
+ If Operation.IsSelected Then
+ selOperation = Operation
+ End If
+ Next
+ ' Verifico che l'operazione selezionata sia una lavorazione
+ If IsNothing(selOperation) OrElse
+ selOperation.m_Type = MCH_OY.NONE OrElse
+ selOperation.m_Type = MCH_OY.DISP Then Return
+ ' Tolgo Mark da lavorazione originale
+ EgtResetMark(EgtGetFirstNameInGroup(selOperation.Id, MCH_MGR_CL))
+ SelData.ClearIdSub()
+ ' Eseguo la copia
+ Dim MachiningId As Integer = EgtCopyMachining(selOperation.Name, selOperation.Name)
+ ' Se è abilitata l'opzione
+ If Not OptionModule.m_bNewMachiningIsLastOne Then
+ ' Sposto la lavorazione aggiunta subito dopo quella appena selezionata
+ EgtRelocate(MachiningId, selOperation.Id, GDB_POS.AFTER)
+ End If
+ ' Ricarico la lista operazioni aggiornata
+ LoadOperationList(MachiningId)
+ End Sub
+
+#End Region ' DuplicateMachCommand
+
+#Region "MachToDbCommand"
+
+ '''
+ ''' Returns a command that do Point.
+ '''
+ Public ReadOnly Property MachToDbCommand As ICommand
+ Get
+ If m_cmdMachToDb Is Nothing Then
+ m_cmdMachToDb = New RelayCommand(AddressOf MachToDb)
+ End If
+ Return m_cmdMachToDb
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Point. This method is invoked by the PointCommand.
+ '''
+ Public Sub MachToDb()
+ ' Cerco l'operazione selezionata all'interno di OperationList
+ Dim selOperation As OperationListBoxItem = Nothing
+ For Each Operation In OperationList
+ If Operation.IsSelected Then
+ selOperation = Operation
+ Exit For
+ End If
+ Next
+ 'verifico che l'operazione selezionata sia una lavorazione
+ If IsNothing(selOperation) OrElse
+ selOperation.m_Type = MCH_OY.NONE OrElse
+ selOperation.m_Type = MCH_OY.DISP Then Return
+ ' apro la finetra che chiede il nome e verifica che non sia già utilizzato (Nome lavorazione nel Db)
+ Dim NameDialogVM As New EgtWPFLib5.NameDialogVM With {
+ .VerifyChars = False,
+ .Title = EgtMsg(MSG_OPERATION + 18),
+ .Name = TryCast(selOperation, MachiningOpListBoxItem).LibMach,
+ .NameVerifyer = AddressOf NameVerifyer}
+ Dim NameWnd As New EgtWPFLib5.NameDialogV(Application.Current.MainWindow, NameDialogVM)
+ If Not NameWnd.ShowDialog() Then Return
+ ' creo lavorazione nel Db
+ EgtMdbAddMachining(NameDialogVM.Name, selOperation.m_Type)
+ ' copio i parametri
+ Dim bMachParList As Integer() = {MCH_MP.INVERT,
+ MCH_MP.LEAVETAB,
+ MCH_MP.TOOLINVERT}
+ Dim nMachParList As Integer() = {MCH_MP.TYPE,
+ MCH_MP.WORKSIDE,
+ MCH_MP.HEADSIDE,
+ MCH_MP.LEADINTYPE,
+ MCH_MP.EXTLINKTYPE,
+ MCH_MP.LEADOUTTYPE,
+ MCH_MP.CURVEUSE,
+ MCH_MP.STEPTYPE,
+ MCH_MP.SUBTYPE,
+ MCH_MP.LEADLINKTYPE,
+ MCH_MP.SOLCHOICETYPE,
+ MCH_MP.FACEUSE}
+ Dim dMachParList As Integer() = {MCH_MP.SPEED,
+ MCH_MP.FEED,
+ MCH_MP.STARTFEED,
+ MCH_MP.ENDFEED,
+ MCH_MP.TIPFEED,
+ MCH_MP.OFFSR,
+ MCH_MP.OFFSL,
+ MCH_MP.DEPTH,
+ MCH_MP.SIDEANGLE,
+ MCH_MP.APPROX,
+ MCH_MP.STARTPOS,
+ MCH_MP.STARTSLOWLEN,
+ MCH_MP.ENDSLOWLEN,
+ MCH_MP.THROUADDLEN,
+ MCH_MP.STEP_,
+ MCH_MP.RETURNPOS,
+ MCH_MP.OVERLAP,
+ MCH_MP.TABLEN,
+ MCH_MP.TABDIST,
+ MCH_MP.TABHEIGHT,
+ MCH_MP.TABANGLE,
+ MCH_MP.LITANG,
+ MCH_MP.LIPERP,
+ MCH_MP.LIELEV,
+ MCH_MP.LICOMPLEN,
+ MCH_MP.LOTANG,
+ MCH_MP.LOPERP,
+ MCH_MP.LOELEV,
+ MCH_MP.LOCOMPLEN,
+ MCH_MP.STARTADDLEN,
+ MCH_MP.ENDADDLEN,
+ MCH_MP.OFFSET,
+ MCH_MP.STEPEXTARC,
+ MCH_MP.STEPINTARC,
+ MCH_MP.SIDESTEP,
+ MCH_MP.VERTFEED,
+ MCH_MP.STEPSIDEANG,
+ MCH_MP.OVERL,
+ MCH_MP.STEPBACK,
+ MCH_MP.STEPSIDEANGBACK,
+ MCH_MP.BACKFEED}
+ Dim sMachParList As Integer() = {MCH_MP.NAME,
+ MCH_MP.TOOL,
+ MCH_MP.DEPTH_STR,
+ MCH_MP.TUUID,
+ MCH_MP.UUID,
+ MCH_MP.SYSNOTES,
+ MCH_MP.USERNOTES,
+ MCH_MP.OVERLAP_STR,
+ MCH_MP.OFFSET_STR,
+ MCH_MP.INITANGS,
+ MCH_MP.BLOCKEDAXIS}
+ For Each Parameter In bMachParList
+ Dim bTemp As Boolean = False
+ EgtGetMachiningParam(Parameter, bTemp)
+ EgtMdbSetCurrMachiningParam(Parameter, bTemp)
+ Next
+ For Each Parameter In nMachParList
+ Dim nTemp As Integer = 0
+ EgtGetMachiningParam(Parameter, nTemp)
+ EgtMdbSetCurrMachiningParam(Parameter, nTemp)
+ Next
+ For Each Parameter In dMachParList
+ Dim dTemp As Double = 0
+ EgtGetMachiningParam(Parameter, dTemp)
+ EgtMdbSetCurrMachiningParam(Parameter, dTemp)
+ Next
+ For Each Parameter In sMachParList
+ Dim sTemp As String = ""
+ EgtGetMachiningParam(Parameter, sTemp)
+ EgtMdbSetCurrMachiningParam(Parameter, sTemp)
+ Next
+ EgtMdbSaveCurrMachining()
+ EgtMdbSave()
+ End Sub
+
+ ' verifico che il nome non sia già utilizzato
+ Private Function NameVerifyer(Name As String) As Boolean
+ If String.IsNullOrWhiteSpace(Name) Then
+ MessageBox.Show(EgtMsg(MSG_EGTSAVEFILEDIALOG + 8),
+ EgtMsg(MSG_EGTSAVEFILEDIALOG + 7),
+ MessageBoxButton.OK, MessageBoxImage.Error)
+ Return False
+ End If
+ Dim TempName As String = Name
+ EgtMdbGetMachiningNewName(TempName)
+ If String.Compare(TempName, Name, True) = 0 Then Return True
+ MessageBox.Show(Name & " " &
+ EgtMsg(MSG_EGTSAVEFILEDIALOG + 3),
+ EgtMsg(MSG_EGTSAVEFILEDIALOG + 7),
+ MessageBoxButton.OK, MessageBoxImage.Error)
+ Return False
+ End Function
+
+#End Region ' MachToDbCommand
+
+#Region "RenameCommand"
+
+ '''
+ ''' Returns a command that do Point.
+ '''
+ Public ReadOnly Property RenameCommand As ICommand
+ Get
+ If m_cmdRename Is Nothing Then
+ m_cmdRename = New RelayCommand(AddressOf Rename)
+ End If
+ Return m_cmdRename
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Point. This method is invoked by the PointCommand.
+ '''
+ Public Sub Rename()
+ ' Cerco l'operazione selezionata all'interno di OperationList
+ Dim selOperation As OperationListBoxItem = Nothing
+ For Each Operation In OperationList
+ If Operation.IsSelected Then
+ selOperation = Operation
+ Exit For
+ End If
+ Next
+ ' verifico che l'operazione selezionata sia una lavorazione
+ If IsNothing(selOperation) OrElse
+ selOperation.m_Type = MCH_OY.NONE OrElse
+ selOperation.m_Type = MCH_OY.DISP Then Return
+ ' lancio modalità rinomina
+ If Not TypeOf selOperation Is MachiningOpListBoxItem Then Return
+ Dim SelectedOperation As MachiningOpListBoxItem = TryCast(selOperation, MachiningOpListBoxItem)
+ If IsNothing(SelectedOperation) Then Return
+ SelectedOperation.IsActive_ModifyName = True
+ ' apro la finetra che chiede il nome e verifica che non sia già utilizzato
+ 'Dim NewName As String = m_SelectedOperation.Name
+ 'Dim NameDialogVM As New EgtWPFLib5.NameDialogVM With {
+ ' .Title = "Nome lavorazione in Db",
+ ' .Name = m_SelectedOperation.Name,
+ ' .NameVerifyer = AddressOf NameVerifyer}
+ 'Dim NameWnd As New EgtWPFLib5.NameDialogV(Application.Current.MainWindow, NameDialogVM)
+ 'If Not NameWnd.ShowDialog() Then Return
+ '' creo lavorazione nel Db
+ 'EgtMdbAddMachining(NameDialogVM.Name, m_SelectedOperation.m_Type)
+ End Sub
+
+ '' verifico che il nome non sia già utilizzato
+ 'Private Function NameVerifyer(Name As String) As Boolean
+ ' If String.IsNullOrWhiteSpace(Name) Then
+ ' MessageBox.Show(EgtMsg(MSG_EGTSAVEFILEDIALOG + 8),
+ ' EgtMsg(MSG_EGTSAVEFILEDIALOG + 7),
+ ' MessageBoxButton.OK, MessageBoxImage.Error)
+ ' Return False
+ ' End If
+ ' Dim TempName As String = Name
+ ' 'EgtGetMachiningNewName(TempName)
+ ' If String.Compare(TempName, Name, True) = 0 Then Return True
+ ' MessageBox.Show(Name & " " &
+ ' EgtMsg(MSG_EGTSAVEFILEDIALOG + 3),
+ ' EgtMsg(MSG_EGTSAVEFILEDIALOG + 7),
+ ' MessageBoxButton.OK, MessageBoxImage.Error)
+ ' Return False
+ 'End Function
+
+#End Region ' RenameCommand
+
+#End Region ' Commands
+
+#Region "METHODS"
+
+ Friend Function InitOperationsList() As Boolean
+ m_ListIsExpanded = True
+
+ ' Abilito la selezione dei Percorsi di Lavorazione
+ Map.refProjectVM.SceneSelType = SceneSelTypeOpt.MACHPATH
+ ' Abilito la selezione di tutti i tipi di geometria
+ Map.refProjectVM.SceneSelMode = SceneSelModeOpt.ALL
+ OnPropertyChanged("ListIsExpanded")
+ Return True
+ End Function
+
+ Friend Function ExitOperationsList() As Boolean
+ m_ListIsExpanded = False
+
+ OnPropertyChanged("ListIsExpanded")
+ Return True
+ End Function
+
+ 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
+ For Each Operation In OperationList
+ If Operation.IsSelected Then
+ Operation.IsSelected = False
+ End If
+ Next
+ OperationList(0).IsSelected = True
+ Else
+ Dim OperationFound = False
+ For Each Operation In OperationList
+ If Operation.Id = nSelectedOperation Then
+ OperationFound = True
+ Operation.IsSelected = True
+ Exit For
+ End If
+ Next
+ If Not OperationFound Then
+ For Each Operation In OperationList
+ If Operation.IsSelected Then
+ Operation.IsSelected = False
+ End If
+ Next
+ OperationList(0).IsSelected = True
+ End If
+ End If
+ End Sub
+
+ ' Abilita/Disabilita il bottone MoveUp in base agli elementi selezionati
+ Private Function MoveUp_SelectionOperation() As Boolean
+ ' Inserisco in una lista le operazioni selezionate
+ Dim indexes As New List(Of Integer)()
+ For index As Integer = 0 To OperationList.Count - 1
+ If OperationList.Item(index).IsSelected Then
+ indexes.Add(index)
+ End If
+ Next
+ ' Se non ci sono operazioni selezionate, non va bene
+ If indexes.Count = 0 Then Return False
+
+ ' Se le operazioni non sono consecutive, non va bene
+ For index As Integer = 1 To indexes.Count - 1
+ If indexes(index) - indexes(index - 1) <> 1 Then Return False
+ Next
+
+ ' Se tra le operazioni c'è una disposizione, non va bene
+ For index As Integer = 0 To indexes.Count - 1
+ If EgtGetOperationType(OperationList.Item(indexes(index)).Id) = MCH_OY.DISP Then Return False
+ Next
+
+ ' Se prima della prima selezionata c'è una disposizione, non va bene
+ If indexes(0) = 0 OrElse EgtGetOperationType(OperationList.Item(indexes(0) - 1).Id) = MCH_OY.DISP Then Return False
+
+ Return True
+ End Function
+
+ ' Abilita/Disabilita il bottone MoveDown in base agli elementi selezionati
+ Private Function MoveDown_SelectionOperation() As Boolean
+ ' Inserisco in una lista le operazioni selezionate
+ Dim indexes As New List(Of Integer)()
+ For index As Integer = 0 To OperationList.Count - 1
+ If OperationList.Item(index).IsSelected Then
+ indexes.Add(index)
+ End If
+ Next
+ ' Se non ci sono operazioni selezionate, non va bene
+ If indexes.Count = 0 Then Return False
+
+ ' Se le operazioni non sono consecutive, non va bene
+ For index As Integer = 1 To indexes.Count - 1
+ If indexes(index) - indexes(index - 1) <> 1 Then Return False
+ Next
+
+ ' Se tra le operazioni c'è una disposizione, non va bene
+ For index As Integer = 0 To indexes.Count - 1
+ If EgtGetOperationType(OperationList.Item(indexes(index)).Id) = MCH_OY.DISP Then Return False
+ Next
+
+ ' Se dopo l'ultima selezionata c'è una disposizione, non va bene
+ Dim nLast As Integer = indexes.Count - 1
+ If indexes(nLast) = OperationList.Count - 1 OrElse
+ EgtGetOperationType(OperationList.Item(indexes(nLast) + 1).Id) = MCH_OY.DISP Then Return False
+
+ Return True
+ End Function
+
+ Friend Sub SelOperationItemFromId(nId As Integer)
+ ' Prima deseleziono l'Operazione correntemente selezionata
+ For Index = 0 To OperationList.Count - 1
+ If OperationList(Index).IsSelected Then
+ OperationList(Index).IsSelected = False
+ 'OperationList(Index).NotifyPropertyChanged("IsSelected")
+ 'Exit For
+ End If
+ Next
+ ' Ora cerco l'Operazione tramite nId e la seleziono
+ Dim nOpId As Integer = EgtGetParent(EgtGetParent(EgtGetParent(nId)))
+ 'Dim i As Integer = 0
+ 'For Each Item In OperationList
+ ' Dim nOpType As Integer = EgtGetOperationType(nOpId)
+ ' If Item.Id = nOpId And nOpType <> MCH_OY.NONE And nOpType <> MCH_OY.DISP Then
+ ' '(OperationListBoxItem)OperationList.Where(Function(x) x.Id = nOpId).IsSelected = True
+ ' OperationList(i).IsSelected = True
+ ' 'Item.IsSelected = True
+ ' 'Item.NotifyPropertyChanged("IsSelected")
+ ' Exit For
+ ' End If
+ ' i = i + 1
+ 'Next
+ For Index = 0 To OperationList.Count - 1
+ Dim nOpType As Integer = EgtGetOperationType(nOpId)
+ If OperationList(Index).Id = nOpId And nOpType <> MCH_OY.NONE And nOpType <> MCH_OY.DISP Then
+ OperationList(Index).IsSelected = True
+ 'OperationList(Index).NotifyPropertyChanged("IsSelected")
+ Exit For
+ End If
+ Next
+ End Sub
+
+ Friend Function IsInOperationList(nId As Integer) As Boolean
+ Dim nOpId As Integer = EgtGetParent(EgtGetParent(EgtGetParent(nId)))
+ For Index = 0 To OperationList.Count - 1
+ Dim nOpType As Integer = EgtGetOperationType(nOpId)
+ If OperationList(Index).Id = nOpId And nOpType <> MCH_OY.NONE And nOpType <> MCH_OY.DISP Then
+ Return True
+ End If
+ Next
+ Return False
+ End Function
+
+ Friend Sub DeselOperationFromId()
+ For Index = 0 To OperationList.Count - 1
+ If OperationList(Index).IsSelected Then
+ OperationList(Index).IsSelected = False
+ End If
+ Next
+ End Sub
+
+ Friend Sub SimulationExpander_Get_IsExpanded(bValue As Boolean)
+ If bValue Then
+ If m_NewMachining Then EndNewMachining(GDB_ID.NULL)
+ Else
+ ' Deseleziono e riseleziono le operazioni correnti per ripristinare il mark
+ For Each Operation In OperationList
+ If Operation.IsSelected Then
+ Operation.IsSelected = False
+ Operation.IsSelected = True
+ End If
+ Next
+ End If
+ End Sub
+
+ Friend Sub EstimationExpander_Get_IsExpanded(bValue As Boolean)
+ If bValue Then
+ If m_NewMachining Then EndNewMachining(GDB_ID.NULL)
+ Else
+ ' Deseleziono e riseleziono le operazioni correnti per ripristinare il mark
+ For Each Operation In OperationList
+ If Operation.IsSelected Then
+ Operation.IsSelected = False
+ Operation.IsSelected = True
+ End If
+ Next
+ End If
+ End Sub
+
+ Friend Sub LoadOperationList(nSelectedOperation As Integer)
+ LoadOperationList()
+ SelectOperation(nSelectedOperation)
+ ListIsExpanded = True
+ End Sub
+
+#End Region ' Methods
+
+End Class
\ No newline at end of file
diff --git a/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderV.xaml b/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderV.xaml
new file mode 100644
index 0000000..6ddd43b
--- /dev/null
+++ b/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderV.xaml
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderView.xaml.vb b/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderV.xaml.vb
similarity index 100%
rename from OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderView.xaml.vb
rename to OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderV.xaml.vb
diff --git a/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderViewModel.vb b/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderVM.vb
similarity index 60%
rename from OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderViewModel.vb
rename to OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderVM.vb
index 6ccc21c..0dcaeb4 100644
--- a/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderViewModel.vb
+++ b/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderVM.vb
@@ -5,8 +5,6 @@ Imports EgtUILib
Public Class SimulationExpanderVM
Inherits ViewModelBase
- Friend Shared m_RefOperationExpanderVM As OperationExpanderVM
-
#Region "FIELDS & PROPERTIES"
'EGT PROPERTIES
@@ -41,120 +39,37 @@ Public Class SimulationExpanderVM
' Flag di esecuzione in corso
Private m_bSimExecuting As Boolean = False
+ Public ReadOnly Property bSimExecuting As Boolean
+ Get
+ Return m_bSimExecuting
+ End Get
+ End Property
'GRAPHICAL PROPERTIES
- Private m_IsExpanded As Boolean
- Public Property IsExpanded As Boolean
+ Private m_Simulation_IsExpanded As Boolean
+ Public Property Simulation_IsExpanded As Boolean
Get
- Return m_IsExpanded
+ Return m_Simulation_IsExpanded
End Get
Set(value As Boolean)
- If value <> m_IsExpanded Then
- If value Then
-
- If m_RefOperationExpanderVM.m_CurrExpandedExpander = OperationExpanderVM.MachiningOptionPanelExpander.OPERATIONLIST Then
- m_RefOperationExpanderVM.ListIsExpanded = False
- ElseIf m_RefOperationExpanderVM.m_CurrExpandedExpander = OperationExpanderVM.MachiningOptionPanelExpander.OPERATIONPARAMETERS Then
- m_RefOperationExpanderVM.ParametersIsExpanded = False
- m_RefOperationExpanderVM.m_CurrExpandedExpander = OperationExpanderVM.MachiningOptionPanelExpander.SIMULATION
- ElseIf m_RefOperationExpanderVM.m_CurrExpandedExpander = OperationExpanderVM.MachiningOptionPanelExpander.ESTIMATIONS Then
- m_RefOperationExpanderVM.m_CurrExpandedExpander = OperationExpanderVM.MachiningOptionPanelExpander.SIMULATION
- Application.Msn.NotifyColleagues(Application.ESTIMATIONSEXPANDER_SET_ISEXPANDED, False)
- End If
- m_RefOperationExpanderVM.m_CurrExpandedExpander = OperationExpanderVM.MachiningOptionPanelExpander.SIMULATION
-
- EgtDeselectAll()
- Application.Msn.NotifyColleagues(Application.GETDISTANCE_ISCHECKED, False)
- ' Disabilito la selezione dei Percorsi di Lavorazione
- Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.NULL)
- ' Disabilito la selezione di tutti i tipi di geometria
- Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.NULL)
- Map.refTopCommandBarVM.SaveIsEnabled = False
- SelData.ClearIdSub()
- If IniFile.m_bShowOnlyTable Then
- EgtShowOnlyTable(False)
- EgtZoom(ZM.ALL, False)
- End If
- InitializeSimulation()
- EgtDraw()
- Estimation_IsExpanded = False
- Else
- If m_bSimExecuting Then Return
- CloseSimulation()
- If IniFile.m_bShowOnlyTable Then
- EgtShowOnlyTable(True)
- EgtZoom(ZM.ALL)
- End If
- Map.refTopCommandBarVM.SaveIsEnabled = True
- End If
- m_IsExpanded = value
- Application.Msn.NotifyColleagues(Application.SIMULATIONEXPANDER_GET_ISEXPANDED, value)
- OnPropertyChanged("IsExpanded")
- OnPropertyChanged("GenerateIsEnabled")
- ' disattivo database utensili, lavorazioni e setup se vado in simulazione
- Map.refMachinePanelVM.ToolMachSetUpIsEnabled(Not value, Not value, Not value)
+ If value <> m_Simulation_IsExpanded Then
+ Map.refMachiningOptionPanelVM.Set_IsExpanded(MachiningOptionPanelVM.MachiningOptionPanelExpander.SIMULATION, value)
End If
End Set
End Property
- Private m_Estimation_IsExpanded As Boolean
- Public Property Estimation_IsExpanded As Boolean
+ Private m_Simulation_IsEnabled As Boolean = False
+ Public Property Simulation_IsEnabled As Boolean
Get
- Return m_Estimation_IsExpanded
+ Return m_Simulation_IsEnabled
End Get
Set(value As Boolean)
- If value <> m_Estimation_IsExpanded Then
- If value Then
- If m_RefOperationExpanderVM.m_CurrExpandedExpander = OperationExpanderVM.MachiningOptionPanelExpander.OPERATIONLIST Then
- m_RefOperationExpanderVM.ListIsExpanded = False
- ElseIf m_RefOperationExpanderVM.m_CurrExpandedExpander = OperationExpanderVM.MachiningOptionPanelExpander.OPERATIONPARAMETERS Then
- m_RefOperationExpanderVM.ParametersIsExpanded = False
- m_RefOperationExpanderVM.m_CurrExpandedExpander = OperationExpanderVM.MachiningOptionPanelExpander.ESTIMATIONS
- Application.Msn.NotifyColleagues(Application.SIMULATIONEXPANDER_SET_ISEXPANDED, False)
- ElseIf m_RefOperationExpanderVM.m_CurrExpandedExpander = OperationExpanderVM.MachiningOptionPanelExpander.SIMULATION Then
- m_RefOperationExpanderVM.m_CurrExpandedExpander = OperationExpanderVM.MachiningOptionPanelExpander.ESTIMATIONS
- Application.Msn.NotifyColleagues(Application.ESTIMATIONSEXPANDER_SET_ISEXPANDED, False)
- End If
- m_RefOperationExpanderVM.m_CurrExpandedExpander = OperationExpanderVM.MachiningOptionPanelExpander.ESTIMATIONS
- IsExpanded = False
- EgtDeselectAll()
- Application.Msn.NotifyColleagues(Application.GETDISTANCE_ISCHECKED, False)
- ' Disabilito la selezione dei Percorsi di Lavorazione
- Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.NULL)
- ' Abilito la selezione di tutti i tipi di geometria
- Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.PARTCURVESANDSURFACES)
- CalcEstimation()
- OnPropertyChanged("TotalTime")
- OnPropertyChanged("TotalLength")
- End If
- m_Estimation_IsExpanded = value
- Application.Msn.NotifyColleagues(Application.ESTIMATIONEXPANDER_GET_ISEXPANDED, value)
- OnPropertyChanged("Estimation_IsExpanded")
- OnPropertyChanged("GenerateIsEnabled")
- ' disattivo database utensili, lavorazioni e setup se vado in stima
- Map.refMachinePanelVM.ToolMachSetUpIsEnabled(Not value, Not value, Not value)
- End If
+ m_Simulation_IsEnabled = value
+ OnPropertyChanged("Simulation_IsEnabled")
End Set
End Property
- Private m_Estimation_IsEnabled As Boolean = False
- Public Property Estimation_IsEnabled As Boolean
- Get
- Return m_Estimation_IsEnabled And Not m_bSimExecuting
- End Get
- Set(value As Boolean)
- m_Estimation_IsEnabled = value
- OnPropertyChanged("Estimation_IsEnabled")
- 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)
@@ -308,35 +223,10 @@ Public Class SimulationExpanderVM
End Set
End Property
- Public ReadOnly Property TotalTime As String
- Get
- Dim nTotalTime As Integer = 0
- EgtGetInfo(EgtGetCurrMachGroup(), "Ttot", nTotalTime)
- Dim sTotalTime As New TimeSpan(0, 0, nTotalTime)
- Return sTotalTime.ToString("hh\:mm\:ss")
- End Get
- End Property
-
- Public ReadOnly Property TotalLength As String
- Get
- Dim dTotalLength As Double = 0
- EgtGetInfo(EgtGetCurrMachGroup(), "Ltot", dTotalLength)
- Dim sTotalLength As String = ""
- If EgtUiUnitsAreMM() Then
- sTotalLength = DoubleToString(dTotalLength / 1000, 1) & " m"
- Else
- sTotalLength = DoubleToString(dTotalLength / (ONEINCH * 12), 1) & " ft"
- End If
- Return sTotalLength
- End Get
- End Property
-
' Definizione comandi
Private m_cmdStep As ICommand
Private m_cmdPlayPause As ICommand
Private m_cmdStop As ICommand
- Private m_cmdGenerate As ICommand
- Private m_cmdDetails As ICommand
#Region "Messages"
@@ -346,35 +236,6 @@ Public Class SimulationExpanderVM
End Get
End Property
- Public ReadOnly Property GenerateMsg As String
- Get
- Return EgtMsg(MSG_SIMULATION + 30) 'GENERA
- End Get
- End Property
-
- Public ReadOnly Property EstimationMsg As String
- Get
- Return EgtMsg(MSG_SIMULATION + 40) 'Stime
- End Get
- End Property
-
- Public ReadOnly Property TotalTimeMsg As String
- Get
- Return EgtMsg(MSG_SIMULATION + 41) 'Tempo totale
- End Get
- End Property
-
- Public ReadOnly Property TotalLengthMsg As String
- Get
- Return EgtMsg(MSG_SIMULATION + 42) 'Lunghezza totale
- End Get
- End Property
- Public ReadOnly Property DetailsMsg As String
- Get
- Return EgtMsg(MSG_SIMULATION + 43) 'Dettagli
- End Get
- End Property
-
Public ReadOnly Property VMillMsg As String
Get
Return EgtMsg(MSG_SIMULATION + 16) 'Virtual Milling
@@ -410,18 +271,12 @@ Public Class SimulationExpanderVM
Sub New()
SetRefSimulationExpanderVM(Me)
Application.Msn.Register(Application.CLOSEAPPLICATION, Sub()
- If IsExpanded Then
+ If Simulation_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.ESTIMATIONSEXPANDER_SET_ISEXPANDED, Sub(bValue As Boolean)
- Estimation_IsExpanded = bValue
- End Sub)
Application.Msn.Register(Application.SIMULATIONEXPANDER_UPDATE_CNCDATA, Sub()
- If IsExpanded Then
+ If Simulation_IsExpanded Then
ShowCncData()
End If
End Sub)
@@ -568,51 +423,39 @@ Public Class SimulationExpanderVM
#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
-
'''
''' Creata the new tool. This method is invoked by the NewCommand.
'''
Public Sub Generate(ByVal param As Object)
' Verifico se richiesta anche visualizzazione del CN
- Dim bNcView As Boolean = ( (Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift)
+ Dim bNcView As Boolean = ((Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift)
' Recupero la fase corrente
Dim nPhase As Integer = EgtGetCurrPhase()
' Aggiorno le lavorazioni
If Not UpdateAllMachinings() Then
- EgtSetCurrPhase( If( nPhase = 0, 1, nPhase), True)
+ EgtSetCurrPhase(If(nPhase = 0, 1, nPhase), True)
Return
End If
' Recupero nome file CN (dopo aver verificato salvataggio progetto)
Dim sCncFile As String = ""
Dim sInfo As String = ""
- If Not GetCncFileName( True, sCncFile, sInfo) Then Return
+ If Not GetCncFileName(True, sCncFile, sInfo) Then Return
' Eseguo
If Not EgtGenerate(sCncFile, sInfo) Then
Dim nErr = EgtGetLastMachMgrErrorId()
- If nErr = 1000 then
- MessageBox.Show( EgtMsg( 5333), EgtMsg( 5320), MessageBoxButton.OK, MessageBoxImage.Information)
+ If nErr = 1000 Then
+ MessageBox.Show(EgtMsg(5333), EgtMsg(5320), MessageBoxButton.OK, MessageBoxImage.Information)
ElseIf nErr <> 0 Then
Dim sErr As String = EgtGetLastMachMgrErrorString()
- MessageBox.Show( sErr, EgtMsg( 5305), MessageBoxButton.OK, MessageBoxImage.Exclamation)
+ MessageBox.Show(sErr, EgtMsg(5305), MessageBoxButton.OK, MessageBoxImage.Exclamation)
Else
- MessageBox.Show( EgtMsg( 5306), EgtMsg( 5305), MessageBoxButton.OK, MessageBoxImage.Error)
+ MessageBox.Show(EgtMsg(5306), EgtMsg(5305), MessageBoxButton.OK, MessageBoxImage.Error)
End If
bNcView = False
Else
- Application.Msn.NotifyColleagues( Application.NOTIFYSTATUSOUTPUT, EgtMsg( 5332) & " (" & sCncFile & ")")
+ Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, EgtMsg(5332) & " (" & sCncFile & ")")
End If
' Torno alla fase originale (o alla prima se non definita)
EgtSetCurrPhase(If(nPhase = 0, 1, nPhase), True)
@@ -620,56 +463,66 @@ Public Class SimulationExpanderVM
' Se richiesta anche la visualizzazione del CN corrente, procedo
If bNcView Then
' Se esiste ne lancio l'editing
- If File.Exists( sCncFile) Then
- Process.Start( "Notepad.exe", sCncFile)
- ' altrimenti lo segnalo
+ If File.Exists(sCncFile) Then
+ Process.Start("Notepad.exe", sCncFile)
+ ' altrimenti lo segnalo
Else
- Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, "Edit failed, missing part program file" & " (" & sCncFile & ")")
+ Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, "Edit failed, missing part program file" & " (" & sCncFile & ")")
End If
End If
End Sub
#End Region ' GenerateCommand
-#Region "Details"
-
- '''
- ''' Returns a command that create a new tool.
- '''
- Public ReadOnly Property Details_Command As ICommand
- Get
- If m_cmdDetails Is Nothing Then
- m_cmdDetails = New RelayCommand(AddressOf Details)
- End If
- Return m_cmdDetails
- End Get
- End Property
-
- '''
- ''' Creata the new tool. This method is invoked by the NewCommand.
- '''
- Public Sub Details(ByVal param As Object)
- ' Determino il nome del file contenente le stime
- Dim sEstFile As String = ""
- Dim sInfo As String = ""
- GetEstimationFileName(False, sEstFile, sInfo)
- ' Verifico che il file esista
- If Not File.Exists(sEstFile) Then
- ' File delle stime non trovato
- MessageBox.Show(EgtMsg(MSG_SIMULATION + 18), EgtMsg(MSG_SIMULATION + 15), MessageBoxButton.OK, MessageBoxImage.Warning)
- Return
- End If
- ' Visualizzazione
- Dim EstimationsWnd As New EstimationsDetailsWndV(Application.Current.MainWindow, New EstimationsDetailsWndVM(sEstFile))
- EstimationsWnd.ShowDialog()
- End Sub
-
-#End Region ' Details
-
#End Region
#Region "METHODS"
+ Friend Function InitSimulation() As Boolean
+ EgtDeselectAll()
+ Map.refInstrumentPanelVM.GetDistIsChecked = False
+ ' Disabilito la selezione dei Percorsi di Lavorazione
+ Map.refProjectVM.SceneSelType = SceneSelTypeOpt.NULL
+ ' Disabilito la selezione di tutti i tipi di geometria
+ Map.refProjectVM.SceneSelMode = SceneSelModeOpt.NULL
+ Map.refTopCommandBarVM.SaveIsEnabled = False
+ SelData.ClearIdSub()
+ If IniFile.m_bShowOnlyTable Then
+ EgtShowOnlyTable(False)
+ EgtZoom(ZM.ALL, False)
+ End If
+ InitializeSimulation()
+ EgtDraw()
+
+ m_Simulation_IsExpanded = True
+ Map.refOperationParametersExpanderVM.OperParamsViewIsEnabled = False
+ Map.refOperationsListExpanderVM.SimulationExpander_Get_IsExpanded(True)
+ OnPropertyChanged("Simulation_IsExpanded")
+ Map.refMachiningOptionPanelVM.OnPropertyChanged("GenerateIsEnabled")
+ ' disattivo database utensili, lavorazioni e setup se vado in simulazione
+ Map.refMachinePanelVM.ToolMachSetUpIsEnabled(False, False, False)
+ Return True
+ End Function
+
+ Friend Function ExitSimulation() As Boolean
+ If m_bSimExecuting Then Return False
+ CloseSimulation()
+ If IniFile.m_bShowOnlyTable Then
+ EgtShowOnlyTable(True)
+ EgtZoom(ZM.ALL)
+ End If
+ Map.refTopCommandBarVM.SaveIsEnabled = True
+
+ m_Simulation_IsExpanded = False
+ Map.refOperationParametersExpanderVM.OperParamsViewIsEnabled = True
+ Map.refOperationsListExpanderVM.SimulationExpander_Get_IsExpanded(False)
+ OnPropertyChanged("Simulation_IsExpanded")
+ Map.refMachiningOptionPanelVM.OnPropertyChanged("GenerateIsEnabled")
+ ' disattivo database utensili, lavorazioni e setup se vado in simulazione
+ Map.refMachinePanelVM.ToolMachSetUpIsEnabled(True, True, True)
+ Return True
+ End Function
+
Private Function UpdateAllMachinings() As Boolean
' Eseguo ricalcolo
Dim bModified As Boolean = EgtGetModified()
@@ -748,10 +601,11 @@ Public Class SimulationExpanderVM
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)
- OnPropertyChanged("Estimation_IsEnabled")
+ Map.refTopCommandBarVM.DrawIsEnabled = False
+ Map.refOperationsListExpanderVM.OpersListViewIsEnabled = False
+ Map.refOperationParametersExpanderVM.OperParamsViewIsEnabled = False
+ Map.refMachGroupPanelVM.SetMachGroupState(False) ' Map.refMachGroupPanelVM.MachGroupPanelIsEnabled = False
+ Map.refEstimationsExpanderVM.OnPropertyChanged("Estimation_IsEnabled")
If Not EgtSimStart(False) Then
If EgtGetLastMachMgrErrorId() <> 0 Then
Dim sErr As String = EgtGetLastMachMgrErrorString()
@@ -837,10 +691,11 @@ Public Class SimulationExpanderVM
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)
- OnPropertyChanged("Estimation_IsEnabled")
+ Map.refTopCommandBarVM.DrawIsEnabled = True
+ Map.refOperationsListExpanderVM.OpersListViewIsEnabled = True
+ Map.refOperationParametersExpanderVM.OperParamsViewIsEnabled = True
+ Map.refMachGroupPanelVM.SetMachGroupState(True) ' Map.refMachGroupPanelVM.MachGroupPanelIsEnabled = True
+ Map.refEstimationsExpanderVM.OnPropertyChanged("Estimation_IsEnabled")
End Sub
Private Sub ShowCncData()
@@ -940,7 +795,7 @@ Public Class SimulationExpanderVM
End If
End Sub
- Private Function GetCncFileName( bAskSave As Boolean, ByRef sCncFile As String, ByRef sInfo As String) As Boolean
+ Private Function GetCncFileName(bAskSave As Boolean, ByRef sCncFile As String, ByRef sInfo As String) As Boolean
' Recupero e verifico la path del progetto corrente
Dim sCurrFilePath As String = String.Empty
EgtGetCurrFilePath(sCurrFilePath)
@@ -962,9 +817,9 @@ Public Class SimulationExpanderVM
End If
sCncFile = ""
sInfo = "EgtCAM5 - " & sCurrFilePath
- If EgtGetInfo( EgtGetCurrMachGroup(), KEY_MCHGRP_NCNAME, sCncFile) AndAlso Not String.IsNullOrWhiteSpace( sCncFile) then
- sCncFile = Path.GetDirectoryName (sCurrFilePath) & "\" & sCncFile
- else
+ If EgtGetInfo(EgtGetCurrMachGroup(), KEY_MCHGRP_NCNAME, sCncFile) AndAlso Not String.IsNullOrWhiteSpace(sCncFile) Then
+ sCncFile = Path.GetDirectoryName(sCurrFilePath) & "\" & sCncFile
+ Else
sCncFile = Path.ChangeExtension(sCurrFilePath, Nothing)
If IniFile.m_bMachiningGroup Then
Dim sMGrpName As String = String.Empty
@@ -975,94 +830,10 @@ Public Class SimulationExpanderVM
Else
sCncFile &= ".cnc"
End If
- End if
+ End If
Return True
End Function
- Private Function GetEstimationFileName(bAskSave As Boolean, ByRef sEstFile As String, ByRef sInfo As String) As Boolean
- Dim bOk As Boolean = True
- ' Recupero e verifico la path del progetto corrente
- Dim sCurrFilePath As String = String.Empty
- EgtGetCurrFilePath(sCurrFilePath)
- If bAskSave Then
- 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
- bOk = False
- Else
- ' Lancio salvataggio
- Application.Msn.NotifyColleagues(Application.SAVEPROJECT)
- ' Se non salvato, abbandono
- If EgtGetModified() Then bOk = False
- ' Aggiorno path
- EgtGetCurrFilePath(sCurrFilePath)
- End If
- End If
- Else
- If String.IsNullOrEmpty(sCurrFilePath) Then
- ' File delle stime non trovato
- MessageBox.Show(EgtMsg(MSG_SIMULATION + 18), EgtMsg(MSG_SIMULATION + 15), MessageBoxButton.OK, MessageBoxImage.Warning)
- bOk = False
- End If
- End If
- ' Creo la path del file di stima e relativo info (con nome gruppo se gestiti)
- If Not String.IsNullOrEmpty(sCurrFilePath) Then
- sInfo = "EgtCAM5 - " & sCurrFilePath
- If EgtGetInfo( EgtGetCurrMachGroup(), KEY_MCHGRP_NCNAME, sEstFile) AndAlso Not String.IsNullOrWhiteSpace( sEstFile) then
- sEstFile = Path.ChangeExtension(Path.GetDirectoryName (sCurrFilePath) & "\" & sEstFile, ".html")
- else
- sEstFile = Path.ChangeExtension(sCurrFilePath, Nothing)
- If IniFile.m_bMachiningGroup Then
- Dim sMGrpName As String = String.Empty
- If EgtGetMachGroupName(EgtGetCurrMachGroup(), sMGrpName) Then
- sEstFile &= "_" & sMGrpName & ".html"
- sInfo &= "-" & sMGrpName
- End If
- Else
- sEstFile &= ".html"
- End If
- End If
- End If
- Return bOk
- End Function
-
- Private Function CalcEstimation() As Boolean
- ' Recupero la fase corrente
- Dim nPhase As Integer = EgtGetCurrPhase()
- ' Aggiorno le lavorazioni
- If Not UpdateAllMachinings() Then
- EgtSetCurrPhase(If(nPhase = 0, 1, nPhase), True)
- Return False
- End If
- ' Determino il nome del file contenente le stime
- Dim sEstFile As String = ""
- Dim sInfo As String = ""
- Dim bOk As Boolean = GetEstimationFileName(True, sEstFile, sInfo)
- ' Cancello tutte le stime
- If File.Exists(sEstFile) Then File.Delete(sEstFile)
- Dim bOldEnMod As Boolean = EgtGetEnableModified()
- EgtDisableModified()
- EgtRemoveInfo(EgtGetCurrMachGroup(), "Ttot")
- EgtRemoveInfo(EgtGetCurrMachGroup(), "Ltot")
- If bOldEnMod Then EgtEnableModified()
- If Not bOk Then Return False
- ' Calcolo della stima
- If Not EgtEstimate(sEstFile, sInfo) Then
- If EgtGetLastMachMgrErrorId() <> 0 Then
- Dim sErr As String = EgtGetLastMachMgrErrorString()
- sErr = sErr.Replace("Cnc", "Est")
- MessageBox.Show(sErr, EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Exclamation)
- Else
- MessageBox.Show(EgtMsg(MSG_SIMULATION + 17), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Error)
- End If
- bOk = False
- End If
- ' Torno alla fase originale (o alla prima se non definita)
- EgtSetCurrPhase(If(nPhase = 0, 1, nPhase), True)
- Return bOk
- End Function
-
#End Region
End Class
\ No newline at end of file
diff --git a/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderView.xaml b/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderView.xaml
deleted file mode 100644
index b477e00..0000000
--- a/OptionPanel/MachiningOptionPanel/SimulationExpander/SimulationExpanderView.xaml
+++ /dev/null
@@ -1,143 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/OptionPanel/MachiningOptionPanelV.xaml b/OptionPanel/MachiningOptionPanelV.xaml
new file mode 100644
index 0000000..8bf918d
--- /dev/null
+++ b/OptionPanel/MachiningOptionPanelV.xaml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OptionPanel/MachiningOptionPanelV.xaml.vb b/OptionPanel/MachiningOptionPanelV.xaml.vb
new file mode 100644
index 0000000..7e54d5c
--- /dev/null
+++ b/OptionPanel/MachiningOptionPanelV.xaml.vb
@@ -0,0 +1,7 @@
+Public Class MachiningOptionPanelV
+
+ Private Sub Me_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
+ Dim x = ciao.MaxHeight
+ End Sub
+
+End Class
diff --git a/OptionPanel/MachiningOptionPanelVM.vb b/OptionPanel/MachiningOptionPanelVM.vb
new file mode 100644
index 0000000..6c2889d
--- /dev/null
+++ b/OptionPanel/MachiningOptionPanelVM.vb
@@ -0,0 +1,198 @@
+Imports EgtUILib
+
+Public Class MachiningOptionPanelVM
+ Inherits ViewModelBase
+
+ ' GRAPHICAL ELEMENTS
+ Private m_OperationsListExpander As OperationsListExpanderV
+ Public ReadOnly Property OperationsListExpander As ContentControl
+ Get
+ If IsNothing(m_OperationsListExpander) Then
+ m_OperationsListExpander = New OperationsListExpanderV With {
+ .DataContext = New OperationsListExpanderVM}
+ End If
+ Map.refOperationsListExpanderVM.LoadOperationList(GDB_ID.NULL)
+ Return m_OperationsListExpander
+ End Get
+ End Property
+
+ Private m_OperationParametersExpander As OperationParametersExpanderV
+ Public ReadOnly Property OperationParametersExpander As ContentControl
+ Get
+ If IsNothing(m_OperationParametersExpander) Then
+ m_OperationParametersExpander = New OperationParametersExpanderV With {
+ .DataContext = New OperationParametersExpanderVM}
+ End If
+ Return m_OperationParametersExpander
+ End Get
+ End Property
+
+ Private m_MachiningsTreeExpander As MachiningTreeExpanderV
+ Public ReadOnly Property MachiningsTreeExpander As ContentControl
+ Get
+ If IsNothing(m_MachiningsTreeExpander) Then
+ m_MachiningsTreeExpander = New MachiningTreeExpanderV
+ m_MachiningsTreeExpander.DataContext = New MachiningTreeExpanderVM
+ End If
+ Return m_MachiningsTreeExpander
+ End Get
+ End Property
+
+ Private m_SimulationExpander As SimulationExpanderV
+ Public ReadOnly Property SimulationExpander As ContentControl
+ Get
+ If IsNothing(m_SimulationExpander) Then
+ m_SimulationExpander = New SimulationExpanderV
+ m_SimulationExpander.DataContext = New SimulationExpanderVM
+ End If
+ Map.refSimulationExpanderVM.Simulation_IsEnabled = True
+ Return m_SimulationExpander
+ End Get
+ End Property
+
+ Private m_EstimationsExpander As EstimationsExpanderV
+ Public ReadOnly Property EstimationsExpander As ContentControl
+ Get
+ If IsNothing(m_EstimationsExpander) Then
+ m_EstimationsExpander = New EstimationsExpanderV
+ m_EstimationsExpander.DataContext = New EstimationsExpanderVM
+ End If
+ Map.refEstimationsExpanderVM.Estimation_IsEnabled =
+ (EgtUILib.GetPrivateProfileInt(S_ESTIMATIONS, K_EST_ENABLE, 0, IniFile.m_sCurrMachIniFilePath) <> 0)
+ Return m_EstimationsExpander
+ End Get
+ End Property
+
+ 'Expander aperto tra quelli presenti nel MachiningOptionPanel
+ Friend Enum MachiningOptionPanelExpander
+ NONE
+ OPERATIONLIST
+ OPERATIONPARAMETERS
+ NEWMACHININGS
+ SIMULATION
+ ESTIMATIONS
+ End Enum
+
+ Friend Sub Set_IsExpanded(exp As MachiningOptionPanelExpander, flag As Boolean)
+ If flag Then
+ OpenExpander = exp
+ Else
+ ' se il flag passato è False vuol dire che nessun Expander è attualmente aperto
+ OpenExpander = MachiningOptionPanelExpander.NONE
+ End If
+ End Sub
+
+ Private m_OpenExpander As Integer = MachiningOptionPanelExpander.OPERATIONLIST
+ Public Property OpenExpander As Integer
+ Get
+ Return m_OpenExpander
+ End Get
+ Set(value As Integer)
+ Dim bOk As Boolean = False
+ ' Esco dallo stato corrente
+ Select Case m_OpenExpander
+ Case MachiningOptionPanelExpander.OPERATIONLIST
+ bOk = Map.refOperationsListExpanderVM.ExitOperationsList()
+ Case MachiningOptionPanelExpander.OPERATIONPARAMETERS
+ bOk = Map.refOperationParametersExpanderVM.ExitOperationParameters()
+ Case MachiningOptionPanelExpander.NEWMACHININGS
+ bOk = Map.refOperationsListExpanderVM.ExitOperationsList()
+ bOk = Map.refMachiningTreeExpanderVM.ExitMachiningTreeExpander()
+ Case MachiningOptionPanelExpander.SIMULATION
+ bOk = Map.refSimulationExpanderVM.ExitSimulation()
+ Case MachiningOptionPanelExpander.ESTIMATIONS
+ bOk = Map.refEstimationsExpanderVM.ExitEstimations()
+ Case MachiningOptionPanelExpander.NONE
+ bOk = True
+ End Select
+ If bOk Then
+ ' Entro nel nuovo stato
+ m_OpenExpander = value
+ Select Case m_OpenExpander
+ Case MachiningOptionPanelExpander.OPERATIONLIST
+ Map.refOperationsListExpanderVM.InitOperationsList()
+ Case MachiningOptionPanelExpander.OPERATIONPARAMETERS
+ Map.refOperationParametersExpanderVM.InitOperationParameters()
+ Case MachiningOptionPanelExpander.NEWMACHININGS
+ Map.refOperationsListExpanderVM.InitOperationsList()
+ Map.refMachiningTreeExpanderVM.InitMachiningTreeExpander()
+ Case MachiningOptionPanelExpander.SIMULATION
+ Map.refSimulationExpanderVM.InitSimulation()
+ Case MachiningOptionPanelExpander.ESTIMATIONS
+ Map.refEstimationsExpanderVM.InitEstimations()
+ End Select
+ OnPropertyChanged("OpenExpander")
+ End If
+ End Set
+ End Property
+
+ Public ReadOnly Property GenerateIsEnabled As Boolean
+ Get
+ Return Not Map.refSimulationExpanderVM.Simulation_IsExpanded
+ End Get
+ End Property
+
+#Region "Messages"
+
+ Public ReadOnly Property GenerateMsg As String
+ Get
+ Return EgtMsg(MSG_SIMULATION + 30) 'GENERA
+ End Get
+ End Property
+
+#End Region
+
+#Region "CONSTRUCTOR"
+
+ Sub New()
+ ' Creo riferimento a questa classe in Map
+ Map.SetRefMachiningOptionPanelVM(Me)
+ End Sub
+
+#End Region ' CONSTRUCTOR
+
+#Region "METHODS"
+
+ Friend Function InitMachiningOptionPanel() As Boolean
+ 'EgtZoom(ZM.ALL)
+ Return True
+ End Function
+
+ Friend Function ExitMachiningOptionPanel() As Boolean
+
+ Return True
+ End Function
+
+#End Region ' METHODS
+
+#Region "COMMANDS"
+
+ ' Definizione comandi
+ Private m_cmdGenerate As ICommand
+
+#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
+
+ '''
+ ''' Creata the new tool. This method is invoked by the NewCommand.
+ '''
+ Public Sub Generate(ByVal param As Object)
+ Map.refSimulationExpanderVM.Generate(param)
+ End Sub
+
+#End Region ' GenerateCommand
+
+#End Region ' COMMANDS
+
+End Class
\ No newline at end of file
diff --git a/OptionPanel/OptionPanelV.xaml b/OptionPanel/OptionPanelV.xaml
index 9dd03fc..856c8f2 100644
--- a/OptionPanel/OptionPanelV.xaml
+++ b/OptionPanel/OptionPanelV.xaml
@@ -4,13 +4,10 @@
xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5"
xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity">
-
-
-
-
-
-
-
-
+
+
+
+
+
diff --git a/OptionPanel/OptionPanelVM.vb b/OptionPanel/OptionPanelVM.vb
index d7c1a6b..41d0395 100644
--- a/OptionPanel/OptionPanelVM.vb
+++ b/OptionPanel/OptionPanelVM.vb
@@ -7,89 +7,64 @@ Public Class OptionPanelVM
Private m_MachiningIsChecked As Boolean = False
- ' 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
- Return m_ManageLayerExpander
- Else
- If IsNothing(m_OperationExpander) Then
- m_OperationExpander = New OperationExpanderV With {
- .DataContext = New OperationExpanderVM}
- End If
- Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, GDB_ID.NULL)
- Return m_OperationExpander
- End If
- End Get
- End Property
-
- 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
- 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
-
- 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
- Map.refSimulationExpanderVM.Estimation_IsEnabled =
- (EgtUILib.GetPrivateProfileInt(S_ESTIMATIONS, K_EST_ENABLE, 0, IniFile.m_sCurrMachIniFilePath) <> 0)
- Return m_SimulationExpander
- End If
- End Get
- End Property
-
Sub New()
+ Map.SetRefOptionPanelVM(Me)
+
Application.Msn.Register(Application.MACHININGMODE_ISCHECKED, Sub()
m_DrawIsChecked = False
m_MachiningIsChecked = True
EgtZoom(ZM.ALL, False)
- OnPropertyChanged("ManageLayerExpander")
- OnPropertyChanged("InfoExpander")
- OnPropertyChanged("InputExpander")
+
+ OnPropertyChanged("ModePanel")
End Sub)
Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub()
m_DrawIsChecked = True
m_MachiningIsChecked = False
- Application.Msn.NotifyColleagues(Application.SIMULATIONEXPANDER_SET_ISEXPANDED, False)
- Application.Msn.NotifyColleagues(Application.ESTIMATIONSEXPANDER_SET_ISEXPANDED, False)
- OnPropertyChanged("ManageLayerExpander")
- OnPropertyChanged("InfoExpander")
- OnPropertyChanged("InputExpander")
+ If Not IsNothing(Map.refSimulationExpanderVM) AndAlso
+ Not IsNothing(Map.refEstimationsExpanderVM) Then
+ Map.refSimulationExpanderVM.Simulation_IsExpanded = False
+ Map.refEstimationsExpanderVM.Estimation_IsExpanded = False
+ End If
+
+ OnPropertyChanged("ModePanel")
End Sub)
+ DrawOptPanelV = New DrawOptionPanelV
+ MachOptPanelV = New MachiningOptionPanelV
+
End Sub
+ Dim DrawOptPanelV As DrawOptionPanelV
+ Dim MachOptPanelV As MachiningOptionPanelV
+
+ Dim DrawOptPanelVM As New DrawOptionPanelVM
+ Dim MachOptPanelVM As New MachiningOptionPanelVM
+
+ Public ReadOnly Property ModePanel As ContentControl
+ Get
+
+ DrawOptPanelV.DataContext = Nothing
+ MachOptPanelV.DataContext = Nothing
+
+ If Not IsNothing(Map.refDrawOptionPanelVM) And Not IsNothing(Map.refMachiningOptionPanelVM) Then
+
+ If m_DrawIsChecked And Not m_MachiningIsChecked Then
+ Map.refMachiningOptionPanelVM.ExitMachiningOptionPanel()
+ Map.refDrawOptionPanelVM.InitDrawOptionPanel()
+ DrawOptPanelV.DataContext = Map.refDrawOptionPanelVM
+ Return DrawOptPanelV
+ End If
+ If m_MachiningIsChecked And Not m_DrawIsChecked Then
+ Map.refDrawOptionPanelVM.ExitDrawOptionPanel()
+ Map.refMachiningOptionPanelVM.InitMachiningOptionPanel()
+ MachOptPanelV.DataContext = Map.refMachiningOptionPanelVM
+ Return MachOptPanelV
+ End If
+
+ End If
+
+ Return Nothing
+ End Get
+ End Property
+
End Class
\ No newline at end of file
diff --git a/OptionsWindow/OptionWindowVM.vb b/OptionsWindow/OptionWindowVM.vb
index 289032a..c387f93 100644
--- a/OptionsWindow/OptionWindowVM.vb
+++ b/OptionsWindow/OptionWindowVM.vb
@@ -1054,7 +1054,7 @@ Public Class OptionWindowVM
' Rimuovo il direttorio temporaneo
My.Computer.FileSystem.DeleteDirectory( sTempDir, FileIO.DeleteDirectoryOption.DeleteAllContents)
' Aggiorno la lista delle macchina
- Map.refStatusBarVM.InsertMachine( sMachDir)
+ Map.refMachinePanelVM.InsertMachine(sMachDir)
End Sub
#End Region ' AddMachine
diff --git a/Project/ProjectV.xaml b/Project/ProjectV.xaml
index 18d8e8a..ca32753 100644
--- a/Project/ProjectV.xaml
+++ b/Project/ProjectV.xaml
@@ -4,88 +4,98 @@
xmlns:local="clr-namespace:EgtCAM5"
xmlns:EgtWPFLib5="clr-namespace:EgtWPFLib5;assembly=EgtWPFLib5"
xmlns:EgtFloating="clr-namespace:EgtWPFLib5.EgtFloating;assembly=EgtWPFLib5"
- xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity">
-
-
-
-
-
-
+ xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
+ -->
+
+
+
+
+
+
diff --git a/Project/ProjectV.xaml.vb b/Project/ProjectV.xaml.vb
index c7f1410..cce5d1a 100644
--- a/Project/ProjectV.xaml.vb
+++ b/Project/ProjectV.xaml.vb
@@ -13,7 +13,7 @@ Public Class ProjectV
WallPanel.Visibility = Visibility.Collapsed
DoorsPanel.Visibility = Visibility.Collapsed
GunStockPanel.Visibility = Visibility.Collapsed
- MachGroupPanel.Visibility = Visibility.Collapsed
+ Map.refMachGroupPanelVM.SetMachGroupPanelVisibility(False) ' MachGroupPanel.Visibility = Visibility.Collapsed
End Sub
Private Sub UserControl_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
@@ -36,7 +36,7 @@ Public Class ProjectV
GunStockPanel.IsFloating = False
DrawPanel.IsFloating = False
OptionPanel.IsFloating = False
- MachGroupPanel.IsFloating = False
+ ' MachGroupPanel.IsFloating = False
' Carico Pannelli Speciali
m_bSpecial = IniFile.IsActiveSpecialPanel()
m_bBeam = IniFile.IsActiveBeam()
@@ -58,7 +58,7 @@ Public Class ProjectV
GunStockPanel.Visibility = If(m_bGunStock, Visibility.Visible, Visibility.Collapsed)
DrawPanel.Visibility = Visibility.Visible
OptionPanel.Visibility = Visibility.Visible
- MachGroupPanel.Visibility = Visibility.Collapsed
+ Map.refMachGroupPanelVM.SetMachGroupPanelVisibility(False) ' MachGroupPanel.Visibility = Visibility.Collapsed
End Sub)
Application.Msn.Register(Application.MACHININGMODE_ISCHECKED, Sub()
'ShowPanel.Visibility = Visibility.Visible
@@ -75,7 +75,7 @@ Public Class ProjectV
GunStockPanel.Visibility = Visibility.Collapsed
DrawPanel.Visibility = Visibility.Collapsed
OptionPanel.Visibility = Visibility.Visible
- MachGroupPanel.Visibility = If(IniFile.m_bMachiningGroup, Visibility.Visible, Visibility.Collapsed)
+ Map.refMachGroupPanelVM.SetMachGroupPanelVisibility(IniFile.m_bMachiningGroup) ' MachGroupPanel.Visibility = If(IniFile.m_bMachiningGroup, Visibility.Visible, Visibility.Collapsed)
End Sub)
Application.Msn.Register(Application.DBPANELVISIBILITY, Sub()
DbPanel.Visibility = If(IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW, Visibility.Collapsed, Visibility.Visible)
diff --git a/Project/ProjectVM.vb b/Project/ProjectVM.vb
index af68299..e7d44ed 100644
--- a/Project/ProjectVM.vb
+++ b/Project/ProjectVM.vb
@@ -94,12 +94,12 @@ Public Class ProjectVM
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.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)
@@ -364,7 +364,7 @@ Public Class ProjectVM
If Environment.GetCommandLineArgs.Count() > 3 Then Integer.TryParse(Environment.GetCommandLineArgs(3), nFlag)
Dim bOk As Boolean = False
' Verifico se travi o pareti (per ora dal nome della macchina)
- Dim bBeam As Boolean = ( sMachine = "FAST" OrElse sMachine = "ONE")
+ Dim bBeam As Boolean = (sMachine = "FAST" OrElse sMachine = "ONE")
If bBeam Then
' Verifica abilitazione elaborazione travi
If Not VerifyBeam(sFile, sMachine, nFlag) Then
@@ -373,7 +373,7 @@ Public Class ProjectVM
End If
' Esecuzione
bOk = ExecBeam(sFile, sMachine, nFlag)
- ' altrimenti pareti
+ ' altrimenti pareti
Else
' Verifica abilitazione elaborazione pareti
If Not VerifyWall(sFile, sMachine, nFlag) Then
@@ -387,14 +387,14 @@ Public Class ProjectVM
If nFlag = 0 Or nFlag = 3 Or nFlag = 4 Then
Application.Msn.NotifyColleagues(Application.SAVECURRENTMACHINE)
Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATIONCOMMAND)
- ' Altrimenti se richiesta visualizzazione DB utensili
+ ' Altrimenti se richiesta visualizzazione DB utensili
ElseIf nFlag = 11 And bOk Then
- MachinePanelVM.ToolDb()
+ MyMachinePanelVM.ToolDb()
Application.Msn.NotifyColleagues(Application.SAVECURRENTMACHINE)
Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATIONCOMMAND)
- ' Altrimenti se richiesta visualizzazione DB lavorazioni
+ ' Altrimenti se richiesta visualizzazione DB lavorazioni
ElseIf nFlag = 12 And bOk Then
- MachinePanelVM.MachDb()
+ MyMachinePanelVM.MachDb()
If bBeam Then
Beam.BeamMachDb()
Else
@@ -402,7 +402,7 @@ Public Class ProjectVM
End If
Application.Msn.NotifyColleagues(Application.SAVECURRENTMACHINE)
Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATIONCOMMAND)
- ' Altrimenti se errore
+ ' Altrimenti se errore
ElseIf Not bOk Then
EgtZoom(ZM.ALL)
End If
@@ -1122,7 +1122,7 @@ Public Class ProjectVM
bOk = False
End If
Case SceneSelTypeOpt.MACHPATH
- bOk = Map.refOperationExpanderVM.IsInOperationList(nId)
+ bOk = Map.refOperationsListExpanderVM.IsInOperationList(nId)
Case Else
bOk = False
End Select
@@ -1130,7 +1130,7 @@ Public Class ProjectVM
Private Sub OnMouseSelectedObj(ByVal sender As Object, ByVal nId As Integer, ByVal bLast As Boolean) Handles m_ProjectScene.OnMouseSelectedObj
If IniFile.m_ProjectMode = ProjectModeOpt.MACHINING And m_SceneSelType = SceneSelTypeOpt.MACHPATH Then
- Map.refOperationExpanderVM.SelOperationItemFromId(nId)
+ Map.refOperationsListExpanderVM.SelOperationItemFromId(nId)
Else
If IniFile.m_ProjectMode = ProjectModeOpt.MACHINING And m_SceneSelType = SceneSelTypeOpt.MACHINING And
(EgtGetType(nId) = GDB_TY.SRF_MESH Or EgtGetType(nId) = GDB_TY.SRF_FRGN) Then
diff --git a/Special-BeamWall/Beam.vb b/Special-BeamWall/Beam.vb
index dfbf0a5..930e65d 100644
--- a/Special-BeamWall/Beam.vb
+++ b/Special-BeamWall/Beam.vb
@@ -55,7 +55,7 @@ Module Beam
If EgtGetCurrMachGroup() <> GDB_ID.NULL Then
Application.Msn.NotifyColleagues(Application.SETMACHININGMODE)
If bOk And nFlag = 2 Then
- Map.refSimulationExpanderVM.IsExpanded = True
+ Map.refSimulationExpanderVM.Simulation_IsExpanded = True
End If
End If
Return bOk
diff --git a/Special-BeamWall/Wall.vb b/Special-BeamWall/Wall.vb
index f92628f..f72f4b5 100644
--- a/Special-BeamWall/Wall.vb
+++ b/Special-BeamWall/Wall.vb
@@ -55,7 +55,7 @@ Module Wall
If EgtGetCurrMachGroup() <> GDB_ID.NULL Then
Application.Msn.NotifyColleagues(Application.SETMACHININGMODE)
If bOk And nFlag = 2 Then
- Map.refSimulationExpanderVM.IsExpanded = True
+ Map.refSimulationExpanderVM.Simulation_IsExpanded = True
End If
End If
Return bOk
diff --git a/StatusBar/MyStatusBarVM.vb b/StatusBar/MyStatusBarVM.vb
new file mode 100644
index 0000000..b8b926b
--- /dev/null
+++ b/StatusBar/MyStatusBarVM.vb
@@ -0,0 +1,602 @@
+Imports System.Collections.ObjectModel
+Imports System.Runtime.InteropServices
+Imports System.IO
+Imports EgtUILib
+Imports System.Threading
+Imports EgtWPFLib5
+
+Public Class MyStatusBarVM
+ Inherits StatusBarVM
+
+#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)
+
+ ' 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
+ ' NotifyPropertyChanged("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
+ ' NotifyPropertyChanged("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
+ ' NotifyPropertyChanged("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
+ ' NotifyPropertyChanged("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
+ NotifyPropertyChanged("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
+ NotifyPropertyChanged("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
+ NotifyPropertyChanged("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
+ ' NotifyPropertyChanged("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
+ ' NotifyPropertyChanged("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
+ ' NotifyPropertyChanged("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 IsNothing(value) Then
+ ' m_SelectedMachine = Nothing
+ ' ElseIf 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()
+ ' NotifyPropertyChanged("SelectedMachine")
+ ' End If
+ ' 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
+ ' NotifyPropertyChanged("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_cmdClearOutputMessage 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)
+ SetCurrPos(sCursorPos)
+ End Sub)
+ Application.Msn.Register(Application.NOTIFYSTATUSOUTPUT, Sub(sStatusOutput As String)
+ SetOutputMessage(sStatusOutput)
+ End Sub)
+ Application.Msn.Register(Application.NOTIFYSTATUSPROGRESS, Sub(sStatusProgress As Integer)
+ SetLoadingProgress(sStatusProgress)
+ End Sub)
+ Application.Msn.Register(Application.NOTIFYSTATUSSTOP, Sub(sStatusStop As Boolean)
+ SetStopProgress_IsEnabled(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)
+ SetMeasureUnit(If(bMmUnits, 1, 0)) 'StatusUnitsText = If(bMmUnits, "mm", "in")
+ EgtSetUiUnits(bMmUnits)
+ End Sub)
+ Application.Msn.Register(Application.STATUSSNAPPOINTTYPETEXT, Sub(sString As String)
+ SetSnapPointType(sString)
+ End Sub)
+ Application.Msn.Register(Application.STATUSSNAPPOINTTYPEBACKGROUND, Sub(Color As SolidColorBrush)
+ SetSnapPointType_Background(Color)
+ End Sub)
+ 'SearchMachines()
+ '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.MACHININGMODE_ISCHECKED, Sub()
+ OutputMessage = String.Empty
+ 'MachineListIsEnabled = False
+ End Sub)
+ Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub()
+ OutputMessage = 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
+
+#Region "COMMANDS"
+
+#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)
+ 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)
+ 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
+ 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
+
+ '''
+ ''' 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)
+ 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
+
+ '''
+ ''' Execute the Point. This method is invoked by the StatusStopCommand.
+ '''
+ Public Sub StatusStop(ByVal param As Object)
+ m_bStopScript = True
+ End Sub
+
+#End Region ' StatusStopCommand
+
+#Region "ClearOutputMessageCommand"
+
+ '''
+ ''' Returns a command that choose the current reference.
+ '''
+ Public Overrides ReadOnly Property ClearOutputMessage_Command As ICommand
+ Get
+ If m_cmdClearOutputMessage Is Nothing Then
+ m_cmdClearOutputMessage = New RelayCommand(AddressOf ClearOutputMessage)
+ End If
+ Return m_cmdClearOutputMessage
+ End Get
+ End Property
+
+ '''
+ ''' Execute the Point. This method is invoked by the ClearOutPutMessage_Command.
+ '''
+ Public Overloads Sub ClearOutputMessage(ByVal param As Object)
+ OutputMessage = String.Empty
+ SetLoadingProgress(0)
+ NotifyPropertyChanged("OutputMessage")
+ End Sub
+
+#End Region ' ClearStatusOutputCommand
+
+#End Region ' Commands
+
+#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
+
+ ''''
+ '''' Method that search the machines in the correct folder and add to the MachinesList those valid.
+ ''''
+ 'Private Sub SearchMachines()
+ ' ' Svuoto la lista delle macchine
+ ' m_MachinesList.Clear()
+ ' ' 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
+ ' AddMachine(TempArray(i))
+ ' Next
+ ' If m_MachinesList.Count = 0 Then
+ ' IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW
+ ' EgtOutLog(EgtMsg(MSG_STATUSBAR + 1))
+ ' Return
+ ' End If
+ 'End Sub
+
+ 'Private Function AddMachine(sPath As String) As Boolean
+ ' ' Verifico presenza file caratteristici
+ ' Dim sName As String = Path.GetFileName(sPath)
+ ' Dim MachineIniPath As String = sPath & "\" & sName & ".ini"
+ ' Dim MachineMldePath As String = sPath & "\" & sName & ".mlde"
+ ' If Not File.Exists(MachineIniPath) Or Not File.Exists(MachineMldePath) Then Return False
+ ' ' Aggiungo alla lista
+ ' m_MachinesList.Add(New Machine With {.Name = sName, .MachineDirPath = sPath})
+ ' Return True
+ 'End Function
+
+ 'Friend Function InsertMachine(sPath As String) As Boolean
+ ' ' Verifico presenza file caratteristici
+ ' Dim sName As String = Path.GetFileName(sPath)
+ ' Dim MachineIniPath As String = sPath & "\" & sName & ".ini"
+ ' Dim MachineMldePath As String = sPath & "\" & sName & ".mlde"
+ ' If Not File.Exists(MachineIniPath) Or Not File.Exists(MachineMldePath) Then Return False
+ ' ' Cerco la posizione di inserimento
+ ' Dim nPos As Integer = 0
+ ' For nI As Integer = 0 To m_MachinesList.Count() - 1
+ ' Dim nRes As Integer = String.Compare(sName, m_MachinesList(nI).Name, True)
+ ' If nRes = 0 Then
+ ' Return True
+ ' ElseIf nRes < 0 Then
+ ' Exit For
+ ' Else
+ ' nPos += 1
+ ' End If
+ ' Next
+ ' ' Inserisco nella lista
+ ' m_MachinesList.Insert(nPos, New Machine With {.Name = sName, .MachineDirPath = sPath})
+ ' Return True
+ 'End Function
+
+ ''''
+ '''' 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
+
+ ' 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
+ OutputMessage = (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 SetLoadingProgress(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 1
+ Else
+ Return 0
+ End If
+ End Function
+
+ Public Sub SetSnapPointType_Background(SnapPntTypeBackground As SolidColorBrush)
+ SnapPointType_Background = SnapPntTypeBackground
+ NotifyPropertyChanged("SnapPointType_Background")
+ End Sub
+
+#End Region ' Methods
+
+End Class
\ No newline at end of file
diff --git a/StatusBar/StatusBarV.xaml b/StatusBar/StatusBarV.xaml
index 7a4a469..6c32863 100644
--- a/StatusBar/StatusBarV.xaml
+++ b/StatusBar/StatusBarV.xaml
@@ -29,20 +29,20 @@
-
+
+ IsEnabled="{Binding StopProgress_IsEnabled}" Width="20"/>
-
+
-
+
-
+
@@ -64,16 +64,10 @@
-
+
-
-
-
-
-
+
diff --git a/TopCommandBar/TopCommandBarVM.vb b/TopCommandBar/TopCommandBarVM.vb
index a839358..a652ca7 100644
--- a/TopCommandBar/TopCommandBarVM.vb
+++ b/TopCommandBar/TopCommandBarVM.vb
@@ -185,7 +185,7 @@ Public Class TopCommandBarVM
ExecInitMachScript()
' Inizializzazione gruppo/i di lavoro
Dim bAllowEmpty As Boolean = (Keyboard.IsKeyDown(Key.LeftShift) OrElse Keyboard.IsKeyDown(Key.RightShift))
- Application.Msn.NotifyColleagues(Application.INITIALIZEMACHGROUPS, bAllowEmpty)
+ Map.refMachGroupPanelVM.InitMachGroupList(bAllowEmpty)
' Se non riuscito il passaggio al Machining, lancio lo script di uscita
If EgtGetCurrMachGroup() = GDB_ID.NULL Then
ExecExitMachScript()
@@ -193,7 +193,7 @@ Public Class TopCommandBarVM
' altrimenti, aggiusto...
Else
' se parametri di una lavorazione aperti, disattivo database utensili, lavorazioni e setup
- Dim MachinePanelIsEnabled As Boolean = Not Map.refOperationExpanderVM.ParametersIsExpanded
+ Dim MachinePanelIsEnabled As Boolean = Not Map.refOperationParametersExpanderVM.ParametersIsExpanded
Map.refMachinePanelVM.ToolMachSetUpIsEnabled(MachinePanelIsEnabled, MachinePanelIsEnabled, MachinePanelIsEnabled)
End If
Else
@@ -283,9 +283,6 @@ Public Class TopCommandBarVM
MachiningIsEnabled = True
End If
End Sub)
- Application.Msn.Register(Application.SETDRAWISENABLED, Sub(DrawIsEnabled As Boolean)
- Me.DrawIsEnabled = DrawIsEnabled
- End Sub)
End Sub
#End Region
diff --git a/Utility/Dictionary.xaml b/Utility/Dictionary.xaml
index 313162d..66f3468 100644
--- a/Utility/Dictionary.xaml
+++ b/Utility/Dictionary.xaml
@@ -29,7 +29,7 @@
-
+
@@ -37,14 +37,15 @@
-
-
+
+
+
-
+
diff --git a/Utility/Map.vb b/Utility/Map.vb
index e9f578b..c721d14 100644
--- a/Utility/Map.vb
+++ b/Utility/Map.vb
@@ -1,15 +1,25 @@
-Module Map
+Imports EgtWPFLib5
+
+Module Map
#Region "Program ViewModel Map"
Private m_refMainWindowVM As MainWindowVM
- Private m_refStatusBarVM As StatusBarVM
+ 'Private m_refStatusBarVM As StatusBarVM
Private m_refTopCommandBarVM As TopCommandBarVM
Private m_refProjectVM As ProjectVM
Private m_refFixtureParametersVM As FixtureParametersVM
Private m_refSimulationExpanderVM As SimulationExpanderVM
- Private m_refMachinePanelVM As MachinePanelVM
- Private m_refOperationExpanderVM As OperationExpanderVM
+ Private m_refMachinePanelVM As MyMachinePanelVM
+ Private m_refOptionPanelVM As OptionPanelVM
+ Private m_refDrawOptionPanelVM As DrawOptionPanelVM
+ Private m_refMachiningOptionPanelVM As MachiningOptionPanelVM
+ Private m_refEstimationsExpanderVM As EstimationsExpanderVM
+ Private m_refOperationsListExpanderVM As OperationsListExpanderVM
+ Private m_refOperationParametersExpanderVM As OperationParametersExpanderVM
+ Private m_refMachiningTreeExpanderVM As MachiningTreeExpanderVM
+ 'Private m_refMachGroupPanelVM As MachGroupPanelVM
+ Private m_refInstrumentPanelVM As InstrumentPanelVM
#Region "Get"
@@ -18,9 +28,9 @@
Return m_refMainWindowVM
End Get
End Property
- Public ReadOnly Property refStatusBarVM As StatusBarVM
+ Public ReadOnly Property refStatusBarVM As MyStatusBarVM
Get
- Return m_refStatusBarVM
+ Return LibMap.refStatusBarVM
End Get
End Property
Public ReadOnly Property refTopCommandBarVM As TopCommandBarVM
@@ -43,14 +53,54 @@
Return m_refSimulationExpanderVM
End Get
End Property
- Public ReadOnly Property refMachinePanelVM As MachinePanelVM
+ Public ReadOnly Property refMachinePanelVM As MyMachinePanelVM
Get
Return m_refMachinePanelVM
End Get
End Property
- Public ReadOnly Property refOperationExpanderVM As OperationExpanderVM
+ Public ReadOnly Property refOptionPanelVM As OptionPanelVM
Get
- Return m_refOperationExpanderVM
+ Return m_refOptionPanelVM
+ End Get
+ End Property
+ Public ReadOnly Property refDrawOptionPanelVM As DrawOptionPanelVM
+ Get
+ Return m_refDrawOptionPanelVM
+ End Get
+ End Property
+ Public ReadOnly Property refMachiningOptionPanelVM As MachiningOptionPanelVM
+ Get
+ Return m_refMachiningOptionPanelVM
+ End Get
+ End Property
+ Public ReadOnly Property refEstimationsExpanderVM As EstimationsExpanderVM
+ Get
+ Return m_refEstimationsExpanderVM
+ End Get
+ End Property
+ Public ReadOnly Property refOperationsListExpanderVM As OperationsListExpanderVM
+ Get
+ Return m_refOperationsListExpanderVM
+ End Get
+ End Property
+ Public ReadOnly Property refOperationParametersExpanderVM As OperationParametersExpanderVM
+ Get
+ Return m_refOperationParametersExpanderVM
+ End Get
+ End Property
+ Public ReadOnly Property refMachiningTreeExpanderVM As MachiningTreeExpanderVM
+ Get
+ Return m_refMachiningTreeExpanderVM
+ End Get
+ End Property
+ Public ReadOnly Property refMachGroupPanelVM As MyMachGroupPanelVM
+ Get
+ Return LibMap.refMachGroupPanelVM
+ End Get
+ End Property
+ Public ReadOnly Property refInstrumentPanelVM As InstrumentPanelVM
+ Get
+ Return m_refInstrumentPanelVM
End Get
End Property
@@ -58,9 +108,9 @@
#Region "Set"
- Friend Function SetRefStatusBarVM(StatusBarVM As StatusBarVM) As Boolean
- m_refStatusBarVM = StatusBarVM
- Return Not IsNothing(m_refStatusBarVM)
+ Friend Function SetRefStatusBarVM(StatusBarVM As MyStatusBarVM) As Boolean
+ LibMap.SetRefStatusBarVM(StatusBarVM)
+ Return Not IsNothing(LibMap.refStatusBarVM)
End Function
Friend Function SetRefTopCommandBarVM(TopCommandBarVM As TopCommandBarVM) As Boolean
m_refTopCommandBarVM = TopCommandBarVM
@@ -78,13 +128,45 @@
m_refSimulationExpanderVM = SimulationExpanderVM
Return Not IsNothing(m_refSimulationExpanderVM)
End Function
- Friend Function SetRefMachinePanelVM(MachinePanelVM As MachinePanelVM) As Boolean
+ Friend Function SetRefMachinePanelVM(MachinePanelVM As MyMachinePanelVM) As Boolean
m_refMachinePanelVM = MachinePanelVM
Return Not IsNothing(m_refMachinePanelVM)
End Function
- Friend Function SetRefOperationExpanderVM(OperationExpanderVM As OperationExpanderVM) As Boolean
- m_refOperationExpanderVM = OperationExpanderVM
- Return Not IsNothing(m_refOperationExpanderVM)
+ Friend Function SetRefOptionPanelVM(OptionPanelVM As OptionPanelVM) As Boolean
+ m_refOptionPanelVM = OptionPanelVM
+ Return Not IsNothing(m_refOptionPanelVM)
+ End Function
+ Friend Function SetRefDrawOptionPanelVM(DrawOptionPanelVM As DrawOptionPanelVM) As Boolean
+ m_refDrawOptionPanelVM = DrawOptionPanelVM
+ Return Not IsNothing(m_refDrawOptionPanelVM)
+ End Function
+ Friend Function SetRefMachiningOptionPanelVM(MachiningOptionPanelVM As MachiningOptionPanelVM) As Boolean
+ m_refMachiningOptionPanelVM = MachiningOptionPanelVM
+ Return Not IsNothing(m_refMachiningOptionPanelVM)
+ End Function
+ Friend Function SetRefEstimationsExpanderVM(EstimationsExpanderVM As EstimationsExpanderVM) As Boolean
+ m_refEstimationsExpanderVM = EstimationsExpanderVM
+ Return Not IsNothing(m_refEstimationsExpanderVM)
+ End Function
+ Friend Function SetRefOperationsListExpanderVM(OperationsListExpanderVM As OperationsListExpanderVM) As Boolean
+ m_refOperationsListExpanderVM = OperationsListExpanderVM
+ Return Not IsNothing(m_refOperationsListExpanderVM)
+ End Function
+ Friend Function SetRefOperationParametersExpanderVM(OperationParametersExpanderVM As OperationParametersExpanderVM) As Boolean
+ m_refOperationParametersExpanderVM = OperationParametersExpanderVM
+ Return Not IsNothing(m_refOperationParametersExpanderVM)
+ End Function
+ Friend Function SetRefMachiningTreeExpanderVM(MachiningTreeExpanderVM As MachiningTreeExpanderVM) As Boolean
+ m_refMachiningTreeExpanderVM = MachiningTreeExpanderVM
+ Return Not IsNothing(m_refMachiningTreeExpanderVM)
+ End Function
+ Friend Function SetRefMachGroupPanelVM(MachGroupPanelVM As MyMachGroupPanelVM) As Boolean
+ LibMap.SetRefMachGroupPanelVM(MachGroupPanelVM)
+ Return Not IsNothing(LibMap.refMachGroupPanelVM)
+ End Function
+ Friend Function SetRefInstrumentPanelVM(InstrumentPanelVM As InstrumentPanelVM) As Boolean
+ m_refInstrumentPanelVM = InstrumentPanelVM
+ Return Not IsNothing(m_refInstrumentPanelVM)
End Function
#End Region ' Set
@@ -97,8 +179,12 @@
End Function
Friend Function EndInit() As Boolean
' Verifico se tutti i pezzi necessari sono stati caricati
- Return Not IsNothing(m_refMainWindowVM) AndAlso Not IsNothing(m_refStatusBarVM) AndAlso Not IsNothing(m_refProjectVM) AndAlso Not IsNothing(m_refTopCommandBarVM) AndAlso
- Not IsNothing(m_refFixtureParametersVM) AndAlso Not IsNothing(m_refSimulationExpanderVM) AndAlso Not IsNothing(m_refMachinePanelVM) AndAlso Not IsNothing(m_refOperationExpanderVM)
+ Return Not IsNothing(m_refMainWindowVM) AndAlso Not IsNothing(LibMap.refStatusBarVM) AndAlso Not IsNothing(m_refProjectVM) AndAlso Not IsNothing(m_refTopCommandBarVM) AndAlso
+ Not IsNothing(m_refFixtureParametersVM) AndAlso Not IsNothing(m_refSimulationExpanderVM) AndAlso Not IsNothing(m_refMachinePanelVM) AndAlso
+ Not IsNothing(m_refOptionPanelVM) AndAlso Not IsNothing(m_refDrawOptionPanelVM) AndAlso Not IsNothing(m_refMachiningOptionPanelVM) AndAlso
+ Not IsNothing(m_refEstimationsExpanderVM) AndAlso Not IsNothing(m_refOperationsListExpanderVM) AndAlso
+ Not IsNothing(m_refOperationParametersExpanderVM) AndAlso Not IsNothing(m_refMachiningTreeExpanderVM) AndAlso
+ Not IsNothing(LibMap.refMachGroupPanelVM) AndAlso Not IsNothing(m_refInstrumentPanelVM)
End Function
#End Region ' Init
diff --git a/Utility/SelData.vb b/Utility/SelData.vb
index 8362fb5..8cb0e85 100644
--- a/Utility/SelData.vb
+++ b/Utility/SelData.vb
@@ -127,8 +127,8 @@ Module SelData
If m_SelGrpId = GDB_ID.NULL Then Return
Dim bEnMod As Boolean = EgtGetEnableModified()
EgtDisableModified()
- EgtUnselectableRemove( m_SelGrpId)
- EgtErase( m_SelGrpId)
+ EgtUnselectableRemove(m_SelGrpId)
+ EgtErase(m_SelGrpId)
m_SelGrpId = GDB_ID.NULL
If bEnMod Then EgtEnableModified()
End Sub