From d1a8f033db95ae1a8a551177fd58be9d36d5e3be Mon Sep 17 00:00:00 2001 From: DarioS Date: Tue, 13 Sep 2022 08:59:25 +0200 Subject: [PATCH] OmagOFFICE 2.4i2 : - prime modifiche per direttori multipli di base delle macchine. --- MachinePanel/MyMachinePanelVM.vb | 21 +++++++------------- MainWindow/MainWindowM.vb | 4 +--- My Project/AssemblyInfo.vb | 4 ++-- MyMachGroupPanel/MyMachGroupPanelVM.vb | 11 +++++++---- MySceneHost/MySceneHostVM.vb | 27 +++++++++++++++++++++++--- 5 files changed, 41 insertions(+), 26 deletions(-) diff --git a/MachinePanel/MyMachinePanelVM.vb b/MachinePanel/MyMachinePanelVM.vb index 4d44963..0c8e8be 100644 --- a/MachinePanel/MyMachinePanelVM.vb +++ b/MachinePanel/MyMachinePanelVM.vb @@ -95,26 +95,19 @@ Public Class MyMachinePanelVM OmagOFFICEMap.SetRefMachinePanelVM(Me) ' recupero cartella radice delle macchine m_sMachinesRoot = OmagOFFICEMap.refMainWindowVM.MainWindowM.sMachinesRoot - ' trasformo l'elenco dei direttori macchina in una stringa del tipo "..\Dir1\Example01|..\Dir2\|Example02" - Dim sMchRoots As String = m_sMachinesRoot - - '' Carica macchine da cartella delle macchine - 'For Each MachDir In OmagOFFICEMap.refMainWindowVM.MainWindowM.sMachinesRootList - ' sMchRoots &= MachDir & "|" - 'Next - '' rimuovo dalla stringa l'ultimo carattere inserito - 'sMchRoots = sMchRoots.Remove(sMchRoots.Length - 1, 1) - - ' procedo ad inizializzare la classe → carico la lista "MachineList" che visualizzo per l'inserimento di nuvoi MachGroup - Machine.MachineListInit(sMchRoots, MachineList) - ' Inizializzo valori visibilità parametri Db utensili e lavorazioni - OmagOFFICETMDbParamVisibility.Init() End Sub #End Region ' CONSTRUCTOR #Region "METHODS" + Public Sub Init( sMchRoots As String) + ' procedo ad inizializzare la classe → carico la lista "MachineList" che visualizzo per l'inserimento di nuovi MachGroup + Machine.MachineListInit(sMchRoots, MachineList) + ' Inizializzo valori visibilità parametri Db utensili e lavorazioni + OmagOFFICETMDbParamVisibility.Init() + End Sub + ''' ''' Execute the Exec. This method is invoked by the ExecCommand. ''' diff --git a/MainWindow/MainWindowM.vb b/MainWindow/MainWindowM.vb index 4a26a99..62af047 100644 --- a/MainWindow/MainWindowM.vb +++ b/MainWindow/MainWindowM.vb @@ -188,8 +188,7 @@ Public Class MainWindowM If GetMainPrivateProfileString(S_MACH, K_MACHINESDIR, "", m_sMachinesRoot) = 0 Then m_sMachinesRoot = m_sDataRoot & "\" & MACHINES_DFL_DIR End If - - ' carico eleco dei direttori + ' Carico elenco dei direttori macchina If Not String.IsNullOrEmpty(m_sMachinesRoot) Then m_sMachinesRootList.Add(m_sMachinesRoot) Dim nIndexDir As Integer = 1 Dim sCurrMachineDir As String = String.Empty @@ -199,7 +198,6 @@ Public Class MainWindowM End If nIndexDir += 1 End While - ' Impostazione direttorio per toolmakers If GetMainPrivateProfileString(S_MACH, K_TOOLMAKERSDIR, "", m_sToolMakersDir) = 0 Then m_sToolMakersDir = m_sDataRoot & "\" & TOOLMAKERS_DFL_DIR diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 8cf8fa0..7f7623c 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -69,6 +69,6 @@ Imports System.Windows ' by using the '*' as shown below: ' - - + + diff --git a/MyMachGroupPanel/MyMachGroupPanelVM.vb b/MyMachGroupPanel/MyMachGroupPanelVM.vb index 0606597..5aad441 100644 --- a/MyMachGroupPanel/MyMachGroupPanelVM.vb +++ b/MyMachGroupPanel/MyMachGroupPanelVM.vb @@ -33,18 +33,21 @@ Public Class MyMachGroupPanelVM Sub New() MyBase.New() - ' Recupero la macchina di default - Dim sDefaultMachine As String = String.Empty - GetMainPrivateProfileString(S_MACH, K_CURRMACH, "", sDefaultMachine) ' Creo riferimento a questa classe in OmagOFFICEMap OmagOFFICEMap.SetRefMachGroupPanelVM(Me) - InitMachGroupPanel(True, OmagOFFICEMap.refMachinePanelVM.MachineList.ToList(), sDefaultMachine, BASE_MACH_GROUP & "1") End Sub #End Region ' CONSTRUCTOR #Region "METHODS" + Public Sub Init() + ' Recupero la macchina di default + Dim sDefaultMachine As String = String.Empty + GetMainPrivateProfileString(S_MACH, K_CURRMACH, "", sDefaultMachine) + InitMachGroupPanel(True, OmagOFFICEMap.refMachinePanelVM.MachineList.ToList(), sDefaultMachine, BASE_MACH_GROUP & "1") + End Sub + Public Overrides Sub AddMachGroup() If NewMachGroup() Then ' creo oggetto gruppo creato diff --git a/MySceneHost/MySceneHostVM.vb b/MySceneHost/MySceneHostVM.vb index e71e47a..bcb8748 100644 --- a/MySceneHost/MySceneHostVM.vb +++ b/MySceneHost/MySceneHostVM.vb @@ -33,8 +33,13 @@ Public Class MySceneHostVM ' Recupero e imposto handle finestra principale Dim hMainWnd As IntPtr = New WindowInteropHelper(Application.Current.MainWindow).Handle EgtSetMainWindowHandle(hMainWnd) + ' Recupero l'elenco dei direttori radice macchina come stringa del tipo "..\Dir1\Example01|..\Dir2\|Example02" + Dim sMchRoots As String = GetMachineBaseDirs() ' inizializzo gestore lavorazioni - EgtInitMachMgr(OmagOFFICEMap.refMainWindowVM.MainWindowM.sMachinesRoot, OmagOFFICEMap.refMainWindowVM.MainWindowM.sToolMakersDir) + EgtInitMachMgr(sMchRoots, OmagOFFICEMap.refMainWindowVM.MainWindowM.sToolMakersDir) + ' inizializzo gestione più macchine + OmagOFFICEMap.refMachinePanelVM.Init(sMchRoots) + OmagOFFICEMap.refMachGroupPanelVM.Init() Return End If ' Problemi @@ -157,6 +162,18 @@ Public Class MySceneHostVM MainScene.SetStatusNull() End Sub + Private Function GetMachineBaseDirs() As String + ' Trasformo l'elenco dei direttori radice macchina in una stringa del tipo "..\Dir1\Example01|..\Dir2\|Example02" + Dim sMchRoots As String = "" + For Each MachDir In OmagOFFICEMap.refMainWindowVM.MainWindowM.sMachinesRootList + sMchRoots &= MachDir & "|" + Next + ' rimuovo dalla stringa l'ultimo carattere "|" inserito + sMchRoots = sMchRoots.Remove(sMchRoots.Length - 1, 1) + If String.IsNullOrEmpty( sMchRoots) Then sMchRoots = OmagOFFICEMap.refMainWindowVM.MainWindowM.sMachinesRoot + Return sMchRoots + End Function + #End Region ' METHODS #Region "ProjectManager" @@ -240,7 +257,9 @@ Public Class MySceneHostVM ' Creo un contesto separato con gestore lavorazioni per poter spezzettare il progetto Dim nCurrCtx As Integer = EgtGetCurrentContext() Dim nCtx As Integer = EgtInitContext() - EgtInitMachMgr(OmagOFFICEMap.refMainWindowVM.MainWindowM.sMachinesRoot, OmagOFFICEMap.refMainWindowVM.MainWindowM.sToolMakersDir) + ' Recupero l'elenco dei direttori radice macchina come stringa del tipo "..\Dir1\Example01|..\Dir2\|Example02" + Dim sMchRoots As String = GetMachineBaseDirs() + EgtInitMachMgr(sMchRoots, OmagOFFICEMap.refMainWindowVM.MainWindowM.sToolMakersDir) ' Per ogni gruppo di lavoro For Each nMchGrpId As Integer In vMchGrps ' Carico il progetto @@ -408,7 +427,9 @@ Public Class MySceneHostVM ' Creo un contesto separato con gestore lavorazioni per poter spezzettare il progetto Dim nCurrCtx As Integer = EgtGetCurrentContext() Dim nCtx As Integer = EgtInitContext() - EgtInitMachMgr(OmagOFFICEMap.refMainWindowVM.MainWindowM.sMachinesRoot, OmagOFFICEMap.refMainWindowVM.MainWindowM.sToolMakersDir) + ' Recupero l'elenco dei direttori radice macchina come stringa del tipo "..\Dir1\Example01|..\Dir2\|Example02" + Dim sMchRoots As String = GetMachineBaseDirs() + EgtInitMachMgr(sMchRoots, OmagOFFICEMap.refMainWindowVM.MainWindowM.sToolMakersDir) ' Per ogni gruppo di lavoro For Each nMchGrpId As Integer In vMchGrps ' Carico il progetto