diff --git a/AboutBoxWindow/AboutBoxV.xaml b/AboutBoxWindow/AboutBoxV.xaml index e13a4fa..2a93023 100644 --- a/AboutBoxWindow/AboutBoxV.xaml +++ b/AboutBoxWindow/AboutBoxV.xaml @@ -2,7 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="AboutBox" Height="320" Width="300" WindowStyle="None" ResizeMode="NoResize" - ShowInTaskbar="False" Visibility="{Binding AboutBoxVisibility,Mode=OneWay}" WindowStartupLocation="CenterOwner"> + ShowInTaskbar="False" WindowStartupLocation="CenterOwner"> diff --git a/CompoWindow/CompoManager/CompoManagerVM.vb b/CompoWindow/CompoManager/CompoManagerVM.vb index 6838006..f6cc4ee 100644 --- a/CompoWindow/CompoManager/CompoManagerVM.vb +++ b/CompoWindow/CompoManager/CompoManagerVM.vb @@ -193,7 +193,7 @@ Public Class CompoManagerVM bHasIntCompo = True End If ' Passo al contesto principale - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) ' Inserisco il componente nel DB geometrico principale If bHasIntCompo Then CompoWindowMap.refCompoWindowVM.MakeCompoInsert(InsNbr, m_PartName) diff --git a/CompoWindow/CompoWindowVM.vb b/CompoWindow/CompoWindowVM.vb index 69f23a0..fee20b3 100644 --- a/CompoWindow/CompoWindowVM.vb +++ b/CompoWindow/CompoWindowVM.vb @@ -310,7 +310,7 @@ Public Class CompoWindowVM Return False End If ' Passo al contesto principale - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) ' Recupero flag per inserimento diretto in grezzo (altrimenti in parcheggio) Dim bDirect As Boolean = (GetMainPrivateProfileInt(S_NEST, K_DIRECT, 0) <> 0) ' Elimino eventuali precedenti pezzi vuoti diff --git a/Constants/ConstIni.vb b/Constants/ConstIni.vb index 92de60d..ec78928 100644 --- a/Constants/ConstIni.vb +++ b/Constants/ConstIni.vb @@ -151,6 +151,4 @@ Module ConstIni Public Const K_VEINMA_IMGWIDTH As String = "ImgWidth" Public Const K_VEINMA_IMGHEIGHT As String = "ImgHeight" - Public Const S_MRUFILES As String = "MruFiles" - End Module diff --git a/DxfImportWindow/DxfImportWindowVM.vb b/DxfImportWindow/DxfImportWindowVM.vb index 7b756db..e5911f8 100644 --- a/DxfImportWindow/DxfImportWindowVM.vb +++ b/DxfImportWindow/DxfImportWindowVM.vb @@ -347,7 +347,7 @@ Public Class DxfImportWindowVM nId = EgtGetNextPart(nId) End While ' Passo al contesto principale - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) ' Recupero flag per inserimento diretto in grezzo (altrimenti in parcheggio) Dim bDirect As Boolean = (GetMainPrivateProfileInt(S_NEST, K_DIRECT, 0) <> 0) ' Elimino eventuali precedenti pezzi vuoti diff --git a/EgtStoneLib/VeinMatchingWindow.xaml.vb b/EgtStoneLib/VeinMatchingWindow.xaml.vb index 5c9493a..11671f4 100644 --- a/EgtStoneLib/VeinMatchingWindow.xaml.vb +++ b/EgtStoneLib/VeinMatchingWindow.xaml.vb @@ -292,7 +292,7 @@ Public Class VeinMatchingWindow Dim bSelected As Boolean = False Dim nOriId As Integer = GDB_ID.NULL EgtGetInfo(m_nIdToSel, KEY_ORI_ID, nOriId) - If EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) AndAlso EgtExistsObj(nOriId) Then + If EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) AndAlso EgtExistsObj(nOriId) Then Dim nMachGrpId As Integer If (OmagOFFICEMap.refNestingTabVM.SelectPart(nOriId, False, nMachGrpId)) Then bSelected = True @@ -317,7 +317,7 @@ Public Class VeinMatchingWindow Dim bDeselected As Boolean = False Dim nOriId As Integer = GDB_ID.NULL EgtGetInfo(m_nIdToDesel, KEY_ORI_ID, nOriId) - If EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) AndAlso EgtExistsObj(nOriId) Then + If EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) AndAlso EgtExistsObj(nOriId) Then If (OmagOFFICEMap.refNestingTabVM.DeselectPart(nOriId, False)) Then bDeselected = True End If @@ -957,7 +957,7 @@ Friend Module VeinMatching ' Salvo il contesto corrente Dim nCurrCtx As Integer = EgtGetCurrentContext() ' Recupero il contesto principale - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) ' Imposto flag di modificato sul progetto principale EgtSetModified() ' Ripristino il contesto originale diff --git a/InstrumentPanel/InstrumentPanelVM.vb b/InstrumentPanel/InstrumentPanelVM.vb deleted file mode 100644 index 499b12f..0000000 --- a/InstrumentPanel/InstrumentPanelVM.vb +++ /dev/null @@ -1,48 +0,0 @@ -Imports EgtUILib - -Public Class InstrumentPanelVM - Inherits VMBase - -#Region "FIELDS & PROPERTIES" - -#Region "ToolTip" - - Public ReadOnly Property GetDistToolTip As String - Get - Return "Disposition" - End Get - End Property - -#End Region ' ToolTip - - Private m_GetDistIsChecked As Boolean - Public Property GetDistIsChecked As Boolean - Get - Return m_GetDistIsChecked - End Get - Set(value As Boolean) - If value <> m_GetDistIsChecked Then - m_GetDistIsChecked = value - If value Then - OmagOFFICEMap.refSceneHostV.GetDistanceON() - Else - OmagOFFICEMap.refSceneHostV.GetDistanceOFF() - OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.SetStatusNull() - OmagOFFICEMap.refStatusBarVM.ClearOutputMessage() - End If - NotifyPropertyChanged("GetDistIsChecked") - End If - End Set - End Property - -#End Region ' FIELDS & PROPERTIES - -#Region "CONSTRUCTOR" - - Sub New() - - End Sub - -#End Region ' CONSTRUCTOR - -End Class \ No newline at end of file diff --git a/InstrumentPanel/MyInstrumentPanelVM.vb b/InstrumentPanel/MyInstrumentPanelVM.vb new file mode 100644 index 0000000..9e9dfb5 --- /dev/null +++ b/InstrumentPanel/MyInstrumentPanelVM.vb @@ -0,0 +1,11 @@ +Imports EgtWPFLib5 + +Public Class MyInstrumentPanelVM + Inherits InstrumentPanelVM + + Public Overrides Function OnPostGetDistIsChecked() As Boolean + OmagOFFICEMap.refSceneHostVM.MainScene.SetStatusNull() + Return True + End Function + +End Class diff --git a/MachinePanel/MachinePanelVM.vb b/MachinePanel/MachinePanelVM.vb index 5063b27..117a4ab 100644 --- a/MachinePanel/MachinePanelVM.vb +++ b/MachinePanel/MachinePanelVM.vb @@ -17,7 +17,7 @@ Public Class MachinePanelVM End Property ' Lista delle macchine disponibili - Private m_MachineList As ObservableCollection(Of Machine) + Private m_MachineList As New ObservableCollection(Of Machine) Public Property MachineList As ObservableCollection(Of Machine) Get Return m_MachineList @@ -37,12 +37,6 @@ Public Class MachinePanelVM '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 @@ -114,12 +108,9 @@ Public Class MachinePanelVM ' Creo riferimento a questa classe in OmagOFFICEMap OmagOFFICEMap.SetRefMachinePanelVM(Me) ' recupero cartella radice delle macchine - m_sMachinesRoot = OmagOFFICE.refMainWindowVM.MainWindowM.sMachinesRoot + m_sMachinesRoot = OmagOFFICEMap.refMainWindowVM.MainWindowM.sMachinesRoot ' Carica macchine da cartella delle macchine - Dim MachineList As New List(Of Machine) - If Machine.MachineListInit(sMachinesRoot, MachineList) Then 'OmagOFFICEMap.refMainWindowVM.MainWindowM.sMachinesRoot, MachineList) Then - m_MachineList = New ObservableCollection(Of Machine)(MachineList) - End If + Machine.MachineListInit(sMachinesRoot, MachineList) ' Inizializzo valori visibilità parametri Db utensili e lavorazioni OmagOFFICETMDbParamVisibility.Init() End Sub @@ -157,7 +148,7 @@ Public Class MachinePanelVM MessageBox.Show(EgtMsg(MSG_TOOLDBERRORS + 30), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error) Return End If - Dim ToolDbWindow As New ToolDbWindowV(Application.Current.MainWindow, New ToolDbWindowVM(CurrentMachine.sMachDir, CurrentMachine.sMachIniFile, OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())) + Dim ToolDbWindow As New ToolDbWindowV(Application.Current.MainWindow, New ToolDbWindowVM(CurrentMachine.sMachDir, CurrentMachine.sMachIniFile, OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())) ToolDbWindow.Height = 640 ToolDbWindow.Width = 1024 ToolDbWindow.ShowDialog() @@ -196,7 +187,7 @@ Public Class MachinePanelVM MessageBox.Show(EgtMsg(MSG_MACHININGDBERRORS + 8), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error) Return End If - Dim MachDbWindow As New MyMachiningDbWindowV(Application.Current.MainWindow, New MyMachiningDbWindowVM(CurrentMachine.sMachIniFile, OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx())) + Dim MachDbWindow As New MyMachiningDbWindowV(Application.Current.MainWindow, New MyMachiningDbWindowVM(CurrentMachine.sMachIniFile, OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx())) MachDbWindow.Height = 614 MachDbWindow.Width = 1024 MachDbWindow.ShowDialog() @@ -354,7 +345,7 @@ Public Class MachinePanelVM MachOptionWindow.Height = 546 MachOptionWindow.Width = 546 MachOptionWindow.ShowDialog() - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) End Sub #End Region ' MachOptionsCommand diff --git a/MainWindow/MainWindowM.vb b/MainWindow/MainWindowM.vb index f51854d..8fda521 100644 --- a/MainWindow/MainWindowM.vb +++ b/MainWindow/MainWindowM.vb @@ -107,8 +107,6 @@ Public Class MainWindowM Private Sub InitializeEgtEnvironment() '' Abilito drag and drop 'Me.AllowDrop = True - '' Title - 'Application.Msn.NotifyColleagues(Application.EMITTITLE) ' Impostazione path radice per i dati m_sDataRoot = System.AppDomain.CurrentDomain.BaseDirectory If EgtUILib.GetPrivateProfileString(S_DATA, K_DATAROOT, "", m_sDataRoot, m_sDataRoot & "\" & DAT_FILE_NAME) = 0 Then diff --git a/MainWindow/MainWindowV.xaml b/MainWindow/MainWindowV.xaml index 58b08d7..01100f7 100644 --- a/MainWindow/MainWindowV.xaml +++ b/MainWindow/MainWindowV.xaml @@ -9,9 +9,9 @@ MinHeight="600" MinWidth="800" AboutBoxCommand="{Binding AboutBoxCommand}" WindowStyle="None" ResizeMode="NoResize" CloseCommand="{Binding CloseApplicationCommand,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}"> - + - + @@ -19,7 +19,7 @@ - + diff --git a/MainWindow/MainWindowVM.vb b/MainWindow/MainWindowVM.vb index a3e4ac6..b817c81 100644 --- a/MainWindow/MainWindowVM.vb +++ b/MainWindow/MainWindowVM.vb @@ -82,7 +82,7 @@ Public Class MainWindowVM m_VeinMatchingWnd.Show() m_VeinMatchingWnd.Hide() VeinMatching.m_nVeinCtx = m_VeinMatchingWnd.VeinMatchingScene.GetCtx() - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) m_VeinMatchingWnd.AdjustPosition() ' Leggo dimensioni immagini esportate Dim nImgWidth = GetMainPrivateProfileInt(S_VEINMATCHING, K_VEINMA_IMGWIDTH, 1600) @@ -152,9 +152,9 @@ Public Class MainWindowVM OmagOFFICEMap.refSimulTabVM.ResetSimulation() End If ' Imposto contesto principale - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) ' Gestisco eventuale file corrente modificato - Dim bAllowClose As Boolean = OmagOFFICEMap.refSceneHostV.Controller.ManageModified() + Dim bAllowClose As Boolean = OmagOFFICEMap.refSceneHostVM.MainController.ManageModified() ' Se non confermata chiusura, esco If Not bAllowClose Then Return ' Salvo nome ultimo file (per gestire bene multi istanza) diff --git a/MachGroupPanel/MachGroupPanelVM.vb b/MyMachGroupPanel/MachGroupPanelVM.vb similarity index 92% rename from MachGroupPanel/MachGroupPanelVM.vb rename to MyMachGroupPanel/MachGroupPanelVM.vb index 9004444..d6ad983 100644 --- a/MachGroupPanel/MachGroupPanelVM.vb +++ b/MyMachGroupPanel/MachGroupPanelVM.vb @@ -3,8 +3,8 @@ Imports System.IO Imports EgtUILib Imports EgtWPFLib5 -Public Class MachGroupPanelVM - Inherits EgtWPFLib5.EgtMachGroupPanelVM +Public Class MyMachGroupPanelVM + Inherits MachGroupPanelVM #Region "CONSTRUCTOR" @@ -54,7 +54,7 @@ Public Class MachGroupPanelVM End Sub Public Overrides Function OnPreNewMachGroup() As Boolean - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) Return True End Function @@ -67,7 +67,7 @@ Public Class MachGroupPanelVM Dim sDefaultSetUpName As String = String.Empty Dim sCurrMachName As String = String.Empty EgtGetCurrMachineName(sCurrMachName) - Dim sMachineIniPath As String = OmagOFFICE.refMainWindowVM.MainWindowM.sMachinesRoot & "\" & sCurrMachName & "\" & sCurrMachName & ".ini" + Dim sMachineIniPath As String = OmagOFFICEMap.refMainWindowVM.MainWindowM.sMachinesRoot & "\" & sCurrMachName & "\" & sCurrMachName & ".ini" EgtUILib.GetPrivateProfileString(S_SETUP, K_DEFAULT, "", sDefaultSetUpName, sMachineIniPath) ' se è attiva l'opzione, rendo corrente l'attrezzaggio di default If Not String.IsNullOrEmpty(sDefaultSetUpName) Then @@ -94,7 +94,9 @@ Public Class MachGroupPanelVM End Function Public Overrides Function OnPreSetCurrMachGroup() As Boolean - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) + ' Deseleziono tutto in Nesting e nel VeinMatching + OmagOFFICE.refNestingTabVM.DeselectAll(True) ' Deseleziono tutto in Nesting e nel VeinMatching OmagOFFICE.refNestingTabVM.DeselectAll(True) Return True @@ -177,7 +179,7 @@ Public Class MachGroupPanelVM End Function Public Overrides Function OnPreRemoveCurrMachGroup() As Boolean - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) ' Parcheggio tutti i pezzi presenti nella lastra Dim nPartId As Integer = EgtGetFirstPartInRawPart(GetRawId()) While nPartId <> GDB_ID.NULL diff --git a/MyMachiningDbWindow/MyMachiningDbWindowVM.vb b/MyMachiningDbWindow/MyMachiningDbWindowVM.vb index 29dc310..1276d99 100644 --- a/MyMachiningDbWindow/MyMachiningDbWindowVM.vb +++ b/MyMachiningDbWindow/MyMachiningDbWindowVM.vb @@ -44,7 +44,7 @@ Public Class MyMachiningDbWindowVM ''' Method that search the machines in the correct folder and add to the MachinesList those valid. ''' Public Overrides Sub LoadSelectedMachineMachinings() - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) Dim ActiveMachiningsTypes() As MachiningsType = MachineUtility.ReadMachiningFamilies(CurrentMachine.sMachIniFile) For Each MachiningsType In ActiveMachiningsTypes Dim FamilyTreeView As New FamilyMachiningTreeViewItem(MachiningsType.Name, MachiningsType.Id, Nothing) diff --git a/MyMachiningDbWindow/MyMachiningTreeView.vb b/MyMachiningDbWindow/MyMachiningTreeView.vb index 930be48..7682265 100644 --- a/MyMachiningDbWindow/MyMachiningTreeView.vb +++ b/MyMachiningDbWindow/MyMachiningTreeView.vb @@ -137,7 +137,7 @@ Public Class MyMachiningTreeViewItem Public Overrides Sub ReadMachiningParam() MyBase.ReadMachiningParam() - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) EgtMdbGetCurrMachiningParam(MCH_MP.SYSNOTES, SystemNotes) ' Compilo lista materiali m_MaterialList.Clear() @@ -168,7 +168,7 @@ Public Class MyMachiningTreeViewItem Public Overrides Sub WriteMachiningParam() MyBase.WriteMachiningParam() - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) EgtMdbSetCurrMachiningParam(MCH_MP.SYSNOTES, SystemNotes) End Sub diff --git a/MySceneHost/MySceneHostVM.vb b/MySceneHost/MySceneHostVM.vb new file mode 100644 index 0000000..70f3139 --- /dev/null +++ b/MySceneHost/MySceneHostVM.vb @@ -0,0 +1,460 @@ +Imports System.Windows.Interop +Imports System.IO +Imports EgtUILib +Imports EgtWPFLib5 + +Public Class MySceneHostVM + Inherits EgtWPFLib5.SceneHostVM + +#Region "CONSTRUCTOR" + + Sub New() + MyBase.New() + AddHandler MainController.OnNewProject, AddressOf OnNewProject + AddHandler MainController.OnOpenProject, AddressOf OnOpenProject + AddHandler MainController.OnSavingProject, AddressOf OnSavingProject + AddHandler MainController.OnSavedProject, AddressOf OnSavedProject + End Sub + +#End Region ' CONSTRUCTOR + +#Region "METHODS" + + Overrides Sub InitScene() + InitSceneEvents() + ' Inizializzazione Scena + PreInitializeScene() + If Not MainScene.Init() Then + EgtOutLog("Error in Project scene creation") + ' Box di avviso chiave mancante + MessageBox.Show(EgtMsg(MSG_MISSINGKEYWD + 2) & Environment.NewLine & EgtMsg(MSG_MISSINGKEYWD + 3), EgtMsg(MSG_MISSINGKEYWD + 1), MessageBoxButton.OK, MessageBoxImage.Error) + ' Chiudo il programma + End + ' Verifico abilitazione prodotto + ElseIf Not OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.OFFICE_BASE) Then + MessageBox.Show(EgtMsg(MSG_MISSINGKEYWD + 5), EgtMsg(MSG_MISSINGKEYWD + 1), MessageBoxButton.OK, MessageBoxImage.Error) + ' Chiudo il programma + End + Else + PostInitializeScene() + ' Imposto stato gestione mouse diretto della scena a nessuno + MainScene.SetStatusNull() + ' Recupero e imposto handle finestra principale + Dim hMainWnd As IntPtr = New WindowInteropHelper(Application.Current.MainWindow).Handle + EgtSetMainWindowHandle(hMainWnd) + ' inizializzo gestore lavorazioni + EgtInitMachMgr(OmagOFFICEMap.refMachinePanelVM.sMachinesRoot) + End If + End Sub + + Public Overrides Sub InitSceneEvents() + AddHandler MainScene.OnMouseDownScene, AddressOf OnMouseDownScene + AddHandler MainScene.OnMouseMoveScene, AddressOf OnMouseMoveScene + AddHandler MainScene.OnMouseUpScene, AddressOf OnMouseUpScene + AddHandler MainScene.KeyDown, AddressOf OnKeyDownScene + AddHandler MainScene.OnCursorPos, AddressOf OnCursorPos + AddHandler MainScene.OnShowDistance, AddressOf OnShowDistance + AddHandler MainScene.OnChangedSnapPointType, AddressOf OnChangedSnapPointType + End Sub + + Private Sub PreInitializeScene() + ' imposto colore di default + Dim DefColor As New Color3d(0, 0, 0) + GetMainPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor) + MainScene.SetDefaultMaterial(DefColor) + ' imposto colori sfondo + Dim BackTopColor As New Color3d(192, 192, 192) + GetMainPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor) + Dim BackBotColor As New Color3d(BackTopColor) + GetMainPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor) + MainScene.SetViewBackground(BackTopColor, BackBotColor) + ' imposto colore di evidenziazione + Dim MarkColor As New Color3d(255, 255, 0) + GetMainPrivateProfileColor(S_SCENE, K_MARK, MarkColor) + MainScene.SetMarkMaterial(MarkColor) + ' imposto colore per superfici selezionate + Dim SelSurfColor As New Color3d(255, 255, 192) + GetMainPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor) + MainScene.SetSelSurfMaterial(SelSurfColor) + ' imposto tipo e colore del rettangolo di zoom + Dim bOutline As Boolean = True + Dim ZwColor As New Color3d(0, 0, 0) + GetMainPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, bOutline, ZwColor) + MainScene.SetZoomWinAttribs(bOutline, ZwColor) + ' imposto colore della linea di distanza + Dim DstLnColor As New Color3d(255, 0, 0) + GetMainPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor) + MainScene.SetDistLineMaterial(DstLnColor) + ' imposto parametri OpenGL + Dim nDriver As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DRIVER, 3) + Dim b2Buff As Boolean = (GetMainPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1) <> 0) + Dim nColorBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_COLORBITS, 32) + Dim nDepthBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32) + MainScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits) + End Sub + + Private Sub PostInitializeScene() + ' Impostazioni Controller + MainController.SetScene(MainScene) + ' imposto tipo coordinate + MainScene.SetGridCursorPos(True) + ' modo di visualizzazione + Dim nShowMode As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWMODE, SM.SHADING) + OmagOFFICEMap.refShowPanelVM.SetShowMode(DirectCast(nShowMode, SM)) + ' visualizzazione avanzata dei triangoli costituenti le superfici + Dim bShowTriaAdv As Boolean = (GetMainPrivateProfileInt(S_SCENE, K_SHOWTRIAADV, 1) <> 0) + EgtSetShowTriaAdv(bShowTriaAdv) + ' tipo visualizzazione per Zmap + Dim nShowZmap As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWZMAP, 1) + EgtSetShowZmap(DirectCast(nShowZmap, ZSM), False) + ' dimensione lineare max in pixel delle textures + Dim nTxrMaxLinPix As Integer = GetMainPrivateProfileInt(S_SCENE, K_TXRMAXLINPIX, 16384) + EgtSetTextureMaxLinPixels(nTxrMaxLinPix) + ' tipo snap point + MainScene.SetSnapPointType(SP.PT_SKETCH) + End Sub + +#End Region ' METHODS + +#Region "ProjectManager" + + Public Overrides Sub NewProject() + EgtSetCurrentContext(MainScene.GetCtx()) + Dim bOk As Boolean = MainController.NewProject() + ' Eventuale reset VM + If bOk Then + VeinMatching.Clear() + End If + MainScene.SetStatusNull() + End Sub + + Public Overrides Sub OpenProject(sFilePath As String) + EgtSetCurrentContext(MainScene.GetCtx()) + Dim bOk As Boolean = False + If String.IsNullOrEmpty(sFilePath) Then + ' Recupero cartella dell'ultimo progetto aperto + Dim sDir As String = MainController.GetCurrFile() + If String.IsNullOrWhiteSpace(sDir) Then + GetMainPrivateProfileString(S_MRUFILES, K_FILE, "", sDir) + End If + If Not String.IsNullOrWhiteSpace(sDir) Then + sDir = Path.GetDirectoryName(sDir) + End If + bOk = MainController.OpenProject(sDir) + Else + bOk = MainController.OpenProject(sFilePath, False) + End If + MainScene.SetStatusNull() + ' Eventuale apertura file VM + Dim sFile As String = String.Empty + If bOk AndAlso EgtGetCurrFilePath(sFile) Then + Dim sVmFile As String = Path.ChangeExtension(sFile, ".vme") + VeinMatching.Open(sVmFile) + End If + End Sub + + Public Overrides Sub ExportProject() + EgtSetCurrentContext(MainScene.GetCtx()) + ' Verifico che il progetto sia salvato + If EgtGetModified() Then + MessageBox.Show(EgtMsg(MSG_TOPCMDBAR + 1), "", MessageBoxButton.OK, MessageBoxImage.Exclamation) + Return + End If + ' Scelta del direttorio di destinazione + Dim sLastExportDir As String = String.Empty + GetMainPrivateProfileString(S_GENERAL, K_EXPORTDIR, "", sLastExportDir) + Dim DirDlg As New System.Windows.Forms.FolderBrowserDialog + DirDlg.Description = EgtMsg(MSG_TOPCMDBAR + 2) ' Seleziona il direttorio di esportazione + DirDlg.SelectedPath = sLastExportDir + If DirDlg.ShowDialog() <> Windows.Forms.DialogResult.OK Then Return + WriteMainPrivateProfileString(S_GENERAL, K_EXPORTDIR, DirDlg.SelectedPath) + ' Eseguo esportazione + If Not ExecExport(DirDlg.SelectedPath) Then + ' Errore nell'esportazione + MessageBox.Show(EgtMsg(MSG_TOPCMDBAR + 3), "", MessageBoxButton.OK, MessageBoxImage.Error) + End If + EgtSetCurrentContext(MainScene.GetCtx()) + End Sub + + Private Function ExecExport(sDirDest As String) As Boolean + ' Path completa del progetto corrente + Dim sFilePath As String = String.Empty + EgtGetCurrFilePath(sFilePath) + ' Preparo la lista dei gruppi di lavoro + Dim vMchGrps As New List(Of Integer) + Dim nGrpId = EgtGetFirstMachGroup() + While nGrpId <> GDB_ID.NULL + vMchGrps.Add(nGrpId) + nGrpId = EgtGetNextMachGroup(nGrpId) + End While + ' Creo un contesto separato con gestore lavorazioni per poter spezzettare il progetto + Dim nCurrCtx As Integer = EgtGetCurrentContext() + Dim nCtx As Integer = EgtInitContext() + EgtInitMachMgr(OmagOFFICEMap.refMachinePanelVM.sMachinesRoot) + ' Per ogni gruppo di lavoro + For Each nMchGrpId As Integer In vMchGrps + ' Carico il progetto + EgtOpenFile(sFilePath) + ' Recupero il nome del gruppo + Dim sMchGrp As String = String.Empty + EgtGetMachGroupName(nMchGrpId, sMchGrp) + ' Recupero il nome della lastra + Dim sSlabName As String = String.Empty + EgtGetInfo(nMchGrpId, INFO_SLABNAME, sSlabName) + ' Creo path del file di salvataggio + Dim sFileDest As String = sDirDest & "\" & Path.GetFileNameWithoutExtension(sFilePath) & "_" & If(String.IsNullOrEmpty(sSlabName), sMchGrp, sSlabName) & ".nge" + ' Verifico se al gruppo è associata una foto + Dim nPhotoId As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(GDB_ID.ROOT, PHOTO_GRP), PHOTO_NAME & sMchGrp) + ' Elimino le altre fotografie + Dim nPhId As Integer = EgtGetFirstInGroup(EgtGetFirstNameInGroup(GDB_ID.ROOT, PHOTO_GRP)) + While nPhId <> GDB_ID.NULL + Dim nNextPhId As Integer = EgtGetNext(nPhId) + If nPhId <> nPhotoId Then + EgtErase(nPhId) + End If + nPhId = nNextPhId + End While + ' Sistemo l'eventuale foto del gruppo + If nPhotoId <> GDB_ID.NULL Then + Dim sOriPath As String = String.Empty + EgtGetPhotoPath(nPhotoId, sOriPath) + Dim sNewPath As String = Path.ChangeExtension(sFileDest, Path.GetExtension(sOriPath)) + EgtChangePhotoPath(nPhotoId, sNewPath) + File.Copy(sOriPath, sNewPath, True) + EgtSetName(nPhotoId, PHOTO_NAME) + End If + ' Elimino gli altri gruppi di lavorazioni + For Each nMGrpId As Integer In vMchGrps + If nMGrpId <> nMchGrpId Then + EgtRemoveMachGroup(nMGrpId) + End If + Next + ' Elimino i pezzi che non stanno nel gruppo corrente (sono ancora pezzi dopo averlo attivato) + EgtSetCurrMachGroup(nMchGrpId) + Dim nPartId As Integer = EgtGetFirstPart() + While nPartId <> GDB_ID.NULL + Dim nNextPartId As Integer = EgtGetNextPart(nPartId) + EgtErase(nPartId) + nPartId = nNextPartId + End While + EgtResetCurrMachGroup() + ' Assegno nome standard OmagCUT al gruppo di lavoro + EgtSetName(nMchGrpId, MACH_GROUP) + ' Definisco gruppo marcatore di OmagCUT + Dim nMarkId As Integer = EgtCreateGroup(GDB_ID.ROOT) + EgtSetName(nMarkId, NAME_PROJMARK) + EgtSetLevel(nMarkId, GDB_LV.SYSTEM) + Dim nReducedCut As Integer = 1 + EgtGetInfo(nMchGrpId, INFO_REDUCEDCUT, nReducedCut) + EgtSetInfo(nMarkId, INFO_REDUCEDCUT, nReducedCut) + Dim nWash As Integer = 1 + EgtGetInfo(nMchGrpId, INFO_WASHING, nWash) + EgtSetInfo(nMarkId, INFO_WASHING, nWash) + Dim nOrder As Integer = 0 + EgtGetInfo(nMchGrpId, INFO_MACHORDER, nOrder) + EgtSetInfo(nMarkId, INFO_MACHORDER, nOrder) + Dim sMatName As String = String.Empty + EgtGetInfo(nMchGrpId, INFO_PROJMAT, sMatName) + EgtSetInfo(nMarkId, INFO_PROJMAT, sMatName) + ' Salvo il file + EgtSaveFile(sFileDest, NGE.CMPTEXT) + Next + ' Distruggo il contesto corrente e ripristino quello originale + EgtSetCurrentContext(nCurrCtx) + EgtDeleteContext(nCtx) + Return True + End Function + +#End Region ' ProjectManager + +#Region "EVENTS" + + Private Sub OnNewProject(sender As Object, bOk As Boolean) + OmagOFFICEMap.refMainWindowVM.Title = " New - OmagOFFICE" + End Sub + + Private Sub OnOpenProject(sender As Object, sFile As String, bOk As Boolean) + ' Verifico la validità del file appena aperto (deve contenere almeno un gruppo di lavoro) + If EgtGetMachGroupCount() = 0 Then bOk = False + ' Procedo a seconda del risultato + If bOk Then + OmagOFFICEMap.refMainWindowVM.Title = sFile & " - OmagOFFICE" + WriteMainPrivateProfileString(S_GENERAL, K_LASTPROJ, sFile) + OmagOFFICEMap.refTopCommandBarVM.m_MruFiles.Add(sFile) + Else + EgtNewFile() + OmagOFFICEMap.refMainWindowVM.Title = " New - OmagOFFICE" + OmagOFFICEMap.refTopCommandBarVM.m_MruFiles.Remove(sFile) + Dim sMsg As String = EgtMsg(10003) & " '" & sFile & "'" 'Error opening file + MessageBox.Show(sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) 'Error + End If + MainScene.SetStatusNull() + End Sub + + Private Sub OnSavingProject(ByVal sender As Object, sFile As String) + ' Recupero tutti i file di texture associabili ai gruppi di lavoro del progetto + Dim sDirToSearch As String = Path.GetDirectoryName(sFile) + Dim sFileToSearch As String = Path.GetFileNameWithoutExtension(sFile) & "." & PHOTO_NAME & "*" + Dim vsTxrFile As New List(Of String) + For Each sTxrFile In My.Computer.FileSystem.GetFiles(sDirToSearch, FileIO.SearchOption.SearchTopLevelOnly, sFileToSearch) + vsTxrFile.Add(sTxrFile) + Next + ' Rinomino path di eventuali fotografie + Dim nPhotoId As Integer = EgtGetFirstInGroup(EgtGetFirstNameInGroup(GDB_ID.ROOT, PHOTO_GRP)) + While nPhotoId <> GDB_ID.NULL + ' Path originale + Dim sPhoto As String = String.Empty + If EgtGetPhotoPath(nPhotoId, sPhoto) Then + ' Nome della foto + Dim sName As String = String.Empty + EgtGetName(nPhotoId, sName) + ' Nuova path + Dim sNewPhoto As String = Path.GetDirectoryName(sFile) & "\" & + Path.GetFileNameWithoutExtension(sFile) & "." & sName & + Path.GetExtension(sPhoto) + ' Se diverse, eseguo copia + If String.Compare(sPhoto, sNewPhoto, True) <> 0 Then + Try + ' Eseguo copia + File.Copy(sPhoto, sNewPhoto, True) + ' Notifico a foto il cambio di path + EgtChangePhotoPath(nPhotoId, sNewPhoto) + ' Eventuale notifica a VeinMatching del cambio di path + VeinMatching.ChangePhotoPath(sPhoto, sNewPhoto) + Catch ex As Exception + End Try + End If + ' Tolgo da lista file texture associabili, se presente + vsTxrFile.Remove(sNewPhoto) + End If + ' passo alla successiva + nPhotoId = EgtGetNext(nPhotoId) + End While + ' Se rimasti file associabili, li cancello + For Each sTxrFile In vsTxrFile + Try + My.Computer.FileSystem.DeleteFile(sTxrFile) + Catch + End Try + Next + End Sub + + Private Sub OnSavedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) + ' Se salvataggio non riuscito, esco subito + If Not bOk Then + OmagOFFICEMap.refTopCommandBarVM.m_MruFiles.Remove(sFile) + Dim sMsg As String = EgtMsg(10004) & " '" & sFile & "'" 'Error saving file + MessageBox.Show(sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error + Return + End If + ' Eventuale salvataggio VM + Dim sVmFile As String = Path.ChangeExtension(sFile, ".vme") + VeinMatching.Save(sVmFile) + ' Eventuale salvataggio CSV + CsvM.SaveCsvPartList() + ' Aggiornamento titolo + OmagOFFICEMap.refMainWindowVM.Title = sFile & " - OmagOFFICE" + ' Riabilito visualizzazione pezzi in parcheggio + EstCalc.ShowParkedParts() + ' Inserisco nome in MRU + OmagOFFICEMap.refTopCommandBarVM.m_MruFiles.Add(sFile) + ' Salvo nome ultimo file + WriteMainPrivateProfileString(S_GENERAL, K_LASTPROJ, sFile) + End Sub + + Private Sub OnMouseDownScene(sender As Object, e As Windows.Forms.MouseEventArgs) + ' Si può selezionare solo con il tasto sinistro e se stato NULL + If e.Button <> Windows.Forms.MouseButtons.Left Or Not MainScene.IsStatusNull() Then Return + ' Chiamo l'opportuno gestore + Select Case OmagOFFICEMap.refOptionPanelVM.SelItem + Case OptionPanelVM.Tabs.RAWPART + OmagOFFICEMap.refRawPartTabVM.OnMouseDownScene(sender, e) + Case OptionPanelVM.Tabs.NESTING + OmagOFFICEMap.refNestingTabVM.OnMouseDownScene(sender, e) + Case OptionPanelVM.Tabs.MACHINING + OmagOFFICEMap.refMachiningTabVM.OnMouseDownScene(sender, e) + Case OptionPanelVM.Tabs.SIMUL + End Select + End Sub + + Private Sub OnMouseMoveScene(sender As Object, e As Windows.Forms.MouseEventArgs) + ' Chiamo l'opportuno gestore + Select Case OmagOFFICEMap.refOptionPanelVM.SelItem + Case OptionPanelVM.Tabs.RAWPART + OmagOFFICEMap.refRawPartTabVM.OnMouseMoveScene(sender, e) + Case OptionPanelVM.Tabs.NESTING + OmagOFFICEMap.refNestingTabVM.OnMouseMoveScene(sender, e) + Case OptionPanelVM.Tabs.MACHINING + Case OptionPanelVM.Tabs.SIMUL + End Select + End Sub + + Private Sub OnMouseUpScene(sender As Object, e As Windows.Forms.MouseEventArgs) + ' Chiamo l'opportuno gestore + Select Case OmagOFFICEMap.refOptionPanelVM.SelItem + Case OptionPanelVM.Tabs.RAWPART + OmagOFFICEMap.refRawPartTabVM.OnMouseUpScene(sender, e) + Case OptionPanelVM.Tabs.NESTING + OmagOFFICEMap.refNestingTabVM.OnMouseUpScene(sender, e) + Case OptionPanelVM.Tabs.MACHINING + Case OptionPanelVM.Tabs.SIMUL + End Select + End Sub + + Private Sub OnKeyDownScene(sender As Object, e As System.Windows.Forms.KeyEventArgs) + ' Chiamo l'opportuno gestore + Select Case OmagOFFICEMap.refOptionPanelVM.SelItem + Case OptionPanelVM.Tabs.RAWPART + Case OptionPanelVM.Tabs.NESTING + OmagOFFICEMap.refNestingTabVM.OnKeyDownScene(sender, e) + Case OptionPanelVM.Tabs.MACHINING + Case OptionPanelVM.Tabs.SIMUL + End Select + End Sub + + Private Sub OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String) + OmagOFFICEMap.refStatusBarVM.SetCurrPos(sCursorPos) + End Sub + + Private Sub OnShowDistance(ByVal sender As Object, ByVal sDistance As String) + OmagOFFICEMap.refStatusBarVM.SetOutputMessage(sDistance) + End Sub + + Private Sub OnChangedSnapPointType(ByVal sender As Object, ByVal nSpType As SP, ByVal bUser As Boolean) + Dim BtnColor As Brush + If bUser Then + BtnColor = New SolidColorBrush(SystemColors.ControlColor) + Else + BtnColor = Brushes.Bisque + End If + Select Case nSpType + Case SP.PT_SKETCH + OmagOFFICEMap.refStatusBarVM.SetSnapPointType(EgtMsg(1102), BtnColor) 'Sketch Point + Case SP.PT_GRID + OmagOFFICEMap.refStatusBarVM.SetSnapPointType(EgtMsg(1104), BtnColor) 'Grid Point + Case SP.PT_END + OmagOFFICEMap.refStatusBarVM.SetSnapPointType(EgtMsg(1106), BtnColor) 'End Point + Case SP.PT_MID + OmagOFFICEMap.refStatusBarVM.SetSnapPointType(EgtMsg(1108), BtnColor) 'Mid Point + Case SP.CENTER + OmagOFFICEMap.refStatusBarVM.SetSnapPointType(EgtMsg(1110), BtnColor) 'Center + Case SP.CENTROID + OmagOFFICEMap.refStatusBarVM.SetSnapPointType(EgtMsg(1112), BtnColor) 'Centroid + Case SP.PT_NEAR + OmagOFFICEMap.refStatusBarVM.SetSnapPointType(EgtMsg(1114), BtnColor) 'Near Point + Case SP.PT_INTERS + OmagOFFICEMap.refStatusBarVM.SetSnapPointType(EgtMsg(1116), BtnColor) 'Inters Point + Case SP.PT_TANGENT + OmagOFFICEMap.refStatusBarVM.SetSnapPointType(EgtMsg(1118), BtnColor) 'Tang Point + Case SP.PT_PERPENDICULAR + OmagOFFICEMap.refStatusBarVM.SetSnapPointType(EgtMsg(1120), BtnColor) 'Perp Point + Case SP.PT_MINDIST + OmagOFFICEMap.refStatusBarVM.SetSnapPointType(EgtMsg(1122), BtnColor) 'MinDist Point + Case Else + OmagOFFICEMap.refStatusBarVM.SetSnapPointType("---", BtnColor) + End Select + End Sub + +#End Region ' EVENTS + +End Class diff --git a/OmagOFFICE.vbproj b/OmagOFFICE.vbproj index f1d85f4..ac3ed65 100644 --- a/OmagOFFICE.vbproj +++ b/OmagOFFICE.vbproj @@ -187,7 +187,8 @@ VeinMatchingWindow.xaml - + + MachinePanelV.xaml @@ -195,7 +196,6 @@ InstrumentPanelV.xaml - MyMachiningDbWindowV.xaml @@ -205,6 +205,7 @@ + MachiningTabV.xaml @@ -242,10 +243,12 @@ DxfImportSceneHostV.xaml + + SceneHostV.xaml + ShowPanelV.xaml - SideEntityControlV.xaml @@ -260,13 +263,9 @@ ProjectV.xaml - - SceneHostV.xaml - StatusBarV.xaml - TopCommandBarV.xaml @@ -280,7 +279,6 @@ ViewPanelV.xaml - Designer MSBuild:Compile @@ -385,6 +383,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -401,10 +403,6 @@ Designer MSBuild:Compile - - Designer - MSBuild:Compile - Designer MSBuild:Compile diff --git a/OptionPanel/NestingTab/NestingTabVM.vb b/OptionPanel/NestingTab/NestingTabVM.vb index 4818df7..d8d5ae4 100644 --- a/OptionPanel/NestingTab/NestingTabVM.vb +++ b/OptionPanel/NestingTab/NestingTabVM.vb @@ -248,7 +248,7 @@ Public Class NestingTabVM End Sub Friend Function SelectPart(nPartId As Integer, bNotifyVM As Boolean, ByRef nOtherMgrpId As Integer) As Boolean - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) ' Determino se pezzo in tavola, in parcheggio o in altro gruppo Dim bPartInTable As Boolean = (EgtGetParent(nPartId) = EstCalc.GetRawId()) Dim bPartFree As Boolean = PartIsFree(nPartId) @@ -275,7 +275,7 @@ Public Class NestingTabVM End Function Friend Function DeselectPart(nPartId As Integer, bNotifyVM As Boolean) As Boolean - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) ' Eseguo la deselezione EgtDeselectObj(nPartId) ' Eventuale aggiornamento VeinMatching @@ -288,7 +288,7 @@ Public Class NestingTabVM End Function Friend Function DeselectAllParts(bNotifyVM As Boolean) As Boolean - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) ' Eseguo EgtDeselectAll() ' Eventuale notifica al VeinMatching @@ -326,7 +326,7 @@ Public Class NestingTabVM Public Sub Draw(ByVal param As Object) Dim CompoWindow As New CompoWindowV(Application.Current.MainWindow, New CompoWindowVM) CompoWindow.ShowDialog() - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) End Sub #End Region ' DrawCommand @@ -345,7 +345,7 @@ Public Class NestingTabVM Public Sub ImportDxf(ByVal param As Object) Dim DxfImportWindow As New DxfImportWindowV(Application.Current.MainWindow, New DxfImportWindowVM) DxfImportWindow.ShowDialog() - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) End Sub #End Region ' ImportDxfCommand @@ -362,7 +362,7 @@ Public Class NestingTabVM End Property Public Sub Up(ByVal param As Object) - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) ' Aggiorno regioni per nesting UpdateNestRegions() EnableReferenceRegion(False) @@ -404,7 +404,7 @@ Public Class NestingTabVM End Property Public Sub Left(ByVal param As Object) - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) ' Aggiorno regioni per nesting UpdateNestRegions() EnableReferenceRegion(False) @@ -446,7 +446,7 @@ Public Class NestingTabVM End Property Public Sub Right(ByVal param As Object) - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) ' Aggiorno regioni per nesting UpdateNestRegions() EnableReferenceRegion(False) @@ -488,7 +488,7 @@ Public Class NestingTabVM End Property Public Sub Down(ByVal param As Object) - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) ' Aggiorno regioni per nesting UpdateNestRegions() EnableReferenceRegion(False) @@ -530,7 +530,7 @@ Public Class NestingTabVM End Property Public Sub CClockwiseRot(ByVal param As Object) - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) RotateCluster(m_dRotationAngle) EstCalc.ResetOrderMachiningFlag() EgtDraw() @@ -556,7 +556,7 @@ Public Class NestingTabVM End Property Public Sub ClockwiseRot(ByVal param As Object) - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) RotateCluster(-m_dRotationAngle) EstCalc.ResetOrderMachiningFlag() EgtDraw() @@ -582,7 +582,7 @@ Public Class NestingTabVM End Property Public Sub InsertPart(ByVal param As Object) - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) ' Ciclo di inserimento in tavola dei pezzi selezionati Dim nId As Integer = EgtGetFirstSelectedObj() While nId <> GDB_ID.NULL @@ -620,7 +620,7 @@ Public Class NestingTabVM End Property Public Sub StorePart(ByVal param As Object) - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) ' Ciclo di parcheggio dei pezzi selezionati Dim nId As Integer = EgtGetFirstSelectedObj() While nId <> GDB_ID.NULL @@ -653,12 +653,12 @@ Public Class NestingTabVM End Property Public Sub RemovePart() - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) ' Se non ci sono pezzi selezionati, esco subito If EgtGetFirstSelectedObj() = GDB_ID.NULL Then Return ' Chiedo conferma prima di procedere If MessageBox.Show(EgtMsg(MSG_EGTMSGBOX + 21), "", MessageBoxButton.OKCancel, MessageBoxImage.Question) = MessageBoxResult.Cancel Then Return - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) ' Verifico se ci sono pezzi provenienti da liste Csv Dim bCsvParts As Boolean = False Dim nId As Integer = EgtGetFirstSelectedObj() @@ -674,14 +674,14 @@ Public Class NestingTabVM If bCsvParts Then ' Vuoi cancellare anche i pezzi da lista Csv ? Select Case MessageBox.Show(EgtMsg(MSG_EGTMSGBOX + 12), "", MessageBoxButton.YesNoCancel, MessageBoxImage.Question) - Case MessageBoxResult.Cancel - Return - Case MessageBoxResult.Yes - bEraseCsvParts = True - Case MessageBoxResult.No - bEraseCsvParts = False + Case MessageBoxResult.Cancel + Return + Case MessageBoxResult.Yes + bEraseCsvParts = True + Case MessageBoxResult.No + bEraseCsvParts = False End Select - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) End If ' Ciclo di cancellazione dei pezzi selezionati nId = EgtGetFirstSelectedObj() @@ -698,7 +698,7 @@ Public Class NestingTabVM EraseMachinings(nId) ' Cancello EgtErase(nId) - ' Altrimenti pezzo nel grezzo + ' Altrimenti pezzo nel grezzo ElseIf EgtGetParent(nId) = EstCalc.GetRawId() Then If EgtRemovePartFromRawPart(nId) Then ' Eventuale notifica al VeinMatching @@ -733,7 +733,7 @@ Public Class NestingTabVM End Property Public Sub SelectAll(ByVal param As Object) - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) ' Numero dei pezzi in tavola Dim nPartTab As Integer = EgtGetPartInRawPartCount(GetRawId()) ' Se già selezionati in tavola o non ci sono selezionati e pezzi in tavola @@ -795,7 +795,7 @@ Public Class NestingTabVM End Property Public Sub Reset(ByVal param As Object) - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) ' Cancello eventuali messaggi OmagOFFICEMap.refStatusBarVM.ClearOutputMessage() ' Cancello tutte le lavorazioni diff --git a/OptionPanel/OptionPanelV.xaml.vb b/OptionPanel/OptionPanelV.xaml.vb index 7168e46..76ccf38 100644 --- a/OptionPanel/OptionPanelV.xaml.vb +++ b/OptionPanel/OptionPanelV.xaml.vb @@ -23,6 +23,7 @@ ' Se non consentito passaggio ad altro tab interrompo l'evento If Not OmagOFFICEMap.refOptionPanelVM.NestTabIsEnabled Then e.Handled = True End Sub + #End Region ' EVENTS End Class diff --git a/OptionPanel/RawPartTab/RawPartTabVM.vb b/OptionPanel/RawPartTab/RawPartTabVM.vb index 2634cc3..6a5ce74 100644 --- a/OptionPanel/RawPartTab/RawPartTabVM.vb +++ b/OptionPanel/RawPartTab/RawPartTabVM.vb @@ -738,7 +738,7 @@ Public Class RawPartTabVM Public ReadOnly Property PhotoToolTip As String Get - Return "Importa fotografia" + Return EgtMsg(MSG_RAWPARTTAB + 2) End Get End Property diff --git a/Project/ProjectV.xaml b/Project/ProjectV.xaml index 8f219da..8120e91 100644 --- a/Project/ProjectV.xaml +++ b/Project/ProjectV.xaml @@ -29,7 +29,7 @@ IsRightDockable="False" IsFloating="False"/> - + diff --git a/SceneHost/SceneHostV.xaml b/SceneHost/SceneHostV.xaml index 326d072..68d3785 100644 --- a/SceneHost/SceneHostV.xaml +++ b/SceneHost/SceneHostV.xaml @@ -1,8 +1,10 @@ - - + + + - + diff --git a/SceneHost/SceneHostV.xaml.vb b/SceneHost/SceneHostV.xaml.vb index af2ee2c..76b8e53 100644 --- a/SceneHost/SceneHostV.xaml.vb +++ b/SceneHost/SceneHostV.xaml.vb @@ -5,542 +5,15 @@ Imports EgtWPFLib5 Public Class SceneHostV - ' Scene controller - Private WithEvents m_Controller As New Controller - Friend ReadOnly Property Controller As Controller - Get - Return m_Controller - End Get - End Property + Private m_SceneHostVM As MySceneHostVM Sub New() ' This call is required by the designer. InitializeComponent() - ' Creo riferimento a questa classe in OmagOFFICEMap - OmagOFFICEMap.SetRefSceneHostV(Me) - ' Inizializzazione Scena - PreInitializeScene() - If Not OmagOFFICEScene.Init() Then - EgtOutLog("Error in Project scene creation") - ' Box di avviso chiave mancante - MessageBox.Show(EgtMsg(MSG_MISSINGKEYWD + 2) & Environment.NewLine & EgtMsg(MSG_MISSINGKEYWD + 3), EgtMsg(MSG_MISSINGKEYWD + 1), MessageBoxButton.OK, MessageBoxImage.Error) - ' Chiudo il programma - End - ' Verifico abilitazione prodotto - ElseIf Not OmagOFFICEMap.refMainWindowVM.MainWindowM.GetKeyOption(KEY_OPT.OFFICE_BASE) Then - MessageBox.Show(EgtMsg(MSG_MISSINGKEYWD + 5), EgtMsg(MSG_MISSINGKEYWD + 1), MessageBoxButton.OK, MessageBoxImage.Error) - ' Chiudo il programma - End - Else - PostInitializeScene() - ' Imposto stato gestione mouse diretto della scena a nessuno - OmagOFFICEScene.SetStatusNull() - ' Recupero e imposto handle finestra principale - Dim hMainWnd As IntPtr = New WindowInteropHelper(Application.Current.MainWindow).Handle - EgtSetMainWindowHandle(hMainWnd) - ' inizializzo gestore lavorazioni - EgtInitMachMgr(OmagOFFICEMap.refMachinePanelVM.sMachinesRoot) - End If + ' Assegno al riferimento locale al VM il VM preso dal DataContext + Me.DataContext = New MySceneHostVM + m_SceneHostVM = DirectCast(Me.DataContext, MySceneHostVM) + m_SceneHostVM.SetMainScene(MainScene) End Sub - Private Sub PreInitializeScene() - ' imposto colore di default - Dim DefColor As New Color3d(0, 0, 0) - GetMainPrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, DefColor) - OmagOFFICEScene.SetDefaultMaterial(DefColor) - ' imposto colori sfondo - Dim BackTopColor As New Color3d(192, 192, 192) - GetMainPrivateProfileColor(S_SCENE, K_BACKTOP, BackTopColor) - Dim BackBotColor As New Color3d(BackTopColor) - GetMainPrivateProfileColor(S_SCENE, K_BACKBOTTOM, BackBotColor) - OmagOFFICEScene.SetViewBackground(BackTopColor, BackBotColor) - ' imposto colore di evidenziazione - Dim MarkColor As New Color3d(255, 255, 0) - GetMainPrivateProfileColor(S_SCENE, K_MARK, MarkColor) - OmagOFFICEScene.SetMarkMaterial(MarkColor) - ' imposto colore per superfici selezionate - Dim SelSurfColor As New Color3d(255, 255, 192) - GetMainPrivateProfileColor(S_SCENE, K_SELSURF, SelSurfColor) - OmagOFFICEScene.SetSelSurfMaterial(SelSurfColor) - ' imposto tipo e colore del rettangolo di zoom - Dim bOutline As Boolean = True - Dim ZwColor As New Color3d(0, 0, 0) - GetMainPrivateProfileZoomWin(S_SCENE, K_ZOOMWIN, bOutline, ZwColor) - OmagOFFICEScene.SetZoomWinAttribs(bOutline, ZwColor) - ' imposto colore della linea di distanza - Dim DstLnColor As New Color3d(255, 0, 0) - GetMainPrivateProfileColor(S_SCENE, K_DISTLINE, DstLnColor) - OmagOFFICEScene.SetDistLineMaterial(DstLnColor) - ' imposto parametri OpenGL - Dim nDriver As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DRIVER, 3) - Dim b2Buff As Boolean = (GetMainPrivateProfileInt(S_OPENGL, K_DOUBLEBUFFER, 1) <> 0) - Dim nColorBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_COLORBITS, 32) - Dim nDepthBits As Integer = GetMainPrivateProfileInt(S_OPENGL, K_DEPTHBITS, 32) - OmagOFFICEScene.SetViewAttributes(nDriver, b2Buff, nColorBits, nDepthBits) - End Sub - - Private Sub PostInitializeScene() - ' Impostazioni Controller - m_Controller.SetScene(OmagOFFICEScene) - ' imposto tipo coordinate - OmagOFFICEScene.SetGridCursorPos(True) - ' modo di visualizzazione - Dim nShowMode As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWMODE, SM.SHADING) - OmagOFFICEMap.refShowPanelVM.SetShowMode(DirectCast(nShowMode, SM)) - ' visualizzazione avanzata dei triangoli costituenti le superfici - Dim bShowTriaAdv As Boolean = (GetMainPrivateProfileInt(S_SCENE, K_SHOWTRIAADV, 1) <> 0) - EgtSetShowTriaAdv(bShowTriaAdv) - ' tipo visualizzazione per Zmap - Dim nShowZmap As Integer = GetMainPrivateProfileInt(S_SCENE, K_SHOWZMAP, 1) - EgtSetShowZmap(DirectCast(nShowZmap, ZSM), False) - ' dimensione lineare max in pixel delle textures - Dim nTxrMaxLinPix As Integer = GetMainPrivateProfileInt(S_SCENE, K_TXRMAXLINPIX, 16384) - EgtSetTextureMaxLinPixels(nTxrMaxLinPix) - ' tipo snap point - OmagOFFICEScene.SetSnapPointType(SP.PT_SKETCH) - End Sub - -#Region "ProjectManager" - - Friend Sub NewProject() - EgtSetCurrentContext(OmagOFFICEScene.GetCtx()) - Dim bOk As Boolean = m_Controller.NewProject() - ' Eventuale reset VM - If bOk Then - VeinMatching.Clear() - End If - OmagOFFICEScene.SetStatusNull() - End Sub - - Friend Sub OpenProject(sFilePath As String) - EgtSetCurrentContext(OmagOFFICEScene.GetCtx()) - Dim bOk As Boolean = False - If String.IsNullOrEmpty(sFilePath) Then - ' Recupero cartella dell'ultimo progetto aperto - Dim sDir As String = m_Controller.GetCurrFile() - If String.IsNullOrWhiteSpace(sDir) Then - GetMainPrivateProfileString(S_GENERAL, K_LASTPROJ, "", sDir) - End If - If Not String.IsNullOrWhiteSpace(sDir) Then - sDir = Path.GetDirectoryName(sDir) - End If - bOk = m_Controller.OpenProject(sDir) - Else - bOk = m_Controller.OpenProject(sFilePath, False) - End If - OmagOFFICEScene.SetStatusNull() - ' Eventuale apertura file VM - Dim sFile As String = String.Empty - If bOk AndAlso EgtGetCurrFilePath(sFile) Then - Dim sVmFile As String = Path.ChangeExtension(sFile, ".vme") - VeinMatching.Open(sVmFile) - End If - End Sub - - Friend Sub SaveProject() - EgtSetCurrentContext(OmagOFFICEScene.GetCtx()) - Dim nType As NGE = DirectCast(GetMainPrivateProfileInt(S_GEOMDB, K_SAVETYPE, NGE.CMPTEXT), NGE) - Dim sFile As String = m_Controller.GetCurrFile() - If Not String.IsNullOrWhiteSpace(sFile) Then - m_Controller.SaveProject(nType) - OmagOFFICEScene.SetStatusNull() - Else - GetMainPrivateProfileString(S_GENERAL, K_LASTPROJ, "", sFile) - If Not String.IsNullOrWhiteSpace(sFile) Then - sFile = Path.GetDirectoryName(sFile) - End If - sFile.TrimEnd("\"c) - sFile += "\New.nge" - m_Controller.SaveAsProject(sFile, nType) - End If - End Sub - - Friend Sub SaveAsProject() - EgtSetCurrentContext(OmagOFFICEScene.GetCtx()) - Dim nType As NGE = DirectCast(GetMainPrivateProfileInt(S_GEOMDB, K_SAVETYPE, NGE.CMPTEXT), NGE) - Dim sFile As String = m_Controller.GetCurrFile() - If String.IsNullOrWhiteSpace(sFile) Then - GetMainPrivateProfileString(S_GENERAL, K_LASTPROJ, "", sFile) - If Not String.IsNullOrWhiteSpace(sFile) Then - sFile = Path.GetDirectoryName(sFile) - End If - sFile.TrimEnd("\"c) - sFile += "\New.nge" - End If - m_Controller.SaveAsProject(sFile, nType) - OmagOFFICEScene.SetStatusNull() - End Sub - - Friend Sub ExportProject() - EgtSetCurrentContext(OmagOFFICEScene.GetCtx()) - ' Verifico che il progetto sia salvato - If EgtGetModified() Then - MessageBox.Show(EgtMsg(MSG_TOPCMDBAR + 1), "", MessageBoxButton.OK, MessageBoxImage.Exclamation) - Return - End If - ' Scelta del direttorio di destinazione - Dim sLastExportDir As String = String.Empty - GetMainPrivateProfileString(S_GENERAL, K_EXPORTDIR, "", sLastExportDir) - Dim DirDlg As New System.Windows.Forms.FolderBrowserDialog - DirDlg.Description = EgtMsg(MSG_TOPCMDBAR + 2) ' Seleziona il direttorio di esportazione - DirDlg.SelectedPath = sLastExportDir - If DirDlg.ShowDialog() <> Windows.Forms.DialogResult.OK Then Return - WriteMainPrivateProfileString(S_GENERAL, K_EXPORTDIR, DirDlg.SelectedPath) - ' Eseguo esportazione - If Not ExecExport(DirDlg.SelectedPath) Then - ' Errore nell'esportazione - MessageBox.Show(EgtMsg(MSG_TOPCMDBAR + 3), "", MessageBoxButton.OK, MessageBoxImage.Error) - End If - EgtSetCurrentContext(OmagOFFICEScene.GetCtx()) - End Sub - - Private Function ExecExport(sDirDest As String) As Boolean - ' Path completa del progetto corrente - Dim sFilePath As String = String.Empty - EgtGetCurrFilePath(sFilePath) - ' Preparo la lista dei gruppi di lavoro - Dim vMchGrps As New List(Of Integer) - Dim nGrpId = EgtGetFirstMachGroup() - While nGrpId <> GDB_ID.NULL - vMchGrps.Add(nGrpId) - nGrpId = EgtGetNextMachGroup(nGrpId) - End While - ' Creo un contesto separato con gestore lavorazioni per poter spezzettare il progetto - Dim nCurrCtx As Integer = EgtGetCurrentContext() - Dim nCtx As Integer = EgtInitContext() - EgtInitMachMgr(OmagOFFICEMap.refMachinePanelVM.sMachinesRoot) - ' Per ogni gruppo di lavoro - For Each nMchGrpId As Integer In vMchGrps - ' Carico il progetto - EgtOpenFile(sFilePath) - ' Recupero il nome del gruppo - Dim sMchGrp As String = String.Empty - EgtGetMachGroupName(nMchGrpId, sMchGrp) - ' Recupero il nome della lastra - Dim sSlabName As String = String.Empty - EgtGetInfo(nMchGrpId, INFO_SLABNAME, sSlabName) - ' Creo path del file di salvataggio - Dim sFileDest As String = sDirDest & "\" & Path.GetFileNameWithoutExtension(sFilePath) & "_" & If(String.IsNullOrEmpty(sSlabName), sMchGrp, sSlabName) & ".nge" - ' Verifico se al gruppo è associata una foto - Dim nPhotoId As Integer = EgtGetFirstNameInGroup(EgtGetFirstNameInGroup(GDB_ID.ROOT, PHOTO_GRP), PHOTO_NAME & sMchGrp) - ' Elimino le altre fotografie - Dim nPhId As Integer = EgtGetFirstInGroup(EgtGetFirstNameInGroup(GDB_ID.ROOT, PHOTO_GRP)) - While nPhId <> GDB_ID.NULL - Dim nNextPhId As Integer = EgtGetNext(nPhId) - If nPhId <> nPhotoId Then - EgtErase(nPhId) - End If - nPhId = nNextPhId - End While - ' Sistemo l'eventuale foto del gruppo - If nPhotoId <> GDB_ID.NULL Then - Dim sOriPath As String = String.Empty - EgtGetPhotoPath(nPhotoId, sOriPath) - Dim sNewPath As String = Path.ChangeExtension(sFileDest, Path.GetExtension(sOriPath)) - EgtChangePhotoPath(nPhotoId, sNewPath) - File.Copy(sOriPath, sNewPath, True) - EgtSetName(nPhotoId, PHOTO_NAME) - End If - ' Elimino gli altri gruppi di lavorazioni - For Each nMGrpId As Integer In vMchGrps - If nMGrpId <> nMchGrpId Then - EgtRemoveMachGroup(nMGrpId) - End If - Next - ' Elimino i pezzi che non stanno nel gruppo corrente (sono ancora pezzi dopo averlo attivato) - EgtSetCurrMachGroup(nMchGrpId) - Dim nPartId As Integer = EgtGetFirstPart() - While nPartId <> GDB_ID.NULL - Dim nNextPartId As Integer = EgtGetNextPart(nPartId) - EgtErase(nPartId) - nPartId = nNextPartId - End While - EgtResetCurrMachGroup() - ' Assegno nome standard OmagCUT al gruppo di lavoro - EgtSetName(nMchGrpId, MACH_GROUP) - ' Definisco gruppo marcatore di OmagCUT - Dim nMarkId As Integer = EgtCreateGroup(GDB_ID.ROOT) - EgtSetName(nMarkId, NAME_PROJMARK) - EgtSetLevel(nMarkId, GDB_LV.SYSTEM) - Dim nReducedCut As Integer = 1 - EgtGetInfo(nMchGrpId, INFO_REDUCEDCUT, nReducedCut) - EgtSetInfo(nMarkId, INFO_REDUCEDCUT, nReducedCut) - Dim nWash As Integer = 1 - EgtGetInfo(nMchGrpId, INFO_WASHING, nWash) - EgtSetInfo(nMarkId, INFO_WASHING, nWash) - Dim nOrder As Integer = 0 - EgtGetInfo(nMchGrpId, INFO_MACHORDER, nOrder) - EgtSetInfo(nMarkId, INFO_MACHORDER, nOrder) - Dim sMatName As String = String.Empty - EgtGetInfo(nMchGrpId, INFO_PROJMAT, sMatName) - EgtSetInfo(nMarkId, INFO_PROJMAT, sMatName) - ' Salvo il file - EgtSaveFile(sFileDest, NGE.CMPTEXT) - Next - ' Distruggo il contesto corrente e ripristino quello originale - EgtSetCurrentContext(nCurrCtx) - EgtDeleteContext(nCtx) - Return True - End Function - -#End Region ' ProjectManager - -#Region "ShowMode" - - Friend Sub ShowMode(nType As SM) - Select Case nType - Case SM.WIREFRAME - OmagOFFICEScene.WireFrame() - Case SM.HIDDENLINE - OmagOFFICEScene.HiddenLine() - Case SM.SHADING - OmagOFFICEScene.Shading() - End Select - End Sub - -#End Region ' ShowMode - -#Region "Zoom" - - Friend Sub ZoomMode(nType As ZM) - Select Case nType - Case ZM.ALL - OmagOFFICEScene.ZoomAll() - Case ZM.IN_ - OmagOFFICEScene.ZoomIn() - Case ZM.OUT - OmagOFFICEScene.ZoomOut() - End Select - End Sub - -#End Region ' Zoom - -#Region "ViewMode" - - Friend Sub ViewMode(nType As VT) - Select Case nType - Case VT.TOP - OmagOFFICEScene.TopView() - Case VT.FRONT - OmagOFFICEScene.FrontView() - Case VT.RIGHT - OmagOFFICEScene.RightView() - Case VT.BACK - OmagOFFICEScene.BackView() - Case VT.LEFT - OmagOFFICEScene.LeftView() - Case VT.BOTTOM - OmagOFFICEScene.BottomView() - Case VT.ISO_SW - OmagOFFICEScene.IsoViewSW() - Case VT.ISO_SE - OmagOFFICEScene.IsoViewSE() - Case VT.ISO_NE - OmagOFFICEScene.IsoViewNE() - Case VT.ISO_NW - OmagOFFICEScene.IsoViewNW() - End Select - End Sub - -#End Region ' ViewMode - -#Region "GetDistance" - - Friend Sub GetDistanceON() - OmagOFFICEScene.SetStatusGetDistance() - End Sub - Friend Sub GetDistanceOFF() - OmagOFFICEScene.ResetStatusGetDistance() - End Sub - -#End Region - -#Region "EVENTS" - - Private Sub OnNewProject(sender As Object, bOk As Boolean) Handles m_Controller.OnNewProject - OmagOFFICEMap.refMainWindowVM.Title = " New - OmagOFFICE" - End Sub - - Private Sub OnOpenProject(sender As Object, sFile As String, bOk As Boolean) Handles m_Controller.OnOpenProject - ' Verifico la validità del file appena aperto (deve contenere almeno un gruppo di lavoro) - If EgtGetMachGroupCount() = 0 Then bOk = False - ' Procedo a seconda del risultato - If bOk Then - OmagOFFICEMap.refMainWindowVM.Title = sFile & " - OmagOFFICE" - WriteMainPrivateProfileString(S_GENERAL, K_LASTPROJ, sFile) - OmagOFFICEMap.refTopCommandBarVM.m_MruFiles.Add(sFile) - Else - EgtNewFile() - OmagOFFICEMap.refMainWindowVM.Title = " New - OmagOFFICE" - OmagOFFICEMap.refTopCommandBarVM.m_MruFiles.Remove(sFile) - Dim sMsg As String = EgtMsg(10003) & " '" & sFile & "'" 'Error opening file - MessageBox.Show(sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) 'Error - End If - End Sub - - Private Sub OnSavingProject(ByVal sender As Object, sFile As String) Handles m_Controller.OnSavingProject - ' Recupero tutti i file di texture associabili ai gruppi di lavoro del progetto - Dim sDirToSearch As String = Path.GetDirectoryName(sFile) - Dim sFileToSearch As String = Path.GetFileNameWithoutExtension(sFile) & "." & PHOTO_NAME & "*" - Dim vsTxrFile As New List(Of String) - For Each sTxrFile In My.Computer.FileSystem.GetFiles(sDirToSearch, FileIO.SearchOption.SearchTopLevelOnly, sFileToSearch) - vsTxrFile.Add(sTxrFile) - Next - ' Rinomino path di eventuali fotografie - Dim nPhotoId As Integer = EgtGetFirstInGroup(EgtGetFirstNameInGroup(GDB_ID.ROOT, PHOTO_GRP)) - While nPhotoId <> GDB_ID.NULL - ' Path originale - Dim sPhoto As String = String.Empty - If EgtGetPhotoPath(nPhotoId, sPhoto) Then - ' Nome della foto - Dim sName As String = String.Empty - EgtGetName(nPhotoId, sName) - ' Nuova path - Dim sNewPhoto As String = Path.GetDirectoryName(sFile) & "\" & - Path.GetFileNameWithoutExtension(sFile) & "." & sName & - Path.GetExtension(sPhoto) - ' Se diverse, eseguo copia - If String.Compare(sPhoto, sNewPhoto, True) <> 0 Then - Try - ' Eseguo copia - File.Copy(sPhoto, sNewPhoto, True) - ' Notifico a foto il cambio di path - EgtChangePhotoPath(nPhotoId, sNewPhoto) - ' Eventuale notifica a VeinMatching del cambio di path - VeinMatching.ChangePhotoPath(sPhoto, sNewPhoto) - Catch ex As Exception - End Try - End If - ' Tolgo da lista file texture associabili, se presente - vsTxrFile.Remove(sNewPhoto) - End If - ' passo alla successiva - nPhotoId = EgtGetNext(nPhotoId) - End While - ' Se rimasti file associabili, li cancello - For Each sTxrFile In vsTxrFile - Try - My.Computer.FileSystem.DeleteFile(sTxrFile) - Catch - End Try - Next - End Sub - - Private Sub OnSavedProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnSavedProject - ' Se salvataggio non riuscito, esco subito - If Not bOk Then - OmagOFFICEMap.refTopCommandBarVM.m_MruFiles.Remove(sFile) - Dim sMsg As String = EgtMsg(10004) & " '" & sFile & "'" 'Error saving file - MessageBox.Show(sMsg, EgtMsg(10001), MessageBoxButton.OK, MessageBoxImage.Error) ' Error - Return - End If - ' Eventuale salvataggio VM - Dim sVmFile As String = Path.ChangeExtension(sFile, ".vme") - VeinMatching.Save(sVmFile) - ' Eventuale salvataggio CSV - CsvM.SaveCsvPartList() - ' Aggiornamento titolo - OmagOFFICEMap.refMainWindowVM.Title = sFile & " - OmagOFFICE" - ' Riabilito visualizzazione pezzi in parcheggio - EstCalc.ShowParkedParts() - ' Inserisco nome in MRU - OmagOFFICEMap.refTopCommandBarVM.m_MruFiles.Add(sFile) - ' Salvo nome ultimo file - WriteMainPrivateProfileString(S_GENERAL, K_LASTPROJ, sFile) - End Sub - - Private Sub OnMouseDownScene(sender As Object, e As Windows.Forms.MouseEventArgs) Handles OmagOFFICEScene.OnMouseDownScene - ' Si può selezionare solo con il tasto sinistro e se stato NULL - If e.Button <> Windows.Forms.MouseButtons.Left Or Not OmagOFFICEScene.IsStatusNull() Then Return - ' Chiamo l'opportuno gestore - Select Case OmagOFFICEMap.refOptionPanelVM.SelItem - Case OptionPanelVM.Tabs.RAWPART - OmagOFFICEMap.refRawPartTabVM.OnMouseDownScene(sender, e) - Case OptionPanelVM.Tabs.NESTING - OmagOFFICEMap.refNestingTabVM.OnMouseDownScene(sender, e) - Case OptionPanelVM.Tabs.MACHINING - OmagOFFICEMap.refMachiningTabVM.OnMouseDownScene(sender, e) - Case OptionPanelVM.Tabs.SIMUL - End Select - End Sub - - Private Sub OnMouseMoveScene(sender As Object, e As Windows.Forms.MouseEventArgs) Handles OmagOFFICEScene.OnMouseMoveScene - ' Chiamo l'opportuno gestore - Select Case OmagOFFICEMap.refOptionPanelVM.SelItem - Case OptionPanelVM.Tabs.RAWPART - OmagOFFICEMap.refRawPartTabVM.OnMouseMoveScene(sender, e) - Case OptionPanelVM.Tabs.NESTING - OmagOFFICEMap.refNestingTabVM.OnMouseMoveScene(sender, e) - Case OptionPanelVM.Tabs.MACHINING - Case OptionPanelVM.Tabs.SIMUL - End Select - End Sub - - Private Sub OnMouseUpScene(sender As Object, e As Windows.Forms.MouseEventArgs) Handles OmagOFFICEScene.OnMouseUpScene - ' Chiamo l'opportuno gestore - Select Case OmagOFFICEMap.refOptionPanelVM.SelItem - Case OptionPanelVM.Tabs.RAWPART - OmagOFFICEMap.refRawPartTabVM.OnMouseUpScene(sender, e) - Case OptionPanelVM.Tabs.NESTING - OmagOFFICEMap.refNestingTabVM.OnMouseUpScene(sender, e) - Case OptionPanelVM.Tabs.MACHINING - Case OptionPanelVM.Tabs.SIMUL - End Select - End Sub - - Private Sub OnKeyDownScene(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles OmagOFFICEScene.KeyDown - ' Chiamo l'opportuno gestore - Select Case OmagOFFICEMap.refOptionPanelVM.SelItem - Case OptionPanelVM.Tabs.RAWPART - Case OptionPanelVM.Tabs.NESTING - OmagOFFICEMap.refNestingTabVM.OnKeyDownScene(sender, e) - Case OptionPanelVM.Tabs.MACHINING - Case OptionPanelVM.Tabs.SIMUL - End Select - End Sub - - Private Sub OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String) Handles OmagOFFICEScene.OnCursorPos - OmagOFFICEMap.refStatusBarVM.SetCurrPos(sCursorPos) - End Sub - - Private Sub OnShowDistance(ByVal sender As Object, ByVal sDistance As String) Handles OmagOFFICEScene.OnShowDistance - OmagOFFICEMap.refStatusBarVM.SetOutputMessage(sDistance) - End Sub - - Private Sub OnChangedSnapPointType(ByVal sender As Object, ByVal nSpType As SP, ByVal bUser As Boolean) Handles OmagOFFICEScene.OnChangedSnapPointType - If bUser Then - OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeBackground(New SolidColorBrush(SystemColors.ControlColor)) - Else - OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeBackground(Brushes.Bisque) - End If - Select Case nSpType - Case SP.PT_SKETCH - OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText(EgtMsg(1102)) 'Sketch Point - Case SP.PT_GRID - OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText(EgtMsg(1104)) 'Grid Point - Case SP.PT_END - OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText(EgtMsg(1106)) 'End Point - Case SP.PT_MID - OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText(EgtMsg(1108)) 'Mid Point - Case SP.CENTER - OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText(EgtMsg(1110)) 'Center - Case SP.CENTROID - OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText(EgtMsg(1112)) 'Centroid - Case SP.PT_NEAR - OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText(EgtMsg(1114)) 'Near Point - Case SP.PT_INTERS - OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText(EgtMsg(1116)) 'Inters Point - Case SP.PT_TANGENT - OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText(EgtMsg(1118)) 'Tang Point - Case SP.PT_PERPENDICULAR - OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText(EgtMsg(1120)) 'Perp Point - Case SP.PT_MINDIST - OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText(EgtMsg(1122)) 'MinDist Point - Case Else - OmagOFFICEMap.refStatusBarVM.SetSnapPointTypeText("---") - End Select - End Sub - -#End Region ' EVENTS - End Class diff --git a/ShowPanel/ShowPanelVM.vb b/ShowPanel/ShowPanelVM.vb deleted file mode 100644 index f83cf12..0000000 --- a/ShowPanel/ShowPanelVM.vb +++ /dev/null @@ -1,110 +0,0 @@ -Imports EgtUILib - -Public Class ShowPanelVM - Inherits VMBase - -#Region "FIELDS & PROPERTIES" - - ' Definizione comandi - Private m_cmdWireframe As ICommand - Private m_cmdHiddenLine As ICommand - Private m_cmdShading As ICommand - Private m_cmdCurveDir As ICommand - -#Region "ToolTip" - - Public ReadOnly Property RenderingWFToolTip As String - Get - Return EgtMsg(MSG_GRIDVIEWPANEL + 1) - End Get - End Property - - Public ReadOnly Property RenderingHLToolTip As String - Get - Return EgtMsg(MSG_GRIDVIEWPANEL + 2) - End Get - End Property - - Public ReadOnly Property RenderingSHToolTip As String - Get - Return EgtMsg(MSG_GRIDVIEWPANEL + 3) - End Get - End Property - -#End Region - - Private m_WireframeIsChecked As Boolean - Public Property WireframeIsChecked As Boolean - Get - Return m_WireframeIsChecked - End Get - Set(value As Boolean) - If value <> m_WireframeIsChecked Then - m_WireframeIsChecked = value - If value Then - OmagOFFICEMap.refSceneHostV.ShowMode(SM.WIREFRAME) - NotifyPropertyChanged("WireframeIsChecked") - End If - End If - End Set - End Property - - Private m_HiddenLineIsChecked As Boolean - Public Property HiddenLineIsChecked As Boolean - Get - Return m_HiddenLineIsChecked - End Get - Set(value As Boolean) - If value <> m_HiddenLineIsChecked Then - m_HiddenLineIsChecked = value - If value Then - OmagOFFICEMap.refSceneHostV.ShowMode(SM.HIDDENLINE) - NotifyPropertyChanged("HiddenLineIsChecked") - End If - End If - End Set - End Property - - Private m_ShadingIsChecked As Boolean - Public Property ShadingIsChecked As Boolean - Get - Return m_ShadingIsChecked - End Get - Set(value As Boolean) - If value <> m_ShadingIsChecked Then - m_ShadingIsChecked = value - If value Then - OmagOFFICEMap.refSceneHostV.ShowMode(SM.SHADING) - NotifyPropertyChanged("ShadingIsChecked") - End If - End If - End Set - End Property - -#End Region ' FIELDS & PROPERTIES - -#Region "CONSTRUCTOR" - - Sub New() - ' Creo riferimento a questa classe in OmagOFFICEMap - OmagOFFICEMap.SetRefShowPanelVM(Me) - End Sub - -#End Region ' CONSTRUCTOR - -#Region "METHODS" - - Friend Sub SetShowMode(nShowModeType As SM) - Select Case nShowModeType - Case SM.WIREFRAME - WireframeIsChecked = True - Case SM.HIDDENLINE - HiddenLineIsChecked = True - Case SM.SHADING - ShadingIsChecked = True - End Select - End Sub - -#End Region - -End Class \ No newline at end of file diff --git a/StatusBar/StatusBarV.xaml b/StatusBar/StatusBarV.xaml index 29f4ffd..f4f7933 100644 --- a/StatusBar/StatusBarV.xaml +++ b/StatusBar/StatusBarV.xaml @@ -14,24 +14,33 @@ - + - + + - - - - - - - - - - - + + + + + + + + + diff --git a/TopCommandBar/TopCommandBarVM.vb b/TopCommandBar/TopCommandBarVM.vb index 748eec7..9d95b2f 100644 --- a/TopCommandBar/TopCommandBarVM.vb +++ b/TopCommandBar/TopCommandBarVM.vb @@ -122,7 +122,7 @@ Public Class TopCommandBarVM ''' Execute the New. This method is invoked by the NewCommand. ''' Friend Sub NewCmd(Optional bUseDefaults As Boolean = False) - OmagOFFICEMap.refSceneHostV.NewProject() + OmagOFFICEMap.refSceneHostVM.NewProject() OmagOFFICEMap.refMachGroupPanelVM.InitMachGroupList(bUseDefaults) End Sub @@ -150,7 +150,7 @@ Public Class TopCommandBarVM End Sub Friend Sub OpenProject(sFilePath As String) - OmagOFFICEMap.refSceneHostV.OpenProject(sFilePath) + OmagOFFICEMap.refSceneHostVM.OpenProject(sFilePath) OmagOFFICEMap.refMachGroupPanelVM.InitMachGroupList() End Sub @@ -197,7 +197,7 @@ Public Class TopCommandBarVM ''' Execute the Save. This method is invoked by the SaveCommand. ''' Public Sub Save(ByVal param As Object) - OmagOFFICEMap.refSceneHostV.SaveProject() + OmagOFFICEMap.refSceneHostVM.SaveProject() End Sub #End Region ' SaveCommand @@ -220,7 +220,7 @@ Public Class TopCommandBarVM ''' Execute the SaveAs. This method is invoked by the SaveAsCommand. ''' Public Sub SaveAs(ByVal param As Object) - OmagOFFICEMap.refSceneHostV.SaveAsProject() + OmagOFFICEMap.refSceneHostVM.SaveAsProject() End Sub #End Region ' SaveAsCommand @@ -243,7 +243,7 @@ Public Class TopCommandBarVM ''' Execute the Export. This method is invoked by the ExportCommand. ''' Public Sub Export(ByVal param As Object) - OmagOFFICEMap.refSceneHostV.ExportProject() + OmagOFFICEMap.refSceneHostVM.ExportProject() End Sub #End Region ' ExportCommand @@ -311,14 +311,14 @@ Public Class TopCommandBarVM ' se nome file vuoto, chiedo se si vuole salvare If String.IsNullOrWhiteSpace(sCurrProject) Then If MessageBox.Show(EgtMsg(MSG_TOPCOMMANDBAR + 11), "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then - OmagOFFICEMap.refSceneHostV.SaveProject() + OmagOFFICEMap.refSceneHostVM.SaveProject() End If EgtGetCurrFilePath(sCurrProject) ' se modificato, chiedo se si vuole salvare Else If EgtGetModified() Then If MessageBox.Show(EgtMsg(MSG_TOPCOMMANDBAR + 11), "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then - OmagOFFICEMap.refSceneHostV.SaveProject() + OmagOFFICEMap.refSceneHostVM.SaveProject() End If End If End If diff --git a/Utility/OmagOFFICEDictionary.xaml b/Utility/OmagOFFICEDictionary.xaml index 306a330..1b7b2e7 100644 --- a/Utility/OmagOFFICEDictionary.xaml +++ b/Utility/OmagOFFICEDictionary.xaml @@ -10,12 +10,13 @@ it in xaml file(ProjectView.xaml). --> + - + - - - + + + @@ -23,7 +24,7 @@ - + diff --git a/Utility/OmagOFFICEDictionary.xaml.vb b/Utility/OmagOFFICEDictionary.xaml.vb index 8308ad9..3966cbf 100644 --- a/Utility/OmagOFFICEDictionary.xaml.vb +++ b/Utility/OmagOFFICEDictionary.xaml.vb @@ -1,5 +1,7 @@ Public Class OmagOFFICEDictionary + Public Shared ReadOnly MySceneHostVM As String = "MySceneHostVM" + #Region "Colors" Private m_Omag_Red As SolidColorBrush = Brushes.Red diff --git a/Utility/OmagOFFICEMap.vb b/Utility/OmagOFFICEMap.vb index 040a000..2bfb5a8 100644 --- a/Utility/OmagOFFICEMap.vb +++ b/Utility/OmagOFFICEMap.vb @@ -3,14 +3,10 @@ Module OmagOFFICEMap Private m_refMainWindowVM As MainWindowVM - Private m_refStatusBarVM As StatusBarVM Private m_refTopCommandBarVM As TopCommandBarVM Private m_refProjectVM As ProjectVM - Private m_refSceneHostV As SceneHostV - Private m_refShowPanelVM As ShowPanelVM Private m_refVeinMatchPanelVM As VeinMatchPanelVM Private m_refMachinePanelVM As MachinePanelVM - Private m_refMachGroupPanelVM As MachGroupPanelVM Private m_refOptionPanelVM As OptionPanelVM Private m_refRawPartTabVM As RawPartTabVM Private m_refNestingTabVM As NestingTabVM @@ -29,7 +25,7 @@ Module OmagOFFICEMap Public ReadOnly Property refStatusBarVM As StatusBarVM Get - Return m_refStatusBarVM + Return LibMap.refStatusBarVM End Get End Property @@ -45,19 +41,19 @@ Module OmagOFFICEMap End Get End Property - Public ReadOnly Property refSceneHostV As SceneHostV + Public ReadOnly Property refSceneHostVM As SceneHostVM Get - Return m_refSceneHostV + Return LibMap.refSceneHostVM End Get End Property Public ReadOnly Property refShowPanelVM As ShowPanelVM Get - Return m_refShowPanelVM + Return LibMap.refShowPanelVM End Get End Property - Public ReadOnly Property refVeinMatchPanelVM As VeinMatchPanelVM + Public ReadOnly Property refVeinMatchPanelVM As VeinMatchPanelVM Get Return m_refVeinMatchPanelVM End Get @@ -69,9 +65,9 @@ Module OmagOFFICEMap End Get End Property - Public ReadOnly Property refMachGroupPanelVM As MachGroupPanelVM + Public ReadOnly Property refMachGroupPanelVM As MyMachGroupPanelVM Get - Return m_refMachGroupPanelVM + Return LibMap.refMachGroupPanelVM End Get End Property @@ -122,8 +118,8 @@ Module OmagOFFICEMap #Region "Set" Friend Function SetRefStatusBarVM(StatusBarVM As StatusBarVM) As Boolean - m_refStatusBarVM = StatusBarVM - Return Not IsNothing(m_refStatusBarVM) + LibMap.SetRefStatusBarVM(StatusBarVM) + Return Not IsNothing(LibMap.refStatusBarVM) End Function Friend Function SetRefTopCommandBarVM(TopCommandBarVM As TopCommandBarVM) As Boolean @@ -136,17 +132,17 @@ Module OmagOFFICEMap Return Not IsNothing(m_refProjectVM) End Function - Friend Function SetRefSceneHostV(SceneHostV As SceneHostV) As Boolean - m_refSceneHostV = SceneHostV - Return Not IsNothing(m_refSceneHostV) + Friend Function SetRefSceneHostVM(SceneHostVM As SceneHostVM) As Boolean + LibMap.SetRefSceneHostVM(SceneHostVM) + Return Not IsNothing(LibMap.refSceneHostVM) End Function Friend Function SetRefShowPanelVM(ShowPanelVM As ShowPanelVM) As Boolean - m_refShowPanelVM = ShowPanelVM - Return Not IsNothing(m_refShowPanelVM) + LibMap.SetRefShowPanelVM(ShowPanelVM) + Return Not IsNothing(LibMap.refShowPanelVM) End Function - Friend Function SetRefVeinMatchPanelVM(VeinMatchPanelVM As VeinMatchPanelVM) As Boolean + Friend Function SetRefVeinMatchPanelVM(VeinMatchPanelVM As VeinMatchPanelVM) As Boolean m_refVeinMatchPanelVM = VeinMatchPanelVM Return Not IsNothing(m_refVeinMatchPanelVM) End Function @@ -156,9 +152,9 @@ Module OmagOFFICEMap Return Not IsNothing(m_refMachinePanelVM) End Function - Friend Function SetRefMachGroupPanelVM(MachGroupPanelVM As MachGroupPanelVM) As Boolean - m_refMachGroupPanelVM = MachGroupPanelVM - Return Not IsNothing(m_refMachGroupPanelVM) + Friend Function SetRefMachGroupPanelVM(MachGroupPanelVM As MyMachGroupPanelVM) As Boolean + LibMap.setrefMachGroupPanelVM(MachGroupPanelVM) + Return Not IsNothing(LibMap.refMachGroupPanelVM) End Function Friend Function SetRefOptionPanelVM(OptionPanelVM As OptionPanelVM) As Boolean @@ -207,13 +203,14 @@ Module OmagOFFICEMap Friend Function EndInit() As Boolean ' Verifico se tutti i pezzi necessari sono stati caricati Return Not IsNothing(m_refMainWindowVM) AndAlso Not IsNothing(m_refProjectVM) AndAlso - Not IsNothing(m_refStatusBarVM) AndAlso Not IsNothing(m_refTopCommandBarVM) AndAlso - Not IsNothing(m_refSceneHostV) AndAlso Not IsNothing(m_refShowPanelVM) AndAlso + Not IsNothing(LibMap.refStatusBarVM) AndAlso Not IsNothing(m_refTopCommandBarVM) AndAlso + Not IsNothing(LibMap.refSceneHostVM) AndAlso Not IsNothing(LibMap.refShowPanelVM) AndAlso Not IsNothing(m_refVeinMatchPanelVM) AndAlso - Not IsNothing(m_refMachinePanelVM) AndAlso Not IsNothing(m_refMachGroupPanelVM) AndAlso + Not IsNothing(m_refMachinePanelVM) AndAlso Not IsNothing(LibMap.refMachGroupPanelVM) AndAlso Not IsNothing(m_refOptionPanelVM) AndAlso Not IsNothing(m_refRawPartTabVM) AndAlso Not IsNothing(m_refNestingTabVM) AndAlso Not IsNothing(m_refSimulTabVM) AndAlso - Not IsNothing(m_refMachiningTabVM) + Not IsNothing(m_refMachiningTabVM) AndAlso + LibMap.EndInit() End Function #End Region ' Init diff --git a/VeinMatchPanel/VeinMatchPanelVM.vb b/VeinMatchPanel/VeinMatchPanelVM.vb index 5dd5086..97aec90 100644 --- a/VeinMatchPanel/VeinMatchPanelVM.vb +++ b/VeinMatchPanel/VeinMatchPanelVM.vb @@ -21,7 +21,7 @@ Public Class VeinMatchPanelVM Else VeinMatchingWnd.Hide() End If - EgtSetCurrentContext(OmagOFFICEMap.refSceneHostV.OmagOFFICEScene.GetCtx()) + EgtSetCurrentContext(OmagOFFICEMap.refSceneHostVM.MainScene.GetCtx()) End Set End Property diff --git a/ViewPanel/ViewPanelV.xaml.vb b/ViewPanel/ViewPanelV.xaml.vb index 0fdf160..c6bf7ab 100644 --- a/ViewPanel/ViewPanelV.xaml.vb +++ b/ViewPanel/ViewPanelV.xaml.vb @@ -1,3 +1,3 @@ -Public Class GridViewPanelV +Public Class ViewPanelV End Class diff --git a/ViewPanel/ViewPanelVM.vb b/ViewPanel/ViewPanelVM.vb deleted file mode 100644 index f5e4628..0000000 --- a/ViewPanel/ViewPanelVM.vb +++ /dev/null @@ -1,231 +0,0 @@ -Imports EgtUILib - - -Public Class ViewPanelVM - -#Region "FIELDS & PROPERTIES" - - ' Definizione comandi - Private m_cmdZoomAll As ICommand - Private m_cmdTopView As ICommand - Private m_cmdFrontView As ICommand - Private m_cmdLeftView As ICommand - Private m_cmdBackView As ICommand - Private m_cmdRightView As ICommand - Private m_cmdIsoViewSW As ICommand - -#Region "ToolTip" - - Public ReadOnly Property ZoomAllToolTip As String - Get - Return EgtMsg(MSG_GRIDVIEWPANEL + 4) - End Get - End Property - - Public ReadOnly Property LookFromTopToolTip As String - Get - Return EgtMsg(MSG_GRIDVIEWPANEL + 7) - End Get - End Property - - Public ReadOnly Property LookFromFrontToolTip As String - Get - Return EgtMsg(MSG_GRIDVIEWPANEL + 8) - End Get - End Property - - Public ReadOnly Property LookFromLeftToolTip As String - Get - Return EgtMsg(MSG_GRIDVIEWPANEL + 9) - End Get - End Property - - Public ReadOnly Property LookFromBackToolTip As String - Get - Return EgtMsg(MSG_GRIDVIEWPANEL + 10) - End Get - End Property - - Public ReadOnly Property LookFromRightToolTip As String - Get - Return EgtMsg(MSG_GRIDVIEWPANEL + 11) - End Get - End Property - - Public ReadOnly Property LookFromIso_SWToolTip As String - Get - Return EgtMsg(MSG_GRIDVIEWPANEL + 12) - End Get - End Property - -#End Region ' ToolTip - -#End Region ' FIELDS & PROPERTIES - -#Region "COMMANDS" - -#Region "ZoomAllCommand" - - ''' - ''' Returns a command that do ZoomAll. - ''' - Public ReadOnly Property ZoomAllCommand As ICommand - Get - If m_cmdZoomAll Is Nothing Then - m_cmdZoomAll = New Command(AddressOf ZoomAll) - End If - Return m_cmdZoomAll - End Get - End Property - - ''' - ''' Execute the ZoomAll. This method is invoked by the ZoomAllCommand. - ''' - Public Sub ZoomAll(ByVal param As Object) - OmagOFFICEMap.refSceneHostV.ZoomMode(ZM.ALL) - End Sub - -#End Region ' ZoomAllCommand - -#Region "TopViewCommand" - - ''' - ''' Returns a command that do TopView. - ''' - Public ReadOnly Property TopViewCommand As ICommand - Get - If m_cmdTopView Is Nothing Then - m_cmdTopView = New Command(AddressOf TopView) - End If - Return m_cmdTopView - End Get - End Property - - ''' - ''' Execute the TopView. This method is invoked by the TopViewCommand. - ''' - Public Sub TopView(ByVal param As Object) - OmagOFFICEMap.refSceneHostV.ViewMode(VT.TOP) - End Sub - -#End Region ' TopViewCommand - -#Region "FrontViewCommand" - - ''' - ''' Returns a command that do FrontView. - ''' - Public ReadOnly Property FrontViewCommand As ICommand - Get - If m_cmdFrontView Is Nothing Then - m_cmdFrontView = New Command(AddressOf FrontView) - End If - Return m_cmdFrontView - End Get - End Property - - ''' - ''' Execute the FrontView. This method is invoked by the FrontViewCommand. - ''' - Public Sub FrontView(ByVal param As Object) - OmagOFFICEMap.refSceneHostV.ViewMode(VT.FRONT) - End Sub - -#End Region ' FrontViewCommand - -#Region "LeftViewCommand" - - ''' - ''' Returns a command that do LeftView. - ''' - Public ReadOnly Property LeftViewCommand As ICommand - Get - If m_cmdLeftView Is Nothing Then - m_cmdLeftView = New Command(AddressOf LeftView) - End If - Return m_cmdLeftView - End Get - End Property - - ''' - ''' Execute the LeftView. This method is invoked by the LeftViewCommand. - ''' - Public Sub LeftView(ByVal param As Object) - OmagOFFICEMap.refSceneHostV.ViewMode(VT.LEFT) - End Sub - -#End Region ' LeftViewCommand - -#Region "BackViewCommand" - - ''' - ''' Returns a command that do BackView. - ''' - Public ReadOnly Property BackViewCommand As ICommand - Get - If m_cmdBackView Is Nothing Then - m_cmdBackView = New Command(AddressOf BackView) - End If - Return m_cmdBackView - End Get - End Property - - ''' - ''' Execute the BackView. This method is invoked by the BackViewCommand. - ''' - Public Sub BackView(ByVal param As Object) - OmagOFFICEMap.refSceneHostV.ViewMode(VT.BACK) - End Sub - -#End Region ' BackViewCommand - -#Region "RightViewCommand" - - ''' - ''' Returns a command that do RightView. - ''' - Public ReadOnly Property RightViewCommand As ICommand - Get - If m_cmdRightView Is Nothing Then - m_cmdRightView = New Command(AddressOf RightView) - End If - Return m_cmdRightView - End Get - End Property - - ''' - ''' Execute the RightView. This method is invoked by the RightViewCommand. - ''' - Public Sub RightView(ByVal param As Object) - OmagOFFICEMap.refSceneHostV.ViewMode(VT.RIGHT) - End Sub - -#End Region ' RightViewCommand - -#Region "IsoViewSWCommand" - - ''' - ''' Returns a command that do IsoViewSW. - ''' - Public ReadOnly Property IsoViewSWCommand As ICommand - Get - If m_cmdIsoViewSW Is Nothing Then - m_cmdIsoViewSW = New Command(AddressOf IsoViewSW) - End If - Return m_cmdIsoViewSW - End Get - End Property - - ''' - ''' Execute the IsoViewSW. This method is invoked by the IsoViewSWCommand. - ''' - Public Sub IsoViewSW(ByVal param As Object) - OmagOFFICEMap.refSceneHostV.ViewMode(VT.ISO_SW) - End Sub - -#End Region ' IsoViewSWCommand - -#End Region ' COMMANDS - -End Class -