From 75d05a8b310ca591a54d2616d6f682da3c402cc7 Mon Sep 17 00:00:00 2001 From: Emmanuele Sassi Date: Fri, 3 Nov 2023 11:20:13 +0100 Subject: [PATCH] - create tray top, bottom, left e right - gestiti panel con Visibility - gestiti elementi grafici in ProjectV con ItemsControl - eliminato pannello Printing3d - aggiunta gestione Plugin - verifica bit per Plugin --- BottomTray/BottomTrayV.xaml | 12 + BottomTray/BottomTrayV.xaml.vb | 3 + DrawPanel/DrawPanelV.xaml | 16 +- DrawPanel/DrawPanelVM.vb | 12 + EgtCAM5.vbproj | 53 +++- ExecutePanel/ExecutePanelV.xaml | 10 +- ExecutePanel/ExecutePanelVM.vb | 17 ++ LeftTray/LeftTrayV.xaml | 10 + LeftTray/LeftTrayV.xaml.vb | 3 + MEFPlugin/MefPlugin.vb | 74 +++++ MachinePanel/MachinePanelV.xaml | 10 +- MachinePanel/MyMachinePanelVM.vb | 11 + MainWindow/MainWindowVM.vb | 76 +++-- .../OperationsListExpanderVM.vb | 4 +- Project/ProjectV.xaml | 122 ++------ Project/ProjectV.xaml.vb | 82 +++-- Project/ProjectVM.vb | 289 ++++++++++-------- RightTray/RightTrayV.xaml | 15 + RightTray/RightTrayV.xaml.vb | 3 + SceneContentControl/SceneContentControlV.xaml | 8 + .../SceneContentControlV.xaml.vb | 3 + Special-3dPrinting/Printing3DPanelV.xaml | 20 -- Special-3dPrinting/Printing3DPanelV.xaml.vb | 3 - Special-3dPrinting/Printing3DPanelVM.vb | 26 -- Special-BeamWall/BeamPanelV.xaml | 10 +- Special-BeamWall/BeamPanelVM.vb | 14 + Special-BeamWall/BeamWallPanelV.xaml | 10 +- Special-BeamWall/BeamWallPanelVM.vb | 18 +- Special-BeamWall/WallPanelV.xaml | 10 +- Special-BeamWall/WallPanelVM.vb | 14 + Special-Doors/DoorPanelV.xaml | 10 +- Special-Doors/DoorPanelVM.vb | 11 + Special-GunStock/GunStockPanelV.xaml | 10 +- Special-GunStock/GunStockPanelVM.vb | 30 +- SpecialPanel/SpecialPanelV.xaml | 10 +- SpecialPanel/SpecialPanelVM.vb | 12 + TopCommandBar/TopCommandBarVM.vb | 40 ++- TopTray/TopTrayV.xaml | 36 +++ TopTray/TopTrayV.xaml.vb | 3 + Utility/Dictionary.xaml | 1 - Utility/IniFile.vb | 15 +- Utility/Map.vb | 50 +++ .../WinFormPluginControlV.xaml | 10 + .../WinFormPluginControlV.xaml.vb | 30 ++ .../WinFormPluginControlVM.vb | 35 +++ 45 files changed, 848 insertions(+), 413 deletions(-) create mode 100644 BottomTray/BottomTrayV.xaml create mode 100644 BottomTray/BottomTrayV.xaml.vb create mode 100644 LeftTray/LeftTrayV.xaml create mode 100644 LeftTray/LeftTrayV.xaml.vb create mode 100644 MEFPlugin/MefPlugin.vb create mode 100644 RightTray/RightTrayV.xaml create mode 100644 RightTray/RightTrayV.xaml.vb create mode 100644 SceneContentControl/SceneContentControlV.xaml create mode 100644 SceneContentControl/SceneContentControlV.xaml.vb delete mode 100644 Special-3dPrinting/Printing3DPanelV.xaml delete mode 100644 Special-3dPrinting/Printing3DPanelV.xaml.vb delete mode 100644 Special-3dPrinting/Printing3DPanelVM.vb create mode 100644 TopTray/TopTrayV.xaml create mode 100644 TopTray/TopTrayV.xaml.vb create mode 100644 WinFormPluginControl/WinFormPluginControlV.xaml create mode 100644 WinFormPluginControl/WinFormPluginControlV.xaml.vb create mode 100644 WinFormPluginControl/WinFormPluginControlVM.vb diff --git a/BottomTray/BottomTrayV.xaml b/BottomTray/BottomTrayV.xaml new file mode 100644 index 0000000..baeef4e --- /dev/null +++ b/BottomTray/BottomTrayV.xaml @@ -0,0 +1,12 @@ + + + diff --git a/BottomTray/BottomTrayV.xaml.vb b/BottomTray/BottomTrayV.xaml.vb new file mode 100644 index 0000000..5f44b25 --- /dev/null +++ b/BottomTray/BottomTrayV.xaml.vb @@ -0,0 +1,3 @@ +Public Class BottomTrayV + +End Class diff --git a/DrawPanel/DrawPanelV.xaml b/DrawPanel/DrawPanelV.xaml index b5fa3bb..e49453e 100644 --- a/DrawPanel/DrawPanelV.xaml +++ b/DrawPanel/DrawPanelV.xaml @@ -1,9 +1,11 @@ - + - + diff --git a/DrawPanel/DrawPanelVM.vb b/DrawPanel/DrawPanelVM.vb index 00f57a3..e4e5dbc 100644 --- a/DrawPanel/DrawPanelVM.vb +++ b/DrawPanel/DrawPanelVM.vb @@ -393,6 +393,18 @@ Public Class DrawPanelVM End Set End Property + Private m_DrawPanel_Visibility As Visibility + Public ReadOnly Property DrawPanel_Visibility As Visibility + Get + Return m_DrawPanel_Visibility + End Get + End Property + Friend Sub SetDrawPanelVisibility(bValue As Boolean) + m_DrawPanel_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed) + OnPropertyChanged(NameOf(DrawPanel_Visibility)) + End Sub + + #Region "Button state" Private m_bLayerOk As Boolean diff --git a/EgtCAM5.vbproj b/EgtCAM5.vbproj index 4487256..e9ad71f 100644 --- a/EgtCAM5.vbproj +++ b/EgtCAM5.vbproj @@ -116,6 +116,7 @@ False ..\..\EgtProg\EgtCAM5\Microsoft.Expression.Interactions.dll + @@ -153,11 +154,18 @@ BeamMachiningsWindowV.xaml + + BottomTrayV.xaml + CurrSetUpV.xaml + + LeftTrayV.xaml + + EstimationsExpanderV.xaml @@ -227,6 +235,12 @@ MachineBox.xaml + + RightTrayV.xaml + + + SceneContentControlV.xaml + SetUpDbV.xaml @@ -236,10 +250,6 @@ SetUpV.xaml - - Printing3DPanelV.xaml - - @@ -278,6 +288,9 @@ + + TopTrayV.xaml + @@ -416,6 +429,10 @@ + + + WinFormPluginControlV.xaml + Designer MSBuild:Compile @@ -424,6 +441,10 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -432,6 +453,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -520,6 +545,14 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -528,10 +561,6 @@ MSBuild:Compile Designer - - Designer - MSBuild:Compile - MSBuild:Compile Designer @@ -588,6 +617,10 @@ Designer XamlIntelliSenseFileGenerator + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -680,6 +713,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + diff --git a/ExecutePanel/ExecutePanelV.xaml b/ExecutePanel/ExecutePanelV.xaml index 94f6ecf..d914077 100644 --- a/ExecutePanel/ExecutePanelV.xaml +++ b/ExecutePanel/ExecutePanelV.xaml @@ -1,6 +1,8 @@ - + - + diff --git a/MachinePanel/MyMachinePanelVM.vb b/MachinePanel/MyMachinePanelVM.vb index 068edf3..be49523 100644 --- a/MachinePanel/MyMachinePanelVM.vb +++ b/MachinePanel/MyMachinePanelVM.vb @@ -82,6 +82,17 @@ Public Class MyMachinePanelVM End Set End Property + Private m_MachinePanel_Visibility As Visibility + Public ReadOnly Property MachinePanel_Visibility As Visibility + Get + Return m_MachinePanel_Visibility + End Get + End Property + Friend Sub SetMachinePanelVisibility(bValue As Boolean) + m_MachinePanel_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed) + NotifyPropertyChanged(NameOf(MachinePanel_Visibility)) + End Sub + #Region "Messages" Public ReadOnly Property ToolDBMsg As String diff --git a/MainWindow/MainWindowVM.vb b/MainWindow/MainWindowVM.vb index c5e8b98..f489024 100644 --- a/MainWindow/MainWindowVM.vb +++ b/MainWindow/MainWindowVM.vb @@ -333,35 +333,35 @@ Public Class MainWindowVM ' Impostazione direttorio toolmakers Dim sToolMakersDir As String = String.Empty GetPrivateProfileString(S_MACH, K_TOOLMAKERSDIR, "", sToolMakersDir) - #If PLATFORM = "x64" Then +#If PLATFORM = "x64" Then GetPrivateProfileString(S_MACH, K_TOOLMAKERSDIR64, sToolMakersDir, sToolMakersDir) - #End If - If Not String.IsNullOrWhiteSpace( sToolMakersDir) Then +#End If + If Not String.IsNullOrWhiteSpace(sToolMakersDir) Then IniFile.m_sToolMakersDir = sToolMakersDir Else IniFile.m_sToolMakersDir = m_sDataRoot & "\" & TOOLMAKER_DFL_DIR - End If + End If ' Verifico indice di istanza ManageInstance() ' Imposto tipo di chiave EgtSetLockType(KEY_TYPE.HW) ' Leggo e imposto chiave di protezione ed eventuale chiave nesting Dim sLicFileName As String = "" - GetPrivateProfileString( S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName) + GetPrivateProfileString(S_GENERAL, K_LICENCE, LIC_FILE_NAME, sLicFileName) Dim sLicFile As String = m_sConfigDir & "\" & sLicFileName Dim sKey As String = "" - EgtUILib.GetPrivateProfileString( S_LICENCE, K_KEY, "", sKey, sLicFile) - EgtSetKey( sKey) + EgtUILib.GetPrivateProfileString(S_LICENCE, K_KEY, "", sKey, sLicFile) + EgtSetKey(sKey) Dim sNestKey As String = "" - EgtUILib.GetPrivateProfileString( S_LICENCE, K_NESTKEY, "", sNestKey, sLicFile) - EgtSetNestKey( sNestKey) + EgtUILib.GetPrivateProfileString(S_LICENCE, K_NESTKEY, "", sNestKey, sLicFile) + EgtSetNestKey(sNestKey) ' Impostazioni per chiave di rete - Dim bNetKey As Boolean = ( GetPrivateProfileInt( S_GENERAL, K_NETKEY, 0) = 1) - EgtSetNetHwKey( bNetKey) + Dim bNetKey As Boolean = (GetPrivateProfileInt(S_GENERAL, K_NETKEY, 0) = 1) + EgtSetNetHwKey(bNetKey) Dim sLockId As String = "" - EgtUILib.GetPrivateProfileString( S_LICENCE, K_LOCKID, "", sLockId, sLicFile) - If Not String.IsNullOrEmpty( sLockId) Then - EgtSetLockId( sLockId) + EgtUILib.GetPrivateProfileString(S_LICENCE, K_LOCKID, "", sLockId, sLicFile) + If Not String.IsNullOrEmpty(sLockId) Then + EgtSetLockId(sLockId) End If ' Recupero livello e opzioni della chiave Dim bKey As Boolean = EgtGetKeyLevel(3279, 2510, 1, IniFile.m_nKeyLevel) And @@ -379,10 +379,10 @@ Public Class MainWindowVM IniFile.m_sLogFile = m_sTempDir & "\" & GENLOG_FILE_NAME.Replace("#", IniFile.m_nInstance.ToString()) Dim sLogMsg As String = "User " & Environment.MachineName & "\" & Environment.UserName & " Inst" & IniFile.m_nInstance.ToString() & - " Ulv" & IniFile.m_nUserLevel.ToString() & " Dbg" & DebugLevel().ToString() & vbLf & +" Ulv" & IniFile.m_nUserLevel.ToString() & " Dbg" & DebugLevel().ToString() & vbLf & My.Application.Info.Title.ToString() & " ver. " & m_sVersion EgtInit(m_nDebug, IniFile.m_sLogFile, sLogMsg) - EgtSetUserLevel( IniFile.m_nUserLevel) + EgtSetUserLevel(IniFile.m_nUserLevel) ' Leggo direttorio dei messaggi (se manca uso direttorio di configurazione) Dim sMsgDir As String = String.Empty If GetPrivateProfileString(S_GENERAL, K_MESSAGESDIR, "", sMsgDir) = 0 Then @@ -411,9 +411,9 @@ Public Class MainWindowVM ' Imposto dir di default per libreria Lua e lancio libreria di base Dim sLuaLibsDir As String = String.Empty GetPrivateProfileString(S_LUA, K_LIBSDIR, "", sLuaLibsDir) - #If PLATFORM = "x64" Then +#If PLATFORM = "x64" Then GetPrivateProfileString(S_LUA, K_LIBSDIR64, sLuaLibsDir, sLuaLibsDir) - #End If +#End If EgtSetLuaLibs(sLuaLibsDir) Dim sLuaBaseLib As String = String.Empty GetPrivateProfileString(S_LUA, K_BASELIB, "EgtBase", sLuaBaseLib) @@ -555,7 +555,7 @@ Public Class MainWindowVM WritePrivateProfileString(S_GRID, K_SNAPSTEPINCH, DoubleToString(IniFile.dSnapStepInch, 4)) End If ' gestisco la chiusura di DrawPanelVM - If Not IniFile.m_bFailedRun Then + If Not IniFile.m_bFailedRun AndAlso Not IsNothing(Map.refDrawPanelVM) Then WritePrivateProfileString(S_GENERAL, K_DRAW2D, If(Map.refDrawPanelVM.Draw2DIsExpanded, "1", "0")) WritePrivateProfileString(S_GENERAL, K_DRAW3D, If(Map.refDrawPanelVM.Draw3DIsExpanded, "1", "0")) WritePrivateProfileString(S_GENERAL, K_MODIFY, If(Map.refDrawPanelVM.ModifyIsExpanded, "1", "0")) @@ -567,7 +567,7 @@ Public Class MainWindowVM #Region "Events" - Private Sub MainWindow_KeyDown(ByVal sender As System.Object, ByVal e As KeyEventArgs) + Private Sub MainWindow_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) ' Con ESC esco dall'azione corrente If e.Key = Key.Escape Then ' reset Azione corrente @@ -593,4 +593,40 @@ Public Class MainWindowVM #End Region +#Region "MEF Plugin" + + Private m_Loader As MEFLoader = New MEFLoader() + + Private Function GetPathByName(ByVal name As String) As String + Dim PluginNameSplit() As String = name.Split("."c) + Dim res = Map.refMainWindowVM.m_sDataRoot & "\Plugin\" & PluginNameSplit(0) + Return res + End Function + + Friend Function GetControlByName(Of T)(ByVal name As String) As Panel + Dim PlugInControl As Object = m_Loader.LoadByTag(Of T)(GetPathByName(name), name).FirstOrDefault() + Dim PluginPanel As Panel = Nothing + Select Case PlugInControl.GetType().BaseType.FullName + Case GetType(Panel).FullName, GetType(Grid).FullName + PluginPanel = TryCast(PlugInControl, Panel) + Case GetType(Forms.UserControl).FullName + Dim PluginUserControl As Forms.UserControl = TryCast(PlugInControl, Forms.UserControl) + PluginPanel = New WinFormPluginControlV(New WinFormPluginControlVM(PluginUserControl)) + End Select + Return PluginPanel + End Function + + Friend Function GetConfigData(Of T)(ByVal name As String) As IPluginConfigData + Dim PlugInControl As Object = m_Loader.LoadByTag(Of T)(GetPathByName(name), name).FirstOrDefault() + Dim PluginConfigData As IPluginConfigData = Nothing + Dim v = PlugInControl.GetType() + If PlugInControl.GetType().Name = PLUGIN_CONFIGURATION_DATA Then + Return TryCast(PlugInControl, IPluginConfigData) + Else + Return Nothing + End If + End Function + +#End Region ' MEF Plugin + End Class \ No newline at end of file diff --git a/OptionPanel/MachiningOptionPanel/OperationsListExpander/OperationsListExpanderVM.vb b/OptionPanel/MachiningOptionPanel/OperationsListExpander/OperationsListExpanderVM.vb index 3a07d3d..fdb7238 100644 --- a/OptionPanel/MachiningOptionPanel/OperationsListExpander/OperationsListExpanderVM.vb +++ b/OptionPanel/MachiningOptionPanel/OperationsListExpander/OperationsListExpanderVM.vb @@ -971,8 +971,8 @@ Public Class OperationsListExpanderVM Map.refProjectVM.SceneSelMode = SceneSelModeOpt.ALL OnPropertyChanged("ListIsExpanded") Map.refMachinePanelVM.ToolMachSetUpIsEnabled(True, True, True) - Map.refDoorPanelVM.MTableIsEnabled(True) - Map.refSpecialPanelVM.SpecialPanelIsEnabled(True) + If Not IsNothing(Map.refDoorPanelVM) Then Map.refDoorPanelVM.MTableIsEnabled(True) + If Not IsNothing(Map.refSpecialPanelVM) Then Map.refSpecialPanelVM.SpecialPanelIsEnabled(True) Return True End Function diff --git a/Project/ProjectV.xaml b/Project/ProjectV.xaml index d946ce8..234c847 100644 --- a/Project/ProjectV.xaml +++ b/Project/ProjectV.xaml @@ -1,108 +1,26 @@ - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/Project/ProjectV.xaml.vb b/Project/ProjectV.xaml.vb index 67593ff..8f3119e 100644 --- a/Project/ProjectV.xaml.vb +++ b/Project/ProjectV.xaml.vb @@ -7,18 +7,17 @@ Public Class ProjectV Private m_bWall As Boolean = False Private m_bDoors As Boolean = False Private m_bGunStock As Boolean = False - Private m_bPrinting3d As Boolean = False Private Sub UserControl_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized ' Creo riferimento a questa classe in Map Map.SetRefProjectV(Me) - SpecialPanel.Visibility = Visibility.Collapsed - BeamPanel.Visibility = Visibility.Collapsed - WallPanel.Visibility = Visibility.Collapsed - DoorsPanel.Visibility = Visibility.Collapsed - GunStockPanel.Visibility = Visibility.Collapsed - PrintingPanel.Visibility = Visibility.Collapsed - Map.refMachGroupPanelVM.SetMachGroupPanelVisibility(False) ' MachGroupPanel.Visibility = Visibility.Collapsed + 'SpecialPanel.Visibility = Visibility.Collapsed + 'BeamPanel.Visibility = Visibility.Collapsed + 'WallPanel.Visibility = Visibility.Collapsed + 'DoorsPanel.Visibility = Visibility.Collapsed + 'GunStockPanel.Visibility = Visibility.Collapsed + 'PrintingPanel.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 @@ -48,7 +47,6 @@ Public Class ProjectV m_bWall = IniFile.IsActiveWall() m_bDoors = IniFile.IsActiveDoors() m_bGunStock = IniFile.IsActiveGunStock() - m_bPrinting3d = IniFile.IsActivePrinting3d() End Sub Private Sub PanelPositioning(FloatingPanel As EgtFloatingPanel, sState As String, nIndex As Integer, nLeft As Integer, nTop As Integer) @@ -67,47 +65,47 @@ Public Class ProjectV End Sub Friend Sub SetDbPanelVisibility() - DbPanel.Visibility = If(IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW, Visibility.Collapsed, Visibility.Visible) + 'DbPanel.Visibility = If(IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW, Visibility.Collapsed, Visibility.Visible) End Sub Friend Sub MachiningMode_IsChecked() - 'ShowPanel.Visibility = Visibility.Visible - ViewPanel.Visibility = Visibility.Visible - 'InstrumentPanel.Visibility = Visibility.Visible - GridPanel.Visibility = Visibility.Visible - DbPanel.Visibility = Visibility.Visible - ExecutePanel.Visibility = Visibility.Collapsed - SpecialPanel.Visibility = If(m_bSpecial And Map.refSpecialPanelVM.SetSpecialPanelButtonsVisibility(True), Visibility.Visible, Visibility.Collapsed) - BeamPanel.Visibility = Visibility.Collapsed - WallPanel.Visibility = Visibility.Collapsed - BeamWallPanel.Visibility = Visibility.Collapsed - DoorsPanel.Visibility = If(m_bDoors, Visibility.Visible, Visibility.Collapsed) - PrintingPanel.Visibility = Visibility.Collapsed - GunStockPanel.Visibility = Visibility.Collapsed - DrawPanel.Visibility = Visibility.Collapsed - OptionPanel.Visibility = Visibility.Visible + ''ShowPanel.Visibility = Visibility.Visible + 'ViewPanel.Visibility = Visibility.Visible + ''InstrumentPanel.Visibility = Visibility.Visible + 'GridPanel.Visibility = Visibility.Visible + 'DbPanel.Visibility = Visibility.Visible + 'ExecutePanel.Visibility = Visibility.Collapsed + 'SpecialPanel.Visibility = If(m_bSpecial And Map.refSpecialPanelVM.SetSpecialPanelButtonsVisibility(True), Visibility.Visible, Visibility.Collapsed) + 'BeamPanel.Visibility = Visibility.Collapsed + 'WallPanel.Visibility = Visibility.Collapsed + 'BeamWallPanel.Visibility = Visibility.Collapsed + 'DoorsPanel.Visibility = If(m_bDoors, Visibility.Visible, Visibility.Collapsed) + 'PrintingPanel.Visibility = Visibility.Collapsed + 'GunStockPanel.Visibility = Visibility.Collapsed + 'DrawPanel.Visibility = Visibility.Collapsed + 'OptionPanel.Visibility = Visibility.Visible Map.refMachGroupPanelVM.SetMachGroupPanelVisibility(IniFile.m_bMachiningGroup) ' MachGroupPanel.Visibility = If(IniFile.m_bMachiningGroup, Visibility.Visible, Visibility.Collapsed) If m_bDoors Then Map.refDoorPanelVM.SetDoorPanelButtonsVisibility(False) End Sub Friend Sub DrawMode_IsChecked() - 'ShowPanel.Visibility = Visibility.Visible - ViewPanel.Visibility = Visibility.Visible - 'InstrumentPanel.Visibility = Visibility.Visible - GridPanel.Visibility = Visibility.Visible - DbPanel.Visibility = If(IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW, Visibility.Collapsed, Visibility.Visible) - ExecutePanel.Visibility = Visibility.Visible - SpecialPanel.Visibility = If(m_bSpecial And Map.refSpecialPanelVM.SetSpecialPanelButtonsVisibility(False), Visibility.Visible, Visibility.Collapsed) - BeamPanel.Visibility = If(m_bBeam, Visibility.Visible, Visibility.Collapsed) - WallPanel.Visibility = If(m_bWall, Visibility.Visible, Visibility.Collapsed) - BeamWallPanel.Visibility = If(m_bBeam Or m_bWall, Visibility.Visible, Visibility.Collapsed) - DoorsPanel.Visibility = If(m_bDoors, Visibility.Visible, Visibility.Collapsed) - PrintingPanel.Visibility = If(m_bPrinting3d, Visibility.Visible, Visibility.Collapsed) - GunStockPanel.Visibility = If(m_bGunStock, Visibility.Visible, Visibility.Collapsed) - DrawPanel.Visibility = Visibility.Visible - OptionPanel.Visibility = Visibility.Visible - Map.refMachGroupPanelVM.SetMachGroupPanelVisibility(False) ' MachGroupPanel.Visibility = Visibility.Collapsed - If m_bDoors Then Map.refDoorPanelVM.SetDoorPanelButtonsVisibility(True) + ''ShowPanel.Visibility = Visibility.Visible + 'ViewPanel.Visibility = Visibility.Visible + ''InstrumentPanel.Visibility = Visibility.Visible + 'GridPanel.Visibility = Visibility.Visible + 'DbPanel.Visibility = If(IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW, Visibility.Collapsed, Visibility.Visible) + 'ExecutePanel.Visibility = Visibility.Visible + 'SpecialPanel.Visibility = If(m_bSpecial And Map.refSpecialPanelVM.SetSpecialPanelButtonsVisibility(False), Visibility.Visible, Visibility.Collapsed) + 'BeamPanel.Visibility = If(m_bBeam, Visibility.Visible, Visibility.Collapsed) + 'WallPanel.Visibility = If(m_bWall, Visibility.Visible, Visibility.Collapsed) + 'BeamWallPanel.Visibility = If(m_bBeam Or m_bWall, Visibility.Visible, Visibility.Collapsed) + 'DoorsPanel.Visibility = If(m_bDoors, Visibility.Visible, Visibility.Collapsed) + 'PrintingPanel.Visibility = If(m_bPrinting3d, Visibility.Visible, Visibility.Collapsed) + 'GunStockPanel.Visibility = If(m_bGunStock, Visibility.Visible, Visibility.Collapsed) + 'DrawPanel.Visibility = Visibility.Visible + 'OptionPanel.Visibility = Visibility.Visible + ' Map.refMachGroupPanelVM.SetMachGroupPanelVisibility(False) ' MachGroupPanel.Visibility = Visibility.Collapsed + ' If m_bDoors Then Map.refDoorPanelVM.SetDoorPanelButtonsVisibility(True) End Sub Private Sub UserControl_Unloaded(sender As Object, e As RoutedEventArgs) Handles Me.Unloaded diff --git a/Project/ProjectVM.vb b/Project/ProjectVM.vb index 7a41c9e..5e76842 100644 --- a/Project/ProjectVM.vb +++ b/Project/ProjectVM.vb @@ -7,86 +7,125 @@ Imports EgtWPFLib5 Imports EgtWPFLib5.EgtFloating Public Class ProjectVM - Inherits TabViewModel + Inherits TabViewModel #Region "FIELDS" - Friend Event OnPreControllerExec(sFilePath As String) - Friend Event OnPostControllerExec() + Friend Event OnPreControllerExec(sFilePath As String) + Friend Event OnPostControllerExec() - ' Variabili in cui salvo i filtri di selezione della modalità Draw e che poi ripristino all'uscita dalla modalità Machining - Private m_bSelZeroDim As Boolean = True - Private m_bSelCurve As Boolean = True - Private m_bSelSurf As Boolean = True - Private m_bSelVolume As Boolean = True - Private m_bSelExtra As Boolean = True + ' Variabili in cui salvo i filtri di selezione della modalità Draw e che poi ripristino all'uscita dalla modalità Machining + Private m_bSelZeroDim As Boolean = True + Private m_bSelCurve As Boolean = True + Private m_bSelSurf As Boolean = True + Private m_bSelVolume As Boolean = True + Private m_bSelExtra As Boolean = True - Private m_bLoaded As Boolean = False + Private m_bLoaded As Boolean = False - ' Variabile che contiene il Frame di disegno per poterlo ripristinare dopo essere passato dalla lavorazioneù - Private m_GridDrawFrame3d As Frame3d = New Frame3d(New Point3d(0, 0, 0)) + ' Variabile che contiene il Frame di disegno per poterlo ripristinare dopo essere passato dalla lavorazioneù + Private m_GridDrawFrame3d As Frame3d = New Frame3d(New Point3d(0, 0, 0)) - 'PROJECT PAGE'S SCENE FIELDS AND PROPERTIES - ' Reference to the ProjectScene - Private WithEvents m_ProjectScene As New Scene - ' Reference to the ProjectSceneHost - Private SceneHost As WindowsFormsHost - ' Property used to bind the scene to the WindowsFormsHost in XAML - Private m_bfirst As Boolean = True - Public ReadOnly Property ProjectSceneHost As WindowsFormsHost - Get - If m_bfirst Then - SceneHost = New WindowsFormsHost() With {.Child = m_ProjectScene} - m_bfirst = False - End If - Return SceneHost - End Get - End Property - ' Scene controller - Private WithEvents m_Controller As New Controller + 'PROJECT PAGE'S SCENE FIELDS AND PROPERTIES + ' Reference to the ProjectScene + Private WithEvents m_ProjectScene As New Scene + ' Reference to the ProjectSceneHost + Private SceneHost As WindowsFormsHost + ' Property used to bind the scene to the WindowsFormsHost in XAML + Private m_bfirst As Boolean = True + Public ReadOnly Property ProjectSceneHost As WindowsFormsHost + Get + If m_bfirst Then + SceneHost = New WindowsFormsHost() With {.Child = m_ProjectScene} + m_bfirst = False + End If + Return SceneHost + End Get + End Property + ' Scene controller + Private WithEvents m_Controller As New Controller - ' Definizione comandi - Private m_cmdLoaded As ICommand + ' Definizione comandi + Private m_cmdLoaded As ICommand - ' Flag per non salvare Script appena eseguito in elenco MruScript - Private m_bScriptInMru As Boolean = True + ' Flag per non salvare Script appena eseguito in elenco MruScript + Private m_bScriptInMru As Boolean = True + + Private m_PanelList As New List(Of Panel) + Public ReadOnly Property PanelList As List(Of Panel) + Get + Return m_PanelList + End Get + End Property #End Region #Region "EGTUILIB FIELDS" - Private m_bCPlaneTypePos As Boolean - 'Private m_bStopExec As Boolean = False - 'Private m_ProcEventsCallback As New ProcessEventsCallback(AddressOf ProcessEvents) - 'Private m_OutTextCallback As New OutTextCallback(AddressOf OutText) + Private m_bCPlaneTypePos As Boolean + 'Private m_bStopExec As Boolean = False + 'Private m_ProcEventsCallback As New ProcessEventsCallback(AddressOf ProcessEvents) + 'Private m_OutTextCallback As New OutTextCallback(AddressOf OutText) - ' Variabile per implementazione eventi - Private m_InputText As String + ' Variabile per implementazione eventi + Private m_InputText As String #End Region #Region "CONSTRUCTOR" - Sub New() - ' Creo riferimento a questa classe in EgtCAM5Map e in ButtonItem - Map.SetRefProjectVM(Me) - ButtonItem.m_ProjectVM = Me - ' Creo classe di supporto per la visualizzazione dei parametri utensile e di lavorazione per Db e operazioni - TMDbParamVisibility.bFirst = True - ' Inizializza i parametri della scena - 'InitializeEgtProject() - End Sub + Sub New() + ' Creo riferimento a questa classe in EgtCAM5Map e in ButtonItem + Map.SetRefProjectVM(Me) + ButtonItem.m_ProjectVM = Me + ' Creo classe di supporto per la visualizzazione dei parametri utensile e di lavorazione per Db e operazioni + TMDbParamVisibility.bFirst = True + ' Inizializza i parametri della scena + 'InitializeEgtProject() + ' aggiungo componenti interfaccia + Dim bPlugin As Boolean = True + If IsActivePlugin() Then + ' recupero nome del plugin + Dim PluginDirNameList() As String = Directory.GetDirectories(IniFile.m_sDataRoot & "\Plugin") + For Each PluginDirName In PluginDirNameList + Dim PluginName As String = Path.GetFileNameWithoutExtension(PluginDirName) + Dim ConfigurationData As IPluginConfigData = Map.refMainWindowVM.GetConfigData(Of IPluginConfigData)(PluginName & ".ConfigurationData") + If Not IsNothing(ConfigurationData) And ConfigurationData.ControlList.Count > 0 Then + For Each Element In ConfigurationData.ControlList + Select Case Element + Case PLUGIN_RIGHT_TRAY + m_PanelList.Add(New RightTrayV) + Case PLUGIN_LEFT_TRAY + m_PanelList.Add(New LeftTrayV) + Case Else + m_PanelList.Add(Map.refMainWindowVM.GetControlByName(Of IPluginControl)(Element)) + End Select + Next + End If + + Next + + m_PanelList.Add(New BottomTrayV) + m_PanelList.Add(New TopTrayV) + Else + m_PanelList.Add(New TopTrayV) + m_PanelList.Add(New LeftTrayV) + m_PanelList.Add(New RightTrayV) + m_PanelList.Add(New BottomTrayV) + End If + m_PanelList.Add(New SceneContentControlV) + End Sub #End Region #Region "Get & Set" - Friend Function GetScene() As Scene - Return m_ProjectScene - End Function + Friend Function GetScene() As Scene + Return m_ProjectScene + End Function - Friend Function GetController() As Controller - Return m_Controller - End Function + Friend Function GetController() As Controller + Return m_Controller + End Function #End Region ' Get & Set @@ -100,7 +139,7 @@ Public Class ProjectVM Public ReadOnly Property LoadedCommand As ICommand Get If m_cmdLoaded Is Nothing Then - m_cmdLoaded = New RelayCommand(AddressOf Loaded) + m_cmdLoaded = New RelayCommand(AddressOf Loaded) End If Return m_cmdLoaded End Get @@ -129,42 +168,42 @@ Public Class ProjectVM Map.refProjectV.SetDbPanelVisibility() End If ' Inizializzo gestore travi e pareti - If ( IniFile.m_nKeyOptions And KEY_OPT.BEAM) <> 0 Or ( IniFile.m_nKeyOptions And KEY_OPT.WALL) <> 0 Then - Dim nFlag As Integer = GetPrivateProfileInt( S_IMPORT, K_BTLFLAG, EIB_FL.NONE) - EgtInitBeamMgr( nFlag) + If (IniFile.m_nKeyOptions And KEY_OPT.BEAM) <> 0 Or (IniFile.m_nKeyOptions And KEY_OPT.WALL) <> 0 Then + Dim nFlag As Integer = GetPrivateProfileInt(S_IMPORT, K_BTLFLAG, EIB_FL.NONE) + EgtInitBeamMgr(nFlag) End If ' Log di eventuali estensioni - EgtOutLog( "Extensions :") + EgtOutLog("Extensions :") Dim bExtensions As Boolean = False If IniFile.IsActiveBeam() Then bExtensions = True Dim sVersion As String = "---" - IniFile.GetSpecialLuaVersion( IniFile.m_sBeamDirPath, sVersion) + IniFile.GetSpecialLuaVersion(IniFile.m_sBeamDirPath, sVersion) Dim sOut As String = "Beam ver. " & sVersion & " " & IniFile.m_sBeamDirPath - EgtOutLog( sOut) + EgtOutLog(sOut) End If If IniFile.IsActiveWall() Then bExtensions = True Dim sVersion As String = "---" - IniFile.GetSpecialLuaVersion( IniFile.m_sWallDirPath, sVersion) + IniFile.GetSpecialLuaVersion(IniFile.m_sWallDirPath, sVersion) Dim sOut As String = "Wall ver. " & sVersion & " " & IniFile.m_sWallDirPath - EgtOutLog( sOut) + EgtOutLog(sOut) End If If IniFile.IsActiveDoors() Then bExtensions = True Dim sVersion As String = "---" - IniFile.GetSpecialLuaVersion( IniFile.m_sDoorsDirPath, sVersion) + IniFile.GetSpecialLuaVersion(IniFile.m_sDoorsDirPath, sVersion) Dim sOut As String = "Doors ver. " & sVersion & " " & IniFile.m_sDoorsDirPath - EgtOutLog( sOut) + EgtOutLog(sOut) End If If IniFile.IsActiveGunStock() Then bExtensions = True Dim sVersion As String = "---" - IniFile.GetSpecialLuaVersion( IniFile.m_sGunstockDirPath, sVersion) + IniFile.GetSpecialLuaVersion(IniFile.m_sGunstockDirPath, sVersion) Dim sOut As String = "Gunstock ver. " & sVersion & " " & IniFile.m_sGunstockDirPath - EgtOutLog( sOut) + EgtOutLog(sOut) End If - If Not bExtensions Then EgtOutLog( "---") + If Not bExtensions Then EgtOutLog("---") ' Apro progetto vuoto Map.refTopCommandBarVM.NewCmd() ' Seleziono la macchina impostata nel file ini @@ -270,8 +309,8 @@ Public Class ProjectVM If Not m_Controller.SetCommandLog(bLuaReg, m_sTempDir, sCmdLogFile) Then EgtOutLog("Command log not started") If Environment.GetCommandLineArgs.Count() <= 1 Then - MessageBox.Show("Command log not started", "EgtCAM5 Warning", - MessageBoxButton.OK, MessageBoxImage.Warning) + MessageBox.Show("Command log not started", "EgtCAM5 Warning", + MessageBoxButton.OK, MessageBoxImage.Warning) End If End If m_Controller.SetSurfTmTolerance(OptionModule.m_dGeometryTolerance) @@ -323,9 +362,9 @@ Public Class ProjectVM ' lettura flag visualizzazione solo tavola in definizione lavorazioni IniFile.m_bShowOnlyTable = (GetPrivateProfileInt(S_MACH, K_SHOWONLYTABLE, 1) <> 0) ' ObjTree non selezionato - Map.refManageLayerExpanderVM.UpdateObjTreeOldId(GDB_ID.NULL) + If Not IsNothing(Map.refManageLayerExpanderVM) Then Map.refManageLayerExpanderVM.UpdateObjTreeOldId(GDB_ID.NULL) ' nascondo input box - Map.refInputExpanderVM.ResetInputBox() + If Not IsNothing(Map.refInputExpanderVM) Then Map.refInputExpanderVM.ResetInputBox() ' Imposto stato filtro selezione m_ProjectScene.GetObjFilterForSel(m_bSelZeroDim, m_bSelCurve, m_bSelSurf, m_bSelVolume, m_bSelExtra) m_Controller.MouseSetObjFilterForSelect(m_bSelZeroDim, m_bSelCurve, m_bSelSurf, m_bSelVolume, m_bSelExtra) @@ -412,8 +451,8 @@ Public Class ProjectVM Return End If ' Esecuzione - bOk = ExecBeam(sFile, sMachine, nFlag, true) - ' altrimenti pareti + bOk = ExecBeam(sFile, sMachine, nFlag, True) + ' altrimenti pareti Else ' Verifica abilitazione elaborazione pareti If Not VerifyWall(sFile, sMachine, nFlag) Then @@ -421,18 +460,18 @@ Public Class ProjectVM Return End If ' Esecuzione - bOk = ExecWall(sFile, sMachine, nFlag, true) + bOk = ExecWall(sFile, sMachine, nFlag, True) End If ' Se richiesta uscita immediata If nFlag = 0 Or nFlag = 3 Or nFlag = 4 Then Map.refMachinePanelVM.SaveCurrentMachine() Map.refMainWindowVM.CloseApplicationCmd() - ' Altrimenti se richiesta visualizzazione DB utensili + ' Altrimenti se richiesta visualizzazione DB utensili ElseIf nFlag = 11 And bOk Then MyMachinePanelVM.ToolDb() Map.refMachinePanelVM.SaveCurrentMachine() Map.refMainWindowVM.CloseApplicationCmd() - ' Altrimenti se richiesta visualizzazione DB lavorazioni + ' Altrimenti se richiesta visualizzazione DB lavorazioni ElseIf nFlag = 12 And bOk Then MyMachinePanelVM.MachDb() If bBeam Then @@ -442,7 +481,7 @@ Public Class ProjectVM End If Map.refMachinePanelVM.SaveCurrentMachine() Map.refMainWindowVM.CloseApplicationCmd() - ' Altrimenti se errore + ' Altrimenti se errore ElseIf Not bOk Then EgtZoom(ZM.ALL) End If @@ -503,8 +542,8 @@ Public Class ProjectVM Return End If ' Esecuzione - bOk = ExecBeam(sFile, sMachine, nFlag, false) - ' altrimenti pareti + bOk = ExecBeam(sFile, sMachine, nFlag, False) + ' altrimenti pareti ElseIf nBWType = 2 Then ' Verifica abilitazione elaborazione pareti If Not VerifyWall(sFile, sMachine, nFlag) Then @@ -512,13 +551,13 @@ Public Class ProjectVM Return End If ' Esecuzione - bOk = ExecWall(sFile, sMachine, nFlag, false) + bOk = ExecWall(sFile, sMachine, nFlag, False) End If ' Se richiesta uscita immediata If nFlag = 0 Or nFlag = 3 Or nFlag = 4 Then Map.refMachinePanelVM.SaveCurrentMachine() Map.refMainWindowVM.CloseApplicationCmd() - ' Altrimenti se errore + ' Altrimenti se errore ElseIf Not bOk Then EgtZoom(ZM.ALL) End If @@ -685,7 +724,7 @@ Public Class ProjectVM GetPrivateProfileString(S_GENERAL, K_LASTLUADIR, "", sDir) m_Controller.Exec(sDir) Else - If bRaiseEvent Then RaiseEvent OnPreControllerExec( sFilePath) + If bRaiseEvent Then RaiseEvent OnPreControllerExec(sFilePath) m_Controller.Exec(sFilePath, False) If bRaiseEvent Then RaiseEvent OnPostControllerExec() End If @@ -809,7 +848,7 @@ Public Class ProjectVM ' Copia dei file terminata con successo ... Dim sMsg As String = EgtMsg(8216) & vbCrLf & sFilePath & vbCrLf & "->" & sDirDest MessageBox.Show(sMsg, EgtMsg(8214), MessageBoxButton.OK, MessageBoxImage.Information) - else + Else ' Errore nella copia dei file ... Dim sMsg As String = EgtMsg(8255) & vbCrLf & sFilePath & vbCrLf & "->" & sDirDest MessageBox.Show(sMsg, EgtMsg(8251), MessageBoxButton.OK, MessageBoxImage.Error) @@ -1134,22 +1173,22 @@ Public Class ProjectVM ' Se eseguito drag If Not m_bDragToStart Then ' Basta reset alla fine - ' se sono in modalità movimento barre + ' se sono in modalità movimento barre ElseIf m_SelType = DispositionUtility.SelType.BARS Then ' Basta reset alla fine - ' Se selezione da eseguire + ' Se selezione da eseguire ElseIf m_nIdToSel <> GDB_ID.NULL Then ' se sono in modalità sottopezzi If m_SceneSelType = SceneSelTypeOpt.FIXTURE Then ' se il sottopezzo da selezionare è un riferimento e ci sono altri oggetti selezionati resetto lo stato di selezione ed esco - If DispositionUtility.FixtureType(m_nIdToSel) = DispositionUtility.FIX_TYPE.REFERENCE AndAlso + If DispositionUtility.FixtureType(m_nIdToSel) = DispositionUtility.FIX_TYPE.REFERENCE AndAlso EgtGetSelectedObjCount() > 0 Then m_bDrag = False m_nIdToSel = GDB_ID.NULL m_nIdToDesel = GDB_ID.NULL EgtDraw() Return - ' altrimenti verifico il tipo del primo oggetto selezionato + ' altrimenti verifico il tipo del primo oggetto selezionato Else Dim nFirstSelId As Integer = EgtGetFirstSelectedObj() ' se è un riferimento resetto lo stato di selezione ed esco @@ -1175,7 +1214,7 @@ Public Class ProjectVM End If ' Eseguo la selezione EgtSelectObj(m_nIdToSel) - ' Se deselezione da eseguire + ' Se deselezione da eseguire ElseIf m_nIdToDesel <> GDB_ID.NULL Then ' se l'elemento da deselezionare è marcato Dim bMarked As Boolean = False @@ -1217,9 +1256,9 @@ Public Class ProjectVM If Not bOk Then Return ' Impedisco la selezione di oggetti in modo Locked o Hidden Dim nMode As Integer = GDB_MD.STD - EgtGetCalcMode( nId, nMode) + EgtGetCalcMode(nId, nMode) If nMode <> GDB_MD.STD Then - bOk = False + bOk = False Return End If ' Se in modalità Draw accetto tutto @@ -1235,7 +1274,7 @@ Public Class ProjectVM End If Case SceneSelTypeOpt.MACHPATH Dim nCurrOpeId As Integer = Map.refOperationsListExpanderVM.GetOperationId(nId) - bOk = ( nCurrOpeId <> GDB_ID.NULL AndAlso nCurrOpeId <> m_nSelOpeId) + bOk = (nCurrOpeId <> GDB_ID.NULL AndAlso nCurrOpeId <> m_nSelOpeId) If m_nSelOpeId = GDB_ID.NULL Then m_nSelOpeId = nCurrOpeId Case Else bOk = False @@ -1268,15 +1307,15 @@ Public Class ProjectVM Private Sub OnMousePointFromSelection(ByVal sender As Object, ByVal nId As Integer, ByVal PtP As Point3d, ByVal nAux As Integer) Handles m_ProjectScene.OnMousePointFromSelection m_Controller.SetPointFromSelection(nId, PtP, nAux) 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 - If EgtIsSelectedObj( nId) Then - Dim nFac As Integer = If( EgtGetType( nId) = GDB_TY.SRF_MESH, Math.Max( EgtSurfTmFacetFromTria( nId, nAux), 0), nAux) - If Not SelData.FindIdSub( nId, nFac) Then + (EgtGetType(nId) = GDB_TY.SRF_MESH Or EgtGetType(nId) = GDB_TY.SRF_FRGN) Then + If EgtIsSelectedObj(nId) Then + Dim nFac As Integer = If(EgtGetType(nId) = GDB_TY.SRF_MESH, Math.Max(EgtSurfTmFacetFromTria(nId, nAux), 0), nAux) + If Not SelData.FindIdSub(nId, nFac) Then SelData.AddIdSub(nId, nFac) Else SelData.RemoveIdSub(nId, nFac) - If Not SelData.FindId( nId) Then - EgtDeselectObj( nId) + If Not SelData.FindId(nId) Then + EgtDeselectObj(nId) End If End If Else @@ -1310,29 +1349,29 @@ Public Class ProjectVM Analyze.ClearAnalyzeGroup() Map.refStatusBarVM.NotifyStatusOutput("") ' Se curva composita, visualizzo numerazione curve semplici - If EgtGetType( nId) = GDB_TY.CRV_COMPO Then + If EgtGetType(nId) = GDB_TY.CRV_COMPO Then ' Visualizzo numerazione Analyze.CreateAnalyzeGroup() - Analyze.CreateCurveCompoPntNbrs( nId) - ' Se superficie trimesh, visualizzo dati faccetta toccata - ElseIf EgtGetType( nId) = GDB_TY.SRF_MESH Then - Dim nFac As Integer = EgtSurfTmFacetFromTria( nId, nSub) + Analyze.CreateCurveCompoPntNbrs(nId) + ' Se superficie trimesh, visualizzo dati faccetta toccata + ElseIf EgtGetType(nId) = GDB_TY.SRF_MESH Then + Dim nFac As Integer = EgtSurfTmFacetFromTria(nId, nSub) If nFac <> -1 Then ' Visualizzo la normale e il contorno della faccia Analyze.CreateAnalyzeGroup() - Analyze.CreateNormal( nId, nFac) - Analyze.CreateFacetLoops( nId, nFac) + Analyze.CreateNormal(nId, nFac) + Analyze.CreateFacetLoops(nId, nFac) ' Recupero i dati (in globale o griglia a seconda della impostazione) Dim ptC As Point3d Dim vtN As Vector3d - EgtSurfTmFacetCenter( nId, nFac, If( m_bCPlaneTypePos, GDB_ID.GRID, GDB_ID.ROOT), ptC, vtN) + EgtSurfTmFacetCenter(nId, nFac, If(m_bCPlaneTypePos, GDB_ID.GRID, GDB_ID.ROOT), ptC, vtN) Dim dLen, dPhi, dTheta As Double - vtN.ToSpherical( dLen, dTheta, dPhi) + vtN.ToSpherical(dLen, dTheta, dPhi) ' Emetto info sulla barra di stato Dim sOut As String = "Facet " + nFac.ToString() + - " : C(" + LenToString( ptC.x, 3) + "," + LenToString( ptC.y, 3) + "," + LenToString( ptC.z, 3) + ")" + - " N(" + DoubleToString( vtN.x, 4) + "," + DoubleToString( vtN.y, 4) + "," + DoubleToString( vtN.z, 4) + ")" + - " / φ=" + DoubleToString( dPhi, 2) + " θ=" + DoubleToString( dTheta, 2) + " : C(" + LenToString(ptC.x, 3) + "," + LenToString(ptC.y, 3) + "," + LenToString(ptC.z, 3) + ")" + + " N(" + DoubleToString(vtN.x, 4) + "," + DoubleToString(vtN.y, 4) + "," + DoubleToString(vtN.z, 4) + ")" + + " / φ=" + DoubleToString(dPhi, 2) + " θ=" + DoubleToString(dTheta, 2) Map.refStatusBarVM.NotifyStatusOutput(sOut) End If End If @@ -1349,19 +1388,19 @@ Public Class ProjectVM If e.KeyData = System.Windows.Forms.Keys.Delete AndAlso Map.refTopCommandBarVM.DrawIsChecked Then m_Controller.SetLastInteger(GDB_ID.SEL) m_Controller.ExecuteCommand(Controller.CMD.DELETE) - ' Con END eseguo deselezione di tutto + ' Con END eseguo deselezione di tutto ElseIf e.KeyData = System.Windows.Forms.Keys.End Then - m_Controller.MouseDeselectedAll( True) - ' Con SPAZIO ripeto l'ultimo comando + m_Controller.MouseDeselectedAll(True) + ' Con SPAZIO ripeto l'ultimo comando ElseIf e.KeyData = System.Windows.Forms.Keys.Space Then m_Controller.RepeatLastCommand() - ' Con 'A' e in modalità continuazione, forzo il passaggio ad arco + ' Con 'A' e in modalità continuazione, forzo il passaggio ad arco ElseIf e.KeyData = System.Windows.Forms.Keys.A AndAlso m_Controller.GetContinue() Then m_Controller.ContinueArcPDP() - ' Con 'L' e in modalità continuazione, forzo il passaggio a retta + ' Con 'L' e in modalità continuazione, forzo il passaggio a retta ElseIf e.KeyData = System.Windows.Forms.Keys.L AndAlso m_Controller.GetContinue() Then m_Controller.ContinueLine2P() - ' Con 'V' cambio lo stato del check + ' Con 'V' cambio lo stato del check ElseIf e.KeyData = System.Windows.Forms.Keys.V Then Map.refInputExpanderVM.ChangeInputBoxCheck() End If @@ -1387,7 +1426,7 @@ Public Class ProjectVM End Sub Private Sub OnOpeningProject(ByVal sender As Object) Handles m_Controller.OnOpeningProject - Map.refManageLayerExpanderVM.ClearObjTree() + If Not IsNothing(Map.refManageLayerExpanderVM) Then Map.refManageLayerExpanderVM.ClearObjTree() End Sub Private Sub OnOpenProject(ByVal sender As Object, ByVal sFile As String, ByVal bOk As Boolean) Handles m_Controller.OnOpenProject @@ -1398,7 +1437,7 @@ Public Class ProjectVM Else IniFile.m_MruFiles.Remove(sFile) Dim sMsg As String - If My.Computer.FileSystem.FileExists( sFile) Then + If My.Computer.FileSystem.FileExists(sFile) Then sMsg = EgtMsg(10003) & " '" & sFile & "'" 'Error opening file Else sMsg = EgtMsg(10009) & " '" & sFile & "'" 'Missing file @@ -1500,7 +1539,7 @@ Public Class ProjectVM End If Else If m_bScriptInMru Then - If File.Exists( sFile) Then + If File.Exists(sFile) Then IniFile.m_MruScripts.Add(sFile) WritePrivateProfileString(S_GENERAL, K_LASTLUADIR, Path.GetDirectoryName(sFile)) Else @@ -1535,7 +1574,7 @@ Public Class ProjectVM Private Sub OnUpdateUI(ByVal sender As Object, ByVal bReloadUI As Boolean) Handles m_Controller.UpdateUI ' pulisco input e relativi messaggi - Map.refInputExpanderVM.ResetInputBox() + If Not IsNothing(Map.refInputExpanderVM) Then Map.refInputExpanderVM.ResetInputBox() If m_Controller.GetContinue() Then Map.refStatusBarVM.NotifyStatusOutput((EgtMsg(399))) ' Continue : 'L' with line, 'A' with arc Else @@ -1545,9 +1584,9 @@ Public Class ProjectVM EmitTitle() EmitCurrPartLayer() If bReloadUI Then - Map.refManageLayerExpanderVM.LoadObjTree() + If Not IsNothing(Map.refManageLayerExpanderVM) Then Map.refManageLayerExpanderVM.LoadObjTree() Else - Map.refManageLayerExpanderVM.UpdateObjTree() + If Not IsNothing(Map.refManageLayerExpanderVM) Then Map.refManageLayerExpanderVM.UpdateObjTree() End If ' aggiorno macchina corrente Map.refMachinePanelVM.UpdateCurrentMachine() @@ -1622,9 +1661,9 @@ Public Class ProjectVM EgtGetCalcColor(nCurrLayer, colObj) End If End If - Map.refManageLayerExpanderVM.UpdateHeaderName(sText) + If Not IsNothing(Map.refManageLayerExpanderVM) Then Map.refManageLayerExpanderVM.UpdateHeaderName(sText) colObj.A = 100 - Map.refManageLayerExpanderVM.UpdateHeaderColor(colObj) + If Not IsNothing(Map.refManageLayerExpanderVM) Then Map.refManageLayerExpanderVM.UpdateHeaderColor(colObj) End Sub #End Region 'DrawOptionPanel diff --git a/RightTray/RightTrayV.xaml b/RightTray/RightTrayV.xaml new file mode 100644 index 0000000..ce78fe0 --- /dev/null +++ b/RightTray/RightTrayV.xaml @@ -0,0 +1,15 @@ + + + + + diff --git a/RightTray/RightTrayV.xaml.vb b/RightTray/RightTrayV.xaml.vb new file mode 100644 index 0000000..cbac5e1 --- /dev/null +++ b/RightTray/RightTrayV.xaml.vb @@ -0,0 +1,3 @@ +Public Class RightTrayV + +End Class diff --git a/SceneContentControl/SceneContentControlV.xaml b/SceneContentControl/SceneContentControlV.xaml new file mode 100644 index 0000000..6f6a2ce --- /dev/null +++ b/SceneContentControl/SceneContentControlV.xaml @@ -0,0 +1,8 @@ + + + + + + diff --git a/SceneContentControl/SceneContentControlV.xaml.vb b/SceneContentControl/SceneContentControlV.xaml.vb new file mode 100644 index 0000000..ebb0df0 --- /dev/null +++ b/SceneContentControl/SceneContentControlV.xaml.vb @@ -0,0 +1,3 @@ +Public Class SceneContentControlV + +End Class diff --git a/Special-3dPrinting/Printing3DPanelV.xaml b/Special-3dPrinting/Printing3DPanelV.xaml deleted file mode 100644 index 4ed4ffd..0000000 --- a/Special-3dPrinting/Printing3DPanelV.xaml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/Special-3dPrinting/Printing3DPanelV.xaml.vb b/Special-3dPrinting/Printing3DPanelV.xaml.vb deleted file mode 100644 index f216a8c..0000000 --- a/Special-3dPrinting/Printing3DPanelV.xaml.vb +++ /dev/null @@ -1,3 +0,0 @@ -Public Class Printing3DPanelV - -End Class diff --git a/Special-3dPrinting/Printing3DPanelVM.vb b/Special-3dPrinting/Printing3DPanelVM.vb deleted file mode 100644 index 4b4142a..0000000 --- a/Special-3dPrinting/Printing3DPanelVM.vb +++ /dev/null @@ -1,26 +0,0 @@ -Imports System.IO -Imports EgtUILib - -Public Class Printing3DPanelVM - - Private m_ButtonList As New List(Of ButtonItem) - Public ReadOnly Property ButtonList As List(Of ButtonItem) - Get - Return m_ButtonList - End Get - End Property - - Sub New() - ' Se attivo, inizializzo i bottoni leggendoli da file ini - If IniFile.IsActivePrinting3d() Then - ' Inizializzo i bottoni leggendoli da file ini - Dim BtnIndex As Integer = 1 - Dim CurrBtn As ButtonItem = Nothing - While GetPrivateProfileButton(S_PRINTING3D, K_BUTTON & BtnIndex, IniFile.m_sPrinting3dDirPath, CurrBtn) - m_ButtonList.Add(CurrBtn) - BtnIndex += 1 - End While - End If - End Sub - -End Class diff --git a/Special-BeamWall/BeamPanelV.xaml b/Special-BeamWall/BeamPanelV.xaml index b972e6a..500c7fe 100644 --- a/Special-BeamWall/BeamPanelV.xaml +++ b/Special-BeamWall/BeamPanelV.xaml @@ -1,6 +1,8 @@ - + @@ -17,4 +19,4 @@ - + diff --git a/Special-BeamWall/BeamPanelVM.vb b/Special-BeamWall/BeamPanelVM.vb index a425142..dac9543 100644 --- a/Special-BeamWall/BeamPanelVM.vb +++ b/Special-BeamWall/BeamPanelVM.vb @@ -2,6 +2,7 @@ Imports EgtUILib Public Class BeamPanelVM + Inherits VMBase Friend Const BEAM_PROCESS As String = "Beam\Process.lua" Friend Const BEAM_MACHININGS As String = "BeamMachinings" @@ -13,7 +14,20 @@ Public Class BeamPanelVM End Get End Property + Private m_BeamPanel_Visibility As Visibility + Public ReadOnly Property BeamPanel_Visibility As Visibility + Get + Return m_BeamPanel_Visibility + End Get + End Property + Friend Sub SetBeamPanelVisibility(bValue As Boolean) + m_BeamPanel_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed) + NotifyPropertyChanged(NameOf(BeamPanel_Visibility)) + End Sub + Sub New() + ' Creo riferimento a questa classe in Map + Map.SetRefBeamPanelVM(Me) ' Se attivo, inizializzo i bottoni leggendoli da file ini If IniFile.IsActiveBeam() Then ' Inizializzo i bottoni leggendoli da file ini diff --git a/Special-BeamWall/BeamWallPanelV.xaml b/Special-BeamWall/BeamWallPanelV.xaml index 47648c7..21d3377 100644 --- a/Special-BeamWall/BeamWallPanelV.xaml +++ b/Special-BeamWall/BeamWallPanelV.xaml @@ -1,6 +1,8 @@ - + @@ -17,4 +19,4 @@ - + diff --git a/Special-BeamWall/BeamWallPanelVM.vb b/Special-BeamWall/BeamWallPanelVM.vb index 33b6bbe..cfdb5bc 100644 --- a/Special-BeamWall/BeamWallPanelVM.vb +++ b/Special-BeamWall/BeamWallPanelVM.vb @@ -2,6 +2,7 @@ Imports EgtUILib Public Class BeamWallPanelVM + Inherits VMBase Private m_ButtonList As New List(Of ButtonItem) Public ReadOnly Property ButtonList As List(Of ButtonItem) @@ -10,14 +11,27 @@ Public Class BeamWallPanelVM End Get End Property + Private m_BeamWallPanel_Visibility As Visibility + Public ReadOnly Property BeamWallPanel_Visibility As Visibility + Get + Return m_BeamWallPanel_Visibility + End Get + End Property + Friend Sub SetBeamWallPanelVisibility(bValue As Boolean) + m_BeamWallPanel_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed) + NotifyPropertyChanged(NameOf(BeamWallPanel_Visibility)) + End Sub + Sub New() + ' Creo riferimento a questa classe in Map + Map.SetRefBeamWallPanelVM(Me) ' Se attivo Beam o Wall, inizializzo i bottoni leggendoli da file ini If IniFile.IsActiveBeam() Or IniFile.IsActiveWall() Then - GetPrivateProfileString( S_BEAMWALL, K_BEAMWALLBASEDIR, "", m_sBeamWallDirPath) + GetPrivateProfileString(S_BEAMWALL, K_BEAMWALLBASEDIR, "", m_sBeamWallDirPath) ' Inizializzo i bottoni leggendoli da file ini Dim BtnIndex As Integer = 1 Dim CurrBtn As ButtonItem = Nothing - While GetPrivateProfileButton( S_BEAMWALL, K_BEAMWALLBUTTON & BtnIndex, IniFile.m_sBeamWallDirPath, CurrBtn) + While GetPrivateProfileButton(S_BEAMWALL, K_BEAMWALLBUTTON & BtnIndex, IniFile.m_sBeamWallDirPath, CurrBtn) m_ButtonList.Add(CurrBtn) BtnIndex += 1 End While diff --git a/Special-BeamWall/WallPanelV.xaml b/Special-BeamWall/WallPanelV.xaml index baae7cf..924c9f1 100644 --- a/Special-BeamWall/WallPanelV.xaml +++ b/Special-BeamWall/WallPanelV.xaml @@ -1,6 +1,8 @@ - + @@ -17,4 +19,4 @@ - + diff --git a/Special-BeamWall/WallPanelVM.vb b/Special-BeamWall/WallPanelVM.vb index b53fbf3..8725f28 100644 --- a/Special-BeamWall/WallPanelVM.vb +++ b/Special-BeamWall/WallPanelVM.vb @@ -2,6 +2,7 @@ Imports EgtUILib Public Class WallPanelVM + Inherits VMBase Friend Const WALL_MACHININGS As String = "WallMachinings" @@ -12,7 +13,20 @@ Public Class WallPanelVM End Get End Property + Private m_WallPanel_Visibility As Visibility + Public ReadOnly Property WallPanel_Visibility As Visibility + Get + Return m_WallPanel_Visibility + End Get + End Property + Friend Sub SetWallPanelVisibility(bValue As Boolean) + m_WallPanel_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed) + NotifyPropertyChanged(NameOf(WallPanel_Visibility)) + End Sub + Sub New() + ' Creo riferimento a questa classe in Map + Map.SetRefWallPanelVM(Me) ' Se attivo, inizializzo i bottoni leggendoli da file ini If IniFile.IsActiveWall() Then ' Inizializzo i bottoni leggendoli da file ini diff --git a/Special-Doors/DoorPanelV.xaml b/Special-Doors/DoorPanelV.xaml index 90b1e17..8a07e29 100644 --- a/Special-Doors/DoorPanelV.xaml +++ b/Special-Doors/DoorPanelV.xaml @@ -1,6 +1,8 @@ - + @@ -18,4 +20,4 @@ IsEnabled="{Binding MTableDb_IsEnabled}"/> - + diff --git a/Special-Doors/DoorPanelVM.vb b/Special-Doors/DoorPanelVM.vb index 861e99f..417aad5 100644 --- a/Special-Doors/DoorPanelVM.vb +++ b/Special-Doors/DoorPanelVM.vb @@ -31,6 +31,17 @@ Public Class DoorPanelVM End Get End Property + Private m_DoorPanel_Visibility As Visibility + Public ReadOnly Property DoorPanel_Visibility As Visibility + Get + Return m_DoorPanel_Visibility + End Get + End Property + Friend Sub SetDoorPanelVisibility(bValue As Boolean) + m_DoorPanel_Visibility = If(bValue, Visibility.Visible, Visibility.Collapsed) + OnPropertyChanged(NameOf(DoorPanel_Visibility)) + End Sub + ' Definizione comandi Private m_cmdDoors As ICommand Private m_cmdDMach As ICommand diff --git a/Special-GunStock/GunStockPanelV.xaml b/Special-GunStock/GunStockPanelV.xaml index ec8e36e..24d5569 100644 --- a/Special-GunStock/GunStockPanelV.xaml +++ b/Special-GunStock/GunStockPanelV.xaml @@ -1,6 +1,8 @@ - +