EgtCAM5 :

- eliminati tutti gli Application.Msn.Register/NotifyColleagues e la classe Messenger. Ora tutto ciò che eseguivano è in funzioni/sub Friend chiamate tramite i riferimenti in Map.
This commit is contained in:
Renzo Lanza
2020-10-28 14:09:17 +00:00
parent 22a569b5a5
commit fe58578e65
36 changed files with 978 additions and 1162 deletions
-8
View File
@@ -208,14 +208,6 @@ Class Application
Friend Const GUNSTOCKNEW As String = "GunStockNew"
Friend Const GUNSTOCKMODIF As String = "GunStockModif"
Shared ReadOnly _messenger As New Messenger()
Friend Shared ReadOnly Property Msn As Messenger
Get
Return _messenger
End Get
End Property
Private Sub Application_DispatcherUnhandledException(ByVal sender As System.Object, ByVal e As System.Windows.Threading.DispatcherUnhandledExceptionEventArgs)
MessageBox.Show(e.Exception.Message)
e.Handled = True
+3 -9
View File
@@ -439,19 +439,13 @@ Public Class DrawPanelVM
#Region "CONSTRUCTOR"
Sub New()
' Creo riferimento a questa classe in Map
Map.SetRefDrawPanelVM(Me)
' Leggo stato expander da file ini
Draw2DIsExpanded = If(GetPrivateProfileInt(S_GENERAL, K_DRAW2D, 0) = 0, False, True)
Draw3DIsExpanded = If(GetPrivateProfileInt(S_GENERAL, K_DRAW3D, 0) = 0, False, True)
ModifyIsExpanded = If(GetPrivateProfileInt(S_GENERAL, K_MODIFY, 0) = 0, False, True)
TransformIsExpanded = If(GetPrivateProfileInt(S_GENERAL, K_TRANSFORM, 0) = 0, False, True)
Application.Msn.Register(Application.CLOSEAPPLICATION, Sub()
If Not IniFile.m_bFailedRun Then
WritePrivateProfileString(S_GENERAL, K_DRAW2D, If(m_Draw2DIsExpanded, "1", "0"))
WritePrivateProfileString(S_GENERAL, K_DRAW3D, If(m_Draw3DIsExpanded, "1", "0"))
WritePrivateProfileString(S_GENERAL, K_MODIFY, If(m_ModifyIsExpanded, "1", "0"))
WritePrivateProfileString(S_GENERAL, K_TRANSFORM, If(m_TransformIsExpanded, "1", "0"))
End If
End Sub)
End Sub
#End Region ' Constructor
@@ -1700,7 +1694,7 @@ Public Class DrawPanelVM
End If
If Application.m_UpdateLayerTree Then
Application.Msn.NotifyColleagues(Application.LOADOBJTREE)
Map.refManageLayerExpanderVM.LoadObjTree()
Application.m_UpdateLayerTree = False
End If
End If
-1
View File
@@ -299,7 +299,6 @@
<DependentUpon>MyMachiningDbV.xaml</DependentUpon>
</Compile>
<Compile Include="MainWindow\MainWindowVM.vb" />
<Compile Include="Messenger.vb" />
<Compile Include="DrawPanel\DrawPanelV.xaml.vb">
<DependentUpon>DrawPanelV.xaml</DependentUpon>
</Compile>
+4 -4
View File
@@ -48,8 +48,8 @@ Public Class ExecutePanelVM
''' Execute the Exec. This method is invoked by the ExecCommand.
''' </summary>
Public Sub Exec(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.PREEXECSCRIPT, True)
Application.Msn.NotifyColleagues(Application.EXECSCRIPT, String.Empty)
Map.refProjectVM.PreExecScript(True)
Map.refProjectVM.ExecScript(String.Empty)
End Sub
#End Region ' ExecCommand
@@ -72,8 +72,8 @@ Public Class ExecutePanelVM
''' Execute the Open. This method is invoked by the OpenCommand.
''' </summary>
Public Shared Sub OpenMruScript(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.PREEXECSCRIPT, True)
Application.Msn.NotifyColleagues(Application.EXECSCRIPT, DirectCast(param, String).Replace("__", "_"))
Map.refProjectVM.PreExecScript(True)
Map.refProjectVM.ExecScript(DirectCast(param, String).Replace("__", "_"))
End Sub
#End Region ' OpenMruFileCommand
+15 -16
View File
@@ -32,8 +32,8 @@ Public Class InstrumentPanelVM
Map.refProjectVM.GetScene.SetStatusAnalyze()
Else
Map.refProjectVM.GetScene.ResetStatusAnalyze()
Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREE, GDB_ID.NULL)
Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, "")
Map.refManageLayerExpanderVM.SelectIdInObjTree(GDB_ID.NULL)
Map.refStatusBarVM.NotifyStatusOutput("")
Analyze.EraseAnalyzeGroup()
EgtDraw()
End If
@@ -68,7 +68,7 @@ Public Class InstrumentPanelVM
Map.refProjectVM.GetScene.SetStatusGetDistance()
Else
Map.refProjectVM.GetScene.ResetStatusGetDistance()
Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, String.Empty)
Map.refStatusBarVM.NotifyStatusOutput(String.Empty)
End If
OnPropertyChanged("GetDistIsChecked")
End If
@@ -81,21 +81,20 @@ Public Class InstrumentPanelVM
Sub New()
Map.SetRefInstrumentPanelVM(Me)
Application.Msn.Register(Application.MACHININGMODE_ISCHECKED, Sub()
AnalyzeIsChecked = False
AnalyzeIsEnabled = False
End Sub)
Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub()
AnalyzeIsEnabled = True
End Sub)
Application.Msn.Register(Application.ANALYZE_ISCHECKED, Sub(bIsChecked As Boolean)
AnalyzeIsChecked = bIsChecked
End Sub)
Application.Msn.Register(Application.GETDISTANCE_ISCHECKED, Sub(bIsChecked As Boolean)
GetDistIsChecked = bIsChecked
End Sub)
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Friend Sub Analyze_IsChecked(bIsChecked As Boolean)
AnalyzeIsChecked = bIsChecked
End Sub
Friend Sub GetDistance_IsChecked(bIsChecked As Boolean)
GetDistIsChecked = bIsChecked
End Sub
#End Region ' METHODS
End Class
+6 -6
View File
@@ -26,7 +26,7 @@ Public Class MyMachGroupPanelVM
SelectedMachGroup = MachGroupList.First(Function(x) x.Name = MachGroupName)
If IniFile.m_bShowOnlyTable Then EgtShowOnlyTable(True)
End If
Application.Msn.NotifyColleagues(Application.MACHGROUPSRESULT, nErr)
Map.refTopCommandBarVM.MachGroupsResult(nErr)
' Setto il Materiale in base alla Macchina associata al MachGroup selezionato
LoadMaterialType()
If nErr <> 0 Then EgtDraw()
@@ -306,8 +306,8 @@ Public Class MyMachGroupPanelVM
' MachGroupList.Add(sMachName)
' SelectedMachGroup = sMachName
' EgtDraw()
' Application.Msn.NotifyColleagues(Application.LOADOPERATIONLIST, GDB_ID.NULL)
' Application.Msn.NotifyColleagues(Application.UPDATECURRENTMACHINE)
' Map.refOperationsListExpanderVM.LoadOperationList(GDB_ID.NULL)
' Map.refOperationsListExpanderVM.UpdateCurrentMachine()
'End If
End Sub
@@ -343,7 +343,7 @@ Public Class MyMachGroupPanelVM
If IniFile.m_bShowOnlyTable Then EgtShowOnlyTable(True)
EgtZoom(ZM.ALL)
Map.refOperationsListExpanderVM.LoadOperationList(GDB_ID.NULL)
Application.Msn.NotifyColleagues(Application.UPDATECURRENTMACHINE)
Map.refMachinePanelVM.UpdateCurrentMachine()
End If
' cancello quello selezionato
EgtRemoveMachGroup(EgtGetMachGroupId(MachGroupList(nSelectedMachGroupIndex).Name))
@@ -362,8 +362,8 @@ Public Class MyMachGroupPanelVM
If IniFile.m_bShowOnlyTable Then EgtShowOnlyTable(True)
Map.refOperationsListExpanderVM.LoadOperationList(GDB_ID.NULL)
Application.Msn.NotifyColleagues(Application.UPDATECURRENTMACHINE)
Application.Msn.NotifyColleagues(Application.UPDATEOPERATIONMACHININGLIST)
Map.refMachinePanelVM.UpdateCurrentMachine()
Map.refMachiningTreeExpanderVM.UpdateOperationMachiningList()
Map.refEstimationsExpanderVM.Estimation_IsEnabled =
(EgtUILib.GetPrivateProfileInt(S_ESTIMATIONS, K_EST_ENABLE, 0, IniFile.m_sCurrMachIniFilePath) <> 0)
' Setto il Materiale in base alla Macchina associata al MachGroup corrente
+38 -53
View File
@@ -136,64 +136,49 @@ Public Class MyMachinePanelVM
Map.SetRefMachinePanelVM(Me)
SearchMachines()
Application.Msn.Register(Application.LOADCURRENTMACHINE, Sub()
If m_MachinesList.Count = 0 Then Return
Dim CurrMach As String = String.Empty
GetPrivateProfileString(S_MACH, K_CURRMACH, String.Empty, CurrMach)
Dim bFound As Boolean = False
If Not String.IsNullOrEmpty(CurrMach) Then
For Each Mach In MachinesList
If Mach.Name = CurrMach Then
bFound = True
SelectedMachine = Mach
Exit For
End If
Next
End If
If Not bFound And MachinesList.Count > 0 Then
SelectedMachine = MachinesList(0)
End If
End Sub)
Application.Msn.Register(Application.SAVECURRENTMACHINE, Sub()
If IsNothing(m_SelectedMachine) Then Return
WritePrivateProfileString(S_MACH, K_CURRMACH, SelectedMachine.Name)
End Sub)
Application.Msn.Register(Application.UPDATECURRENTMACHINE, Sub()
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
Dim sMachName As String = String.Empty
If EgtGetCurrMachineName(sMachName) Then
For Each Mach In MachinesList
If Mach.Name = sMachName Then
SelectedMachine = Mach
Exit For
End If
Next
End If
End Sub)
Application.Msn.Register(Application.MAINWINDOW_CONTENTRENDERED, Sub()
'If IniFile.m_bMmUnits Then
' GridDimensionText = LenToString(IniFile.dSnapStepMm, 4)
'Else
' GridDimensionText = LenToString(IniFile.dSnapStepInch, 4)
'End If
If IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then
MachineListIsEnabled = False
End If
End Sub)
Application.Msn.Register(Application.MACHININGMODE_ISCHECKED, Sub()
'OutputMessage = String.Empty
MachineListIsEnabled = False
End Sub)
Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub()
'OutputMessage = String.Empty
MachineListIsEnabled = True
End Sub)
End Sub
#End Region ' Constructor
#Region "METHODS"
Friend Sub LoadCurrentMachine()
If m_MachinesList.Count = 0 Then Return
Dim CurrMach As String = String.Empty
GetPrivateProfileString(S_MACH, K_CURRMACH, String.Empty, CurrMach)
Dim bFound As Boolean = False
If Not String.IsNullOrEmpty(CurrMach) Then
For Each Mach In MachinesList
If Mach.Name = CurrMach Then
bFound = True
SelectedMachine = Mach
Exit For
End If
Next
End If
If Not bFound And MachinesList.Count > 0 Then
SelectedMachine = MachinesList(0)
End If
End Sub
Friend Sub SaveCurrentMachine()
If IsNothing(m_SelectedMachine) Then Return
WritePrivateProfileString(S_MACH, K_CURRMACH, SelectedMachine.Name)
End Sub
Friend Sub UpdateCurrentMachine()
EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
Dim sMachName As String = String.Empty
If EgtGetCurrMachineName(sMachName) Then
For Each Mach In MachinesList
If Mach.Name = sMachName Then
SelectedMachine = Mach
Exit For
End If
Next
End If
End Sub
Friend Sub ToolMachSetUpIsEnabled(ToolDb_IsEnabled As Boolean, MachDb_IsEnabled As Boolean, SetUpDb_IsEnabled As Boolean)
m_ToolDb_IsEnabled = ToolDb_IsEnabled
m_MachDb_IsEnabled = MachDb_IsEnabled
@@ -350,7 +335,7 @@ Public Class MyMachinePanelVM
' creo ed apro finestra SetUp
Dim SetUpDbWindow As New SetUpDbV(Application.Current.MainWindow, New SetUpDbVM)
SetUpDbWindow.ShowDialog()
Application.Msn.NotifyColleagues(Application.EMITTITLE)
Map.refProjectVM.EmitTitle()
End Sub
#End Region ' SetUpCommand
+95 -39
View File
@@ -95,8 +95,6 @@ Public Class MainWindowVM
' INITIALIZE EGALTECH ENVIRONMENT
InitializeEgtEnvironment()
RegisterMyMessages()
AddHandler Application.Current.MainWindow.KeyDown, AddressOf MainWindow_KeyDown
End Sub
@@ -152,14 +150,14 @@ Public Class MainWindowVM
End If
If IniFile.m_bSimulExecuting Then
' Avvio l'arresto della simulazione
refSimulationExpanderVM.SetStatus( MCH_SIM_ST.UI_STOP)
refSimulationExpanderVM.SetStatus(MCH_SIM_ST.UI_STOP)
IniFile.m_bSimulEndExitApp = True
Return
End If
' Gestisco eventuale file corrente modificato
Application.Msn.NotifyColleagues(Application.MANAGEMODIFIED)
Map.refProjectVM.ManageModified()
If m_allowWindowToClose Then
Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATION)
Map.refMainWindowVM.ManageClosingApplication()
' Salvo posizione Form (se non minimizzato)
If Application.Current.MainWindow.WindowState <> WindowState.Minimized Then
Dim WinPos As New WinPos
@@ -169,9 +167,9 @@ Public Class MainWindowVM
' Terminazione generale di EgtInterface
EgtExit()
' Salvo impostazione macchina corrente
Application.Msn.NotifyColleagues(Application.SAVECURRENTMACHINE)
Map.refMachinePanelVM.SaveCurrentMachine()
' Aggiorno istanze usate
m_objMutex.WaitOne( 1000)
m_objMutex.WaitOne(1000)
Dim nTmp As Integer = GetPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
nTmp -= (1 << (IniFile.m_nInstance - 1))
WritePrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
@@ -208,10 +206,10 @@ Public Class MainWindowVM
' Se errore di protezione, non posso proseguire
If IniFile.m_nKeyLevel < 0 Then Return
' Notify the ContentRendered event
Application.Msn.NotifyColleagues(Application.MAINWINDOW_CONTENTRENDERED)
NotifyMainWindow_ContentRendered()
' se sono in modalità solo cad
If IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then
Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, "Impossible finding Machines dir. EgtCAM5 will run in CAD-ONLY mode.")
Map.refStatusBarVM.NotifyStatusOutput("Impossible finding Machines dir. EgtCAM5 will run in CAD-ONLY mode.")
End If
End Sub
@@ -236,7 +234,7 @@ Public Class MainWindowVM
''' </summary>
Public Sub MainWindow_Activated(ByVal param As Object)
' Notify the ContentRendered event
Application.Msn.NotifyColleagues(Application.MAINWINDOW_ACTIVATED)
End Sub
#End Region ' Activated Command
@@ -260,7 +258,7 @@ Public Class MainWindowVM
''' </summary>
Public Sub MainWindow_Deactivated(ByVal param As Object)
' Notify the ContentRendered event
Application.Msn.NotifyColleagues(Application.MAINWINDOW_DEACTIVATED)
End Sub
#End Region ' Deactivated Command
@@ -269,33 +267,39 @@ Public Class MainWindowVM
#Region "METHODS"
Private Sub RegisterMyMessages()
Application.Msn.Register(Application.CLOSEAPPLICATIONCOMMAND, Sub()
Application.Msn.NotifyColleagues(Application.CLOSEAPPLICATION)
' Terminazione generale di EgtInterface
EgtExit()
' Rilascio mutex
If Not IsNothing(m_objMutex) Then m_objMutex.Close()
' Aggiorno istanze usate
Dim nTmp As Integer = GetPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
nTmp -= (1 << (IniFile.m_nInstance - 1))
WritePrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
Application.Current.Shutdown()
End Sub)
Application.Msn.Register(Application.ALLOWWINDOWTOCLOSE, Sub(bBoolean As Boolean)
m_allowWindowToClose = bBoolean
End Sub)
Application.Msn.Register(Application.UPDATEMAINWINDOWTITLE, Sub(sString As String)
Title = sString
End Sub)
#Region "RegisterMyMessages"
Friend Sub CloseApplicationCmd()
Map.refMainWindowVM.ManageClosingApplication()
' Terminazione generale di EgtInterface
EgtExit()
' Rilascio mutex
If Not IsNothing(m_objMutex) Then m_objMutex.Close()
' Aggiorno istanze usate
Dim nTmp As Integer = GetPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
nTmp -= (1 << (IniFile.m_nInstance - 1))
WritePrivateProfileString(S_GENERAL, K_INSTANCES, nTmp.ToString())
Application.Current.Shutdown()
End Sub
Friend Sub AllowWindowToClose(bBoolean As Boolean)
m_allowWindowToClose = bBoolean
End Sub
Friend Sub UpdateMainWindowTitle(sString As String)
Title = sString
End Sub
#End Region
''' <summary>
''' Method that initialize EgalTech environment
''' </summary>
Private Sub InitializeEgtEnvironment()
' Title
Application.Msn.NotifyColleagues(Application.EMITTITLE)
If Not IsNothing(Map.refProjectVM) Then
Map.refProjectVM.EmitTitle()
End If
' 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
@@ -410,7 +414,7 @@ Public Class MainWindowVM
Private Sub ManageInstance()
Dim bCreated As Boolean
Try
m_objMutex = New Mutex( True, "Global\EgtCAM5", bCreated)
m_objMutex = New Mutex(True, "Global\EgtCAM5", bCreated)
Catch
bCreated = False
End Try
@@ -428,7 +432,7 @@ Public Class MainWindowVM
nMaxInst = Max(1, Min(nMaxInst, MAX_INST))
' Richiedo il possesso del mutex
Dim bOk As Boolean = False
if m_objMutex.WaitOne( 500) then
If m_objMutex.WaitOne(500) Then
' Cerco il primo indice di istanza libero (max 32)
Dim nTmp As Integer = GetPrivateProfileInt(S_GENERAL, K_INSTANCES, 0)
IniFile.m_nInstance = 1
@@ -472,11 +476,63 @@ Public Class MainWindowVM
Next
End If
' esco dal programma
Environment.Exit( 1)
Environment.Exit(1)
End If
End If
End Sub
Friend Sub NotifyMainWindow_ContentRendered()
' Notifico ProjectVM
Map.refProjectVM.ProcessCommandLine()
' Notifico MyMachinePanelVM
If IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then
Map.refMachinePanelVM.MachineListIsEnabled = False
End If
' Notifico MyStatusBarVM
If IniFile.m_bMmUnits Then
Map.refStatusBarVM.GridDimensionText = LenToString(IniFile.dSnapStepMm, 4)
Else
Map.refStatusBarVM.GridDimensionText = LenToString(IniFile.dSnapStepInch, 4)
End If
' Notifico TopCommandBarVM
If IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then
Map.refTopCommandBarVM.MachiningIsEnabled = False
Else
Map.refTopCommandBarVM.MachiningIsEnabled = True
End If
End Sub
Friend Sub ManageClosingApplication()
' gestisco la chiusura di SimulationExpanderVM
If Not IsNothing(Map.refSimulationExpanderVM) Then
If Map.refSimulationExpanderVM.Simulation_IsExpanded Then
Map.refSimulationExpanderVM.ResetSimulation()
End If
End If
' gestisco la chiusura di ProjectVM
If Not IniFile.m_bFailedRun Then
' Salvo modo di visualizzazione
WritePrivateProfileString(S_SCENE, K_SHOWMODE, EgtGetShowMode().ToString)
' Salvo stato visualizzazione direzione curve
WritePrivateProfileString(S_SCENE, K_CURVEDIR, If(EgtGetShowCurveDirection(), 1, 0).ToString)
' Salvo stato visualizzazione griglia
WritePrivateProfileString(S_GRID, K_DRAWSHOWGRID, If(IniFile.m_bDrawShowGrid, 1, 0).ToString)
WritePrivateProfileString(S_GRID, K_MACHININGSHOWGRID, If(IniFile.m_bMachiningShowGrid, 1, 0).ToString)
' Salvo stato unità di misura per interfaccia utente
WritePrivateProfileString(S_SCENE, K_MMUNITS, If(IniFile.m_bMmUnits, 1, 0).ToString)
' Salvo dimensioni griglie in Mm e Inch
WritePrivateProfileString(S_GRID, K_SNAPSTEP, DoubleToString(IniFile.dSnapStepMm, 4))
WritePrivateProfileString(S_GRID, K_SNAPSTEPINCH, DoubleToString(IniFile.dSnapStepInch, 4))
End If
' gestisco la chiusura di DrawPanelVM
If Not IniFile.m_bFailedRun 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"))
WritePrivateProfileString(S_GENERAL, K_TRANSFORM, If(Map.refDrawPanelVM.TransformIsExpanded, "1", "0"))
End If
End Sub
#End Region
#Region "Events"
@@ -485,13 +541,13 @@ Public Class MainWindowVM
' Con ESC esco dall'azione corrente
If e.Key = Key.Escape Then
' reset Azione corrente
Application.Msn.NotifyColleagues(Application.RESETSTATUS)
Map.refProjectVM.ResetStatus()
' reset Analisi e Distanza
Application.Msn.NotifyColleagues(Application.ANALYZE_ISCHECKED, False)
Application.Msn.NotifyColleagues(Application.GETDISTANCE_ISCHECKED, False)
Map.refInstrumentPanelVM.Analyze_IsChecked(False)
Map.refInstrumentPanelVM.GetDistance_IsChecked(False)
' pulisco output
Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, "")
Application.Msn.NotifyColleagues(Application.RESETINPUTBOX)
Map.refStatusBarVM.NotifyStatusOutput("")
Map.refInputExpanderVM.ResetInputBox()
End If
End Sub
-229
View File
@@ -1,229 +0,0 @@
Imports System.Reflection
''' <summary>
''' Provides loosely-coupled messaging between
''' various colleague objects. All references to objects
''' are stored weakly, to prevent memory leaks.
''' </summary>
Public Class Messenger
Public Sub New()
End Sub
''' <summary>
''' Registers a callback method to be invoked when a specific message is broadcasted.
''' </summary>
''' <param name="message">The message to register for.</param>
''' <param name="callback">The callback to be called when this message is broadcasted.</param>
Public Sub Register(ByVal message As String, ByVal callback As [Delegate])
If String.IsNullOrEmpty(message) Then
Throw New ArgumentException("'message' cannot be null or empty.")
End If
If callback Is Nothing Then
Throw New ArgumentNullException("callback")
End If
Dim parameters As ParameterInfo() = callback.Method.GetParameters()
If parameters IsNot Nothing AndAlso parameters.Length > 1 Then
Throw New InvalidOperationException("The registered delegate can have no more than one parameter.")
End If
Dim parameterType As Type = If((parameters Is Nothing OrElse parameters.Length = 0), Nothing, parameters(0).ParameterType)
_messageToActionsMap.AddAction(message, callback.Target, callback.Method, parameterType)
End Sub
''' <summary>
''' Notifies all registered parties that a message is being broadcasted.
''' </summary>
''' <param name="message">The message to broadcast.</param>
Public Sub NotifyColleagues(ByVal message As String)
If String.IsNullOrEmpty(message) Then
Throw New ArgumentException("'message' cannot be null or empty.")
End If
Dim actions = _messageToActionsMap.GetActions(message)
If actions IsNot Nothing Then
actions.ForEach(Function(action) action.DynamicInvoke())
End If
End Sub
''' <summary>
''' Notifies all registered parties that a message is being broadcasted.
''' </summary>
''' <param name="message">The message to broadcast</param>
''' <param name="parameter">The parameter to pass together with the message</param>
Public Sub NotifyColleagues(ByVal message As String, ByVal parameter As Object)
If String.IsNullOrEmpty(message) Then
Throw New ArgumentException("'message' cannot be null or empty.")
End If
Dim actions = _messageToActionsMap.GetActions(message)
If actions IsNot Nothing Then
actions.ForEach(Function(action) action.DynamicInvoke(parameter))
End If
End Sub
''' <summary>
''' This class is an implementation detail of the Messenger class.
''' </summary>
Private Class MessageToActionsMap
' Stores a hash where the key is the message and the value is the list of callbacks to invoke.
ReadOnly _map As New Dictionary(Of String, List(Of WeakAction))()
Friend Sub New()
End Sub
''' <summary>
''' Adds an action to the list.
''' </summary>
''' <param name="message">The message to register.</param>
''' <param name="target">The target object to invoke, or null.</param>
''' <param name="method">The method to invoke.</param>
''' <param name="actionType">The type of the Action delegate.</param>
Friend Sub AddAction(ByVal message As String, ByVal target As Object, ByVal method As MethodInfo, ByVal actionType As Type)
If message Is Nothing Then
Throw New ArgumentNullException("message")
End If
If method Is Nothing Then
Throw New ArgumentNullException("method")
End If
SyncLock _map
If Not _map.ContainsKey(message) Then
_map(message) = New List(Of WeakAction)()
End If
_map(message).Add(New WeakAction(target, method, actionType))
End SyncLock
End Sub
''' <summary>
''' Gets the list of actions to be invoked for the specified message
''' </summary>
''' <param name="message">The message to get the actions for</param>
''' <returns>Returns a list of actions that are registered to the specified message</returns>
Friend Function GetActions(ByVal message As String) As List(Of [Delegate])
If message Is Nothing Then
Throw New ArgumentNullException("message")
End If
Dim actions As List(Of [Delegate])
SyncLock _map
If Not _map.ContainsKey(message) Then
Return Nothing
End If
Dim weakActions As List(Of WeakAction) = _map(message)
actions = New List(Of [Delegate])(weakActions.Count)
For i As Integer = weakActions.Count - 1 To -1 + 1 Step -1
Dim weakAction As WeakAction = weakActions(i)
If weakAction Is Nothing Then
Continue For
End If
Dim action As [Delegate] = weakAction.CreateAction()
If action IsNot Nothing Then
actions.Add(action)
Else
' The target object is dead, so get rid of the weak action.
weakActions.Remove(weakAction)
End If
Next
' Delete the list from the map if it is now empty.
If weakActions.Count = 0 Then
_map.Remove(message)
End If
End SyncLock
Return actions
End Function
End Class
''' <summary>
''' This class is an implementation detail of the MessageToActionsMap class.
''' </summary>
Private Class WeakAction
ReadOnly _delegateType As Type
ReadOnly _method As MethodInfo
ReadOnly _targetRef As WeakReference
''' <summary>
''' Constructs a WeakAction.
''' </summary>
''' <param name="target">The object on which the target method is invoked, or null if the method is static.</param>
''' <param name="method">The MethodInfo used to create the Action.</param>
''' <param name="parameterType">The type of parameter to be passed to the action. Pass null if there is no parameter.</param>
Friend Sub New(ByVal target As Object, ByVal method As MethodInfo, ByVal parameterType As Type)
If target Is Nothing Then
_targetRef = Nothing
Else
_targetRef = New WeakReference(target)
End If
_method = method
If parameterType Is Nothing Then
_delegateType = GetType(Action)
Else
_delegateType = GetType(Action(Of )).MakeGenericType(parameterType)
End If
End Sub
''' <summary>
''' Creates a "throw away" delegate to invoke the method on the target, or null if the target object is dead.
''' </summary>
Friend Function CreateAction() As [Delegate]
' Rehydrate into a real Action object, so that the method can be invoked.
If _targetRef Is Nothing Then
Return [Delegate].CreateDelegate(_delegateType, _method)
Else
Try
Dim target As Object = _targetRef.Target
If target IsNot Nothing Then
Return [Delegate].CreateDelegate(_delegateType, target, _method)
End If
Catch
End Try
End If
Return Nothing
End Function
End Class
ReadOnly _messageToActionsMap As New MessageToActionsMap()
End Class
@@ -45,15 +45,11 @@ Public Class InfoExpanderVM
End Property
Sub New()
Application.Msn.Register(Application.UPDATEOBJDATAINOBJTREE, Sub(Id As Integer)
UpdateObjDataInObjTree(Id)
End Sub)
Application.Msn.Register(Application.SETINFOBOX, Sub(sString As String)
InfoBox = sString
End Sub)
' Creo riferimento a questa classe in EgtCAM5Map
Map.SetRefInfoExpanderVM(Me)
End Sub
Private Sub UpdateObjDataInObjTree(ByVal nId As Integer)
Friend Sub UpdateObjDataInObjTree(ByVal nId As Integer)
' recupero il tipo del nuovo oggetto
Dim nType As Integer = EgtGetType(nId)
' stampa dei dati dell'oggetto
@@ -79,4 +75,8 @@ Public Class InfoExpanderVM
End If
End Sub
Friend Sub SetInfoBox(sString As String)
InfoBox = sString
End Sub
End Class
@@ -60,7 +60,7 @@ Public Class InputExpanderVM
End Get
Set(value As String)
m_TextBox = value
Application.Msn.NotifyColleagues(Application.NOTIFYINPUTTEXT, value)
Map.refProjectVM.NotifyInputText(value)
OnPropertyChanged("TextBox")
End Set
End Property
@@ -108,7 +108,7 @@ Public Class InputExpanderVM
End Get
Set(value As Boolean)
If value <> m_IsChecked Then
Application.Msn.NotifyColleagues(Application.SETLASTBOOLEAN, value)
Map.refProjectVM.SetLastBoolean(value)
m_IsChecked = value
OnPropertyChanged("IsChecked")
End If
@@ -146,7 +146,7 @@ Public Class InputExpanderVM
Return m_ComboSelectedIndex
End Get
Set(value As Integer)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, value)
Map.refProjectVM.SetLastInteger(value)
m_ComboSelectedIndex = value
OnPropertyChanged("ComboSelectedIndex")
End Set
@@ -201,7 +201,8 @@ Public Class InputExpanderVM
#Region "CONSTRUCTOR"
Sub New()
RegisterMethodsCall()
' Creo riferimento a questa classe in EgtCAM5Map
Map.SetRefInputExpanderVM(Me)
End Sub
#End Region ' Constructor
@@ -226,7 +227,7 @@ Public Class InputExpanderVM
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Show(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SHOW, TextBox)
Map.refProjectVM.Show(TextBox)
End Sub
''' <summary>
@@ -256,7 +257,7 @@ Public Class InputExpanderVM
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Done(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.DONE, m_TextBox)
Map.refProjectVM.Done(m_TextBox)
End Sub
''' <summary>
@@ -272,28 +273,7 @@ Public Class InputExpanderVM
#Region "METHODS"
Sub RegisterMethodsCall()
Application.Msn.Register(Application.PREPAREINPUTBOX, Sub(PrepareInputBoxParam As PrepareInputBoxParam)
PrepareInputBox(PrepareInputBoxParam)
End Sub)
Application.Msn.Register(Application.SETINPUTBOXTEXT, Sub(sString As String)
SetInputBoxText(sString)
End Sub)
Application.Msn.Register(Application.SETINPUTBOXCHECK, Sub(bBoolean As Boolean)
SetInputBoxCheck(bBoolean)
End Sub)
Application.Msn.Register(Application.CHANGEINPUTBOXCHECK, Sub()
ChangeInputBoxCheck()
End Sub)
Application.Msn.Register(Application.ADDINPUTBOXCOMBO, Sub(AddInputBoxComboParam As AddInputBoxComboParam)
AddInputBoxCombo(AddInputBoxComboParam.sText, AddInputBoxComboParam.bSelected)
End Sub)
Application.Msn.Register(Application.RESETINPUTBOX, Sub()
ResetInputBox()
End Sub)
End Sub
Private Sub PrepareInputBox(PrepareInputBoxParam As PrepareInputBoxParam)
Friend Sub PrepareInputBox(PrepareInputBoxParam As PrepareInputBoxParam)
Title = PrepareInputBoxParam.sTitle
If PrepareInputBoxParam.sLabel <> "" Then
TextBlock = PrepareInputBoxParam.sLabel
@@ -316,7 +296,7 @@ Public Class InputExpanderVM
FocusTextBox = True
End Sub
Private Sub ResetInputBox()
Friend Sub ResetInputBox()
Title = EgtMsg(MSG_DRAWOPTION + 5)
TextVisibility = Visibility.Collapsed
CheckVisibility = Visibility.Collapsed
@@ -326,23 +306,27 @@ Public Class InputExpanderVM
IsEnabled = False
End Sub
Private Function SetInputBoxText(ByVal sVal As String) As Boolean
Friend Function SetInputBoxText(ByVal sVal As String) As Boolean
TextBox = sVal
FocusTextBox = True
Return True
End Function
Private Function ChangeInputBoxCheck() As Boolean
Friend Function ChangeInputBoxCheck() As Boolean
IsChecked = Not m_IsChecked
Return True
End Function
Private Function SetInputBoxCheck(ByVal bCheck As Boolean) As Boolean
Friend Function SetInputBoxCheck(ByVal bCheck As Boolean) As Boolean
IsChecked = bCheck
Application.Msn.NotifyColleagues(Application.SETLASTBOOLEAN, IsChecked)
Map.refProjectVM.SetLastBoolean(IsChecked)
Return True
End Function
Friend Sub AddInputBoxCombo(AddInputBoxComboParam As AddInputBoxComboParam)
AddInputBoxCombo(AddInputBoxComboParam.sText, AddInputBoxComboParam.bSelected)
End Sub
Private Function AddInputBoxCombo(ByVal sText As String, ByVal bSelected As Boolean) As Boolean
ComboItemsList.Add(sText)
If bSelected Then
@@ -26,11 +26,11 @@ Public Class LayerTreeViewItem
m_IsSelected = value
If value Then
' recupero l'Id del nuovo oggetto selezionato
Application.Msn.NotifyColleagues(Application.ISRIGHTCLICKEDLAYERTREEITEM, False)
Map.refManageLayerExpanderVM.IsRightClickedLayerTreeItem(False)
If m_MarkOnSel Then
Application.Msn.NotifyColleagues(Application.UPDATEOBJINOBJTREE, Me.Id)
Map.refManageLayerExpanderVM.UpdateObjInObjTree(Me.Id)
Else
Application.Msn.NotifyColleagues(Application.UPDATEOBJINOBJTREENOMARK, Me.Id)
Map.refManageLayerExpanderVM.UpdateObjInObjTreeNoMark(Me.Id)
End If
End If
End If
@@ -48,8 +48,8 @@ Public Class LayerTreeViewItem
Set(value As Boolean)
' In realtà il valore di value è insignificante perchè la cosa importante è che il click esegua questo Set
m_IsRightSelected = value
Application.Msn.NotifyColleagues(Application.ISRIGHTCLICKEDLAYERTREEITEM, True)
Application.Msn.NotifyColleagues(Application.RIGHTCLICKEDLAYERTREEITEM, Me.Id)
Map.refManageLayerExpanderVM.IsRightClickedLayerTreeItem(True)
Map.refManageLayerExpanderVM.RightClickedLayerTreeItem(Me.Id)
End Set
End Property
@@ -73,11 +73,11 @@ Public Class LayerTreeViewItem
m_bOnOff = value
' se abilitato, eseguo operazione
If m_SendCmd Then
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, Id)
Map.refProjectVM.SetLastInteger(Id)
If value Then
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SHOW)
Map.refProjectVM.ExecuteCommand(Controller.CMD.SHOW)
Else
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.HIDE)
Map.refProjectVM.ExecuteCommand(Controller.CMD.HIDE)
End If
End If
End If
@@ -136,46 +136,10 @@ Public Class ManageLayerExpanderVM
#Region "CONSTRUCTOR"
Sub New()
' Creo riferimento a questa classe in EgtCAM5Map
Map.SetRefManageLayerExpanderVM(Me)
'Imposto tempo di evidenziazione delle entità clickate
ObjTreeTimer.Interval = TimeSpan.FromMilliseconds(1000)
Application.Msn.Register(Application.LOADOBJTREE, Sub()
LoadObjTree()
End Sub)
Application.Msn.Register(Application.UPDATEOBJINOBJTREE, Sub(nId As Integer)
UpdateObjInObjTree(nId)
End Sub)
Application.Msn.Register(Application.UPDATEOBJINOBJTREENOMARK, Sub(nId As Integer)
UpdateObjInObjTreeNoMark(nId)
End Sub)
Application.Msn.Register(Application.SELECTIDINOBJTREE, Sub(nId As Integer)
SelectIdInObjTree(nId, True)
End Sub)
Application.Msn.Register(Application.SELECTIDINOBJTREENOMARK, Sub(nId As Integer)
SelectIdInObjTree(nId, False)
End Sub)
Application.Msn.Register(Application.CLEAROBJTREE, Sub()
ClearObjTree()
End Sub)
Application.Msn.Register(Application.UPDATEOBJTREE, Sub()
UpdateObjTree()
End Sub)
Application.Msn.Register(Application.UPDATEHEADERNAME, Sub(HeaderName As String)
Me.HeaderName = HeaderName
End Sub)
Application.Msn.Register(Application.UPDATEHEADERCOLOR, Sub(HeaderColor As Color3d)
Me.HeaderColor = New SolidColorBrush(Color.FromArgb(CByte(HeaderColor.A * 255 / 100), CByte(HeaderColor.R), CByte(HeaderColor.G), CByte(HeaderColor.B)))
End Sub)
Application.Msn.Register(Application.UPDATEOBJTREEOLDID, Sub(ObjTreeOldId As Integer)
Me.m_nObjTreeOldId = ObjTreeOldId
End Sub)
Application.Msn.Register(Application.RIGHTCLICKEDLAYERTREEITEM, Sub(Id As Integer)
EgtResetMark(m_RightClickedTreeItemId)
m_RightClickedTreeItemId = Id
End Sub)
Application.Msn.Register(Application.ISRIGHTCLICKEDLAYERTREEITEM, Sub(Value As Boolean)
m_IsRightClickedTreeItem = Value
End Sub)
End Sub
#End Region ' Constructor
@@ -200,7 +164,7 @@ Public Class ManageLayerExpanderVM
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub NewPart(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.NEWPART)
Map.refProjectVM.ExecuteCommand(Controller.CMD.NEWPART)
' Seleziono nell'albero il layer del pezzo appena creato
SelectIdInObjTree(EgtGetCurrLayer(), False)
End Sub
@@ -225,7 +189,7 @@ Public Class ManageLayerExpanderVM
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub NewLayer(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.NEWLAYER)
Map.refProjectVM.ExecuteCommand(Controller.CMD.NEWLAYER)
' Seleziono nell'albero il layer appena creato
SelectIdInObjTree(EgtGetCurrLayer(), False)
End Sub
@@ -250,8 +214,8 @@ Public Class ManageLayerExpanderVM
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub LayerColor(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.LAYERCOLOR)
Application.Msn.NotifyColleagues(Application.LOADOBJTREE)
Map.refProjectVM.ExecuteCommand(Controller.CMD.LAYERCOLOR)
Map.refManageLayerExpanderVM.LoadObjTree()
End Sub
#End Region ' LayerColorCommand
@@ -275,8 +239,8 @@ Public Class ManageLayerExpanderVM
''' </summary>
Public Sub TreeViewDoubleClick(ByVal param As Object)
If m_nObjTreeOldId <> GDB_ID.NULL Then
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, m_nObjTreeOldId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SETCURRPARTLAYER)
Map.refProjectVM.SetLastInteger(m_nObjTreeOldId)
Map.refProjectVM.ExecuteCommand(Controller.CMD.SETCURRPARTLAYER)
End If
End Sub
@@ -301,8 +265,8 @@ Public Class ManageLayerExpanderVM
''' </summary>
Public Sub TreeViewMouseRightButton(ByVal param As Object)
If m_nObjTreeOldId <> GDB_ID.NULL Then
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, m_nObjTreeOldId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SETCURRPARTLAYER)
Map.refProjectVM.SetLastInteger(m_nObjTreeOldId)
Map.refProjectVM.ExecuteCommand(Controller.CMD.SETCURRPARTLAYER)
End If
End Sub
@@ -365,11 +329,11 @@ Public Class ManageLayerExpanderVM
''' </summary>
Public Sub SelectCmd(ByVal param As Object)
Dim bSelGroup As Boolean = ((Keyboard.Modifiers And ModifierKeys.Shift) = ModifierKeys.Shift)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
Map.refProjectVM.SetLastInteger(RightClickedTreeItemId)
If Not bSelGroup Then
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SELECTPARTLAYEROBJ)
Map.refProjectVM.ExecuteCommand(Controller.CMD.SELECTPARTLAYEROBJ)
Else
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SELECTGROUP)
Map.refProjectVM.ExecuteCommand(Controller.CMD.SELECTGROUP)
End If
End Sub
@@ -393,8 +357,8 @@ Public Class ManageLayerExpanderVM
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Deselect(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.DESELECTPARTLAYEROBJ)
Map.refProjectVM.SetLastInteger(RightClickedTreeItemId)
Map.refProjectVM.ExecuteCommand(Controller.CMD.DESELECTPARTLAYEROBJ)
End Sub
#End Region ' DeselectCommand
@@ -417,8 +381,8 @@ Public Class ManageLayerExpanderVM
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Name(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SETNAME)
Map.refProjectVM.SetLastInteger(RightClickedTreeItemId)
Map.refProjectVM.ExecuteCommand(Controller.CMD.SETNAME)
End Sub
#End Region ' NameCommand
@@ -441,8 +405,8 @@ Public Class ManageLayerExpanderVM
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Info(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.SETINFO)
Map.refProjectVM.SetLastInteger(RightClickedTreeItemId)
Map.refProjectVM.ExecuteCommand(Controller.CMD.SETINFO)
End Sub
#End Region ' InfoCommand
@@ -465,8 +429,8 @@ Public Class ManageLayerExpanderVM
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Relocate(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.RELOCATEPARTLAYEROBJ)
Map.refProjectVM.SetLastInteger(RightClickedTreeItemId)
Map.refProjectVM.ExecuteCommand(Controller.CMD.RELOCATEPARTLAYEROBJ)
End Sub
#End Region ' RelocateCommand
@@ -489,8 +453,8 @@ Public Class ManageLayerExpanderVM
''' Execute the Point. This method is invoked by the PointCommand.
''' </summary>
Public Sub Copy(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.COPYPARTLAYEROBJ)
Map.refProjectVM.SetLastInteger(RightClickedTreeItemId)
Map.refProjectVM.ExecuteCommand(Controller.CMD.COPYPARTLAYEROBJ)
End Sub
#End Region ' CopyCommand
@@ -525,8 +489,8 @@ Public Class ManageLayerExpanderVM
If nNewId = GDB_ID.NULL Then nNewId = EgtGetPrev(RightClickedTreeItemId)
If nNewId = GDB_ID.NULL Then nNewId = EgtGetParent(RightClickedTreeItemId)
' eseguo cancellazione
Application.Msn.NotifyColleagues(Application.SETLASTINTEGER, RightClickedTreeItemId)
Application.Msn.NotifyColleagues(Application.EXECUTECOMMAND, Controller.CMD.DELETE)
Map.refProjectVM.SetLastInteger(RightClickedTreeItemId)
Map.refProjectVM.ExecuteCommand(Controller.CMD.DELETE)
' Seleziono prossimo
SelectIdInObjTree(nNewId, False)
End Sub
@@ -554,7 +518,7 @@ Public Class ManageLayerExpanderVM
Dim sDir As String = String.Empty
GetPrivateProfileString(S_GENERAL, K_LASTNGEOBJDIR, "", sDir)
Dim nType As NGE = DirectCast(GetPrivateProfileInt(S_GEOMDB, K_SAVETYPE, NGE.CMPTEXT), NGE)
Application.Msn.NotifyColleagues(Application.SAVEOBJECT, New SaveObjectParam(m_RightClickedTreeItemId, sDir, nType))
Map.refProjectVM.SaveObject(New SaveObjectParam(m_RightClickedTreeItemId, sDir, nType))
End Sub
#End Region ' SaveCommand
@@ -568,6 +532,35 @@ Public Class ManageLayerExpanderVM
Private m_nObjTreeMenuId As Integer = GDB_ID.NULL
Private m_bEnableUpdateObjInObjTree As Boolean = True
Friend Sub SelectIdInObjTreeNoMark(nId As Integer)
SelectIdInObjTree(nId, False)
End Sub
Friend Sub SelectIdInObjTree(nId As Integer)
SelectIdInObjTree(nId, True)
End Sub
Friend Sub UpdateObjTreeOldId(ObjTreeOldId As Integer)
Me.m_nObjTreeOldId = ObjTreeOldId
End Sub
Friend Sub UpdateHeaderName(HeaderName As String)
Me.HeaderName = HeaderName
End Sub
Friend Sub UpdateHeaderColor(HeaderColor As Color3d)
Me.HeaderColor = New SolidColorBrush(Color.FromArgb(CByte(HeaderColor.A * 255 / 100), CByte(HeaderColor.R), CByte(HeaderColor.G), CByte(HeaderColor.B)))
End Sub
Friend Sub RightClickedLayerTreeItem(Id As Integer)
EgtResetMark(m_RightClickedTreeItemId)
m_RightClickedTreeItemId = Id
End Sub
Friend Sub IsRightClickedLayerTreeItem(Value As Boolean)
m_IsRightClickedTreeItem = Value
End Sub
Private Sub ObjTreeTickEvent(source As Object, e As EventArgs) Handles ObjTreeTimer.Tick
Dim nId As Integer = GDB_ID.NULL
If m_IsRightClickedTreeItem Then
@@ -582,23 +575,23 @@ Public Class ManageLayerExpanderVM
ObjTreeTimer.Stop()
End Sub
Public Sub LoadObjTree()
Friend Sub LoadObjTree()
LayerTreeViewItem.m_SendCmd = False
Dim nOldId As Integer = ClearObjTree()
AddGroupInObjTree(GDB_ID.ROOT, GDB_LV.USER, GDB_MD.STD, 0, LayerList)
If nOldId <> GDB_ID.NULL Then
m_bEnableUpdateObjInObjTree = False
If Not SelectIdInObjTree(nOldId, True) Then
Application.Msn.NotifyColleagues(Application.SETINFOBOX, String.Empty)
Map.refInfoExpanderVM.SetInfoBox(String.Empty)
End If
m_bEnableUpdateObjInObjTree = True
Else
Application.Msn.NotifyColleagues(Application.SETINFOBOX, String.Empty)
Map.refInfoExpanderVM.SetInfoBox(String.Empty)
End If
LayerTreeViewItem.m_SendCmd = True
End Sub
Private Function ClearObjTree() As Integer
Friend Function ClearObjTree() As Integer
Dim nOldId As Integer = RevertOldIdInObjTree()
LayerList.Clear()
Return nOldId
@@ -755,20 +748,20 @@ Public Class ManageLayerExpanderVM
Return ""
End Function
Private Sub UpdateObjTree()
Friend Sub UpdateObjTree()
' per aggiornare l'albero senza ricostruirlo da capo
' se c'è una entità corrente, ne aggiorno i dati
If m_nObjTreeOldId <> GDB_ID.NULL Then
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, m_nObjTreeOldId)
Map.refInfoExpanderVM.UpdateObjDataInObjTree(m_nObjTreeOldId)
End If
End Sub
Private Sub UpdateObjInObjTree(nId As Integer)
Friend Sub UpdateObjInObjTree(nId As Integer)
If m_bEnableUpdateObjInObjTree Then
' ripristino eventuale vecchio oggetto selezionato
RevertOldIdInObjTree()
' stampa dei dati del nuovo oggetto
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, nId)
Map.refInfoExpanderVM.UpdateObjDataInObjTree(nId)
' evidenzio l'oggetto
EgtSetMark(nId)
m_nObjTreeOldId = nId
@@ -779,21 +772,21 @@ Public Class ManageLayerExpanderVM
ObjTreeTimer.Start()
Else
' stampa dei dati del nuovo oggetto
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, nId)
Map.refInfoExpanderVM.UpdateObjDataInObjTree(nId)
End If
End Sub
Private Sub UpdateObjInObjTreeNoMark(nId As Integer)
Friend Sub UpdateObjInObjTreeNoMark(nId As Integer)
If m_bEnableUpdateObjInObjTree Then
' ripristino eventuale vecchio oggetto selezionato
RevertOldIdInObjTree()
' stampa dei dati del nuovo oggetto
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, nId)
Map.refInfoExpanderVM.UpdateObjDataInObjTree(nId)
' salvo id corrente
m_nObjTreeOldId = nId
Else
' stampa dei dati del nuovo oggetto
Application.Msn.NotifyColleagues(Application.UPDATEOBJDATAINOBJTREE, nId)
Map.refInfoExpanderVM.UpdateObjDataInObjTree(nId)
End If
End Sub
@@ -132,7 +132,7 @@ Public Class EstimationsExpanderVM
bOk = False
Else
' Lancio salvataggio
Application.Msn.NotifyColleagues(Application.SAVEPROJECT)
Map.refProjectVM.SaveProject()
' Se non salvato, abbandono
If EgtGetModified() Then bOk = False
' Aggiorno path
@@ -54,13 +54,6 @@ Public Class MachiningTreeExpanderVM
' Per caricare l'albero la prima volta che viene aperto
IsEnabled = False
LoadSelectedMachineMachinings()
Application.Msn.Register(Application.UPDATEOPERATIONMACHININGLIST, Sub()
m_MachiningsList.Clear()
LoadSelectedMachineMachinings()
End Sub)
'Application.Msn.Register(Application.SELECTEDOPERATION, Sub(SelectedOperation As OperationListBoxItem)
' nSelectedOperationId = SelectedOperation.Id
' End Sub)
End Sub
#End Region
@@ -93,7 +86,7 @@ Public Class MachiningTreeExpanderVM
If MachiningId = GDB_ID.NULL Then
' Inserimento lavorazione non riuscito ERRORE
MessageBox.Show(EgtMsg(MSG_OPERATION + 19), EgtMsg(MSG_MESSAGEBOX + 1), MessageBoxButton.OK, MessageBoxImage.Error)
Application.Msn.NotifyColleagues(Application.CANCELOPERATIONCOMMAND)
Map.refOperationsListExpanderVM.CancelOperationCmd()
Return
End If
' Se è abilitata l'opzione
@@ -127,7 +120,7 @@ Public Class MachiningTreeExpanderVM
' Ricarico la lista operazioni per avere quella nuova
Map.refOperationsListExpanderVM.LoadOperationList(MachiningId)
' disabilito la modalità nuova lavorazione
Application.Msn.NotifyColleagues(Application.NEWMACHININGMODEISACTIVE, New NewMachOpParam(False, MachiningId))
Map.refOperationsListExpanderVM.NewMachiningModeIsActive(New NewMachOpParam(False, MachiningId))
End If
End Sub
@@ -172,7 +165,7 @@ Public Class MachiningTreeExpanderVM
''' Execute the TreeViewDoubleClick. This method is invoked by the TreeViewDoubleClickCommand.
''' </summary>
Public Sub CancelNew(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.CANCELOPERATIONCOMMAND)
Map.refOperationsListExpanderVM.CancelOperationCmd()
End Sub
#End Region ' CancelNewCommand
@@ -206,7 +199,7 @@ Public Class MachiningTreeExpanderVM
Map.refEstimationsExpanderVM.Estimation_IsEnabled = True
If Not CodeCommand Then
Application.Msn.NotifyColleagues(Application.CANCELOPERATIONCOMMAND)
Map.refOperationsListExpanderVM.CancelOperationCmd()
CodeCommand = False
OnPropertyChanged("IsEnabled")
Return False
@@ -241,6 +234,11 @@ Public Class MachiningTreeExpanderVM
End If
End Sub
Friend Sub UpdateOperationMachiningList()
m_MachiningsList.Clear()
LoadSelectedMachineMachinings()
End Sub
#End Region
End Class
@@ -145,7 +145,7 @@ Public Class DispositionParameterExpanderVM
End Get
Set(value As Boolean)
If value <> m_MoveIsChecked Then
Application.Msn.NotifyColleagues(Application.SETMOVEINDISPOSITION, value)
Map.refProjectVM.SetMoveInDisposition(value)
InputValue = String.Empty
OnPropertyChanged("InputValue")
If value Then
@@ -395,9 +395,9 @@ Public Class MachiningParameterExpanderVM
Else
If EgtGetMachMgrWarningId(0) <> 0 Then
Dim sWarn As String = EgtGetMachMgrWarningString(0)
Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, sWarn)
Map.refStatusBarVM.NotifyStatusOutput(sWarn)
Else
Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, "")
Map.refStatusBarVM.NotifyStatusOutput("")
End If
End If
' Restart visualizzazione utensile
@@ -408,7 +408,7 @@ Public Class MachiningParameterExpanderVM
IsModified(False) ' NotifyPropertyChanged("UpdateMachiningBtn_Background")
ErrorOnOperation(False)
EgtDraw()
Application.Msn.NotifyColleagues(Application.EMITTITLE)
Map.refProjectVM.EmitTitle()
End Sub
#End Region ' UpdateMachiningCommand
@@ -204,7 +204,7 @@ Public Class MachiningOpListBoxItem
Name = m_ModifiedName
End If
' aggiorno titolo
Application.Msn.NotifyColleagues(Application.EMITTITLE)
Map.refProjectVM.EmitTitle()
' termino il rinomina
m_CloseModifyLostFocus = True
IsActive_ModifyName = False
@@ -84,9 +84,9 @@ Public Class OperationListBoxItem
' Se l'operazione è una disposizione
If EgtGetOperationType(Id) = MCH_OY.DISP Then
'' Abilito la selezione delle Fixture
'Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.FIXTURE)
'Map.refProjectVM.SceneSelType = SceneSelTypeOpt.FIXTURE
' Abilito la selezione di tutti i tipi di geometria
'Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.ALL)
'Map.refProjectVM.SceneSelMode = SceneSelModeOpt.ALL
' Altrimenti è una lavorazione
Else
' Imposto come corrente la lavorazione selezionata
@@ -26,7 +26,7 @@ Public Class OperationParametersExpanderVM
If value <> m_ParametersIsExpanded Then
Map.refMachiningOptionPanelVM.Set_IsExpanded(MachiningOptionPanelVM.MachiningOptionPanelExpander.OPERATIONPARAMETERS, value)
End If
Application.Msn.NotifyColleagues(Application.EMITTITLE)
Map.refProjectVM.EmitTitle()
' disattivo database utensili, lavorazioni e setup se vado sulla modifica di una lavorazione
Map.refMachinePanelVM.ToolMachSetUpIsEnabled(Not m_ParametersIsExpanded, Not m_ParametersIsExpanded, Not m_ParametersIsExpanded)
End Set
@@ -37,9 +37,9 @@ Public Class OperationsListExpanderVM
Map.refMachiningTreeExpanderVM.CodeCommand = True
Map.refMachiningTreeExpanderVM.IsEnabled = False
'' Disabilito la selezione
'Application.Msn.NotifyColleagues(Application.SETSCENESELTYPE, SceneSelTypeOpt.NULL)
'Map.refProjectVM.SceneSelType = SceneSelTypeOpt.NULL)
'' Disabilito la selezione di curve e superfici del pezzo
'Application.Msn.NotifyColleagues(Application.SETSCENESELMODE, SceneSelModeOpt.NULL)
'Map.refProjectVM.SceneSelMode = SceneSelModeOpt.NULL)
' Apro i parametri della lavorazione aggiunta
Map.refOperationParametersExpanderVM.ParametersIsExpanded = True
@@ -259,36 +259,6 @@ Public Class OperationsListExpanderVM
' Creo riferimento a questa classe in Map
Map.SetRefOperationsListExpanderVM(Me)
Me.ListIsExpanded = True
Application.Msn.Register(Application.LOADOPERATIONLIST, Sub(nSelectedOperation As Integer)
LoadOperationList()
SelectOperation(nSelectedOperation)
ListIsExpanded = True
End Sub)
Application.Msn.Register(Application.NEWMACHININGMODEISACTIVE, Sub(Params As NewMachOpParam)
If Params.bActive Then
StartNewMachining()
Else
EndNewMachining(Params.SelMachOpId)
End If
End Sub)
Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub()
' Annullo creazione nuova lavorazione
If m_NewMachining Then EndNewMachining(GDB_ID.NULL)
' Disabilito visualizzazione utensile
If Not IsNothing(m_MachiningParameterExpander) Then
DirectCast(m_MachiningParameterExpander.DataContext, MachiningParameterExpanderVM).ViewTool = False
End If
' Deseleziono le operazioni correnti per eliminare il mark
For Each Operation In OperationList
If Operation.IsSelected Then
Operation.IsSelected = False
End If
Next
End Sub)
Application.Msn.Register(Application.CANCELOPERATIONCOMMAND, Sub()
CancelOperation(String.Empty)
End Sub)
End Sub
#End Region ' Constructor
@@ -426,7 +396,7 @@ Public Class OperationsListExpanderVM
Next
' Ricarico la lista delle operazioni
LoadOperationList(nPrevOperId)
Application.Msn.NotifyColleagues(Application.EMITTITLE)
Map.refProjectVM.EmitTitle()
End If
End Sub
@@ -512,7 +482,7 @@ Public Class OperationsListExpanderVM
EgtDraw()
OnPropertyChanged("MoveUp_IsEnabled")
OnPropertyChanged("MoveDown_IsEnabled")
Application.Msn.NotifyColleagues(Application.EMITTITLE)
Map.refProjectVM.EmitTitle()
End If
End Sub
@@ -565,7 +535,7 @@ Public Class OperationsListExpanderVM
EgtDraw()
OnPropertyChanged("MoveUp_IsEnabled")
OnPropertyChanged("MoveDown_IsEnabled")
Application.Msn.NotifyColleagues(Application.EMITTITLE)
Map.refProjectVM.EmitTitle()
End If
End Sub
@@ -609,9 +579,9 @@ Public Class OperationsListExpanderVM
MessageBox.Show(EgtMsg(MSG_SIMULATION + 6), EgtMsg(MSG_SIMULATION + 5), MessageBoxButton.OK, MessageBoxImage.Error)
End If
Else
Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, EgtMsg(MSG_OPERATION + 11))
Map.refStatusBarVM.NotifyStatusOutput(EgtMsg(MSG_OPERATION + 11))
End If
Application.Msn.NotifyColleagues(Application.EMITTITLE)
Map.refProjectVM.EmitTitle()
End Sub
#End Region ' UpdateCommand
@@ -665,7 +635,7 @@ Public Class OperationsListExpanderVM
' creo ed apro finestra SetUp
Dim SetUpDbWindow As New CurrSetUpV(Application.Current.MainWindow, New CurrSetUpVM)
SetUpDbWindow.ShowDialog()
Application.Msn.NotifyColleagues(Application.EMITTITLE)
Map.refProjectVM.EmitTitle()
End Sub
#End Region ' SetUpCommand
@@ -957,6 +927,14 @@ Public Class OperationsListExpanderVM
Return True
End Function
Friend Sub NewMachiningModeIsActive(Params As NewMachOpParam)
If Params.bActive Then
StartNewMachining()
Else
EndNewMachining(Params.SelMachOpId)
End If
End Sub
Private Sub LoadOperationList()
OperationList.Clear()
Dim Id As Integer
@@ -1157,6 +1135,25 @@ Public Class OperationsListExpanderVM
ListIsExpanded = True
End Sub
Friend Sub CancelOperationCmd()
CancelOperation(String.Empty)
End Sub
Friend Sub DrawMode_IsChecked()
' Annullo creazione nuova lavorazione
If m_NewMachining Then EndNewMachining(GDB_ID.NULL)
' Disabilito visualizzazione utensile
If Not IsNothing(m_MachiningParameterExpander) Then
DirectCast(m_MachiningParameterExpander.DataContext, MachiningParameterExpanderVM).ViewTool = False
End If
' Deseleziono le operazioni correnti per eliminare il mark
For Each Operation In OperationList
If Operation.IsSelected Then
Operation.IsSelected = False
End If
Next
End Sub
#End Region ' Methods
End Class
@@ -53,16 +53,6 @@ Public Class SimulationExpanderVM
Sub New()
SetRefSimulationExpanderVM(Me)
Application.Msn.Register(Application.CLOSEAPPLICATION, Sub()
If Simulation_IsExpanded Then
ResetSimulation()
End If
End Sub)
Application.Msn.Register(Application.SIMULATIONEXPANDER_UPDATE_CNCDATA, Sub()
If Simulation_IsExpanded Then
ShowCncData()
End If
End Sub)
SimulationMsg_Const = MSG_SIMULATION
SetPlayImagePath("/Resources/OptionPanel/MachiningOptionPanel/SimulationExpander/Play.png")
SetPauseImagePath("/Resources/OptionPanel/MachiningOptionPanel/SimulationExpander/Pause.png")
@@ -109,7 +99,7 @@ Public Class SimulationExpanderVM
End If
bNcView = False
Else
Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, EgtMsg(5332) & " (" & sCncFile & ")")
Map.refStatusBarVM.NotifyStatusOutput(EgtMsg(5332) & " (" & sCncFile & ")")
End If
' Torno alla fase originale (o alla prima se non definita)
EgtSetCurrPhase(If(nPhase = 0, 1, nPhase), True)
@@ -121,7 +111,7 @@ Public Class SimulationExpanderVM
Process.Start("Notepad.exe", sCncFile)
' altrimenti lo segnalo
Else
Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, "Edit failed, missing part program file" & " (" & sCncFile & ")")
Map.refStatusBarVM.NotifyStatusOutput("Edit failed, missing part program file" & " (" & sCncFile & ")")
End If
End If
End Sub
@@ -358,7 +348,7 @@ Public Class SimulationExpanderVM
Else
EgtRemoveInfo(EgtGetCurrMachGroup(), KEY_MCHGRP_VM)
End If
Application.Msn.NotifyColleagues(Application.EMITTITLE)
Map.refProjectVM.EmitTitle()
End Sub
Private Function GetCncFileName(bAskSave As Boolean, ByRef sCncFile As String, ByRef sInfo As String) As Boolean
@@ -373,7 +363,7 @@ Public Class SimulationExpanderVM
Return False
Else
' Lancio salvataggio
Application.Msn.NotifyColleagues(Application.SAVEPROJECT)
Map.refProjectVM.SaveProject()
' Se non salvato, abbandono
If EgtGetModified() Then Return False
' Aggiorno path
@@ -400,6 +390,12 @@ Public Class SimulationExpanderVM
Return True
End Function
Friend Sub SimulationExpander_Update_CncData()
If Simulation_IsExpanded Then
ShowCncData()
End If
End Sub
#End Region ' METHODS
End Class
+18 -19
View File
@@ -10,25 +10,6 @@ Public Class OptionPanelVM
Sub New()
Map.SetRefOptionPanelVM(Me)
Application.Msn.Register(Application.MACHININGMODE_ISCHECKED, Sub()
m_DrawIsChecked = False
m_MachiningIsChecked = True
EgtZoom(ZM.ALL, False)
OnPropertyChanged("ModePanel")
End Sub)
Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub()
m_DrawIsChecked = True
m_MachiningIsChecked = False
If Not IsNothing(Map.refSimulationExpanderVM) AndAlso
Not IsNothing(Map.refEstimationsExpanderVM) Then
Map.refSimulationExpanderVM.Simulation_IsExpanded = False
Map.refEstimationsExpanderVM.Estimation_IsExpanded = False
End If
OnPropertyChanged("ModePanel")
End Sub)
DrawOptPanelV = New DrawOptionPanelV
MachOptPanelV = New MachiningOptionPanelV
@@ -67,4 +48,22 @@ Public Class OptionPanelVM
End Get
End Property
Friend Sub DrawMode_IsChecked()
m_DrawIsChecked = True
m_MachiningIsChecked = False
If Not IsNothing(Map.refSimulationExpanderVM) AndAlso
Not IsNothing(Map.refEstimationsExpanderVM) Then
Map.refSimulationExpanderVM.Simulation_IsExpanded = False
Map.refEstimationsExpanderVM.Estimation_IsExpanded = False
End If
OnPropertyChanged("ModePanel")
End Sub
Friend Sub MachiningMode_IsChecked()
m_DrawIsChecked = False
m_MachiningIsChecked = True
EgtZoom(ZM.ALL, False)
OnPropertyChanged("ModePanel")
End Sub
End Class
+2 -2
View File
@@ -890,8 +890,8 @@ Public Class OptionWindowVM
Map.refProjectVM.GetScene.SetDefaultMaterial(OptionModule.m_DefMaterialColor)
WritePrivateProfileColor(S_GEOMDB, K_DEFAULTCOLOR, OptionModule.m_DefMaterialColor)
EgtDraw()
Application.Msn.NotifyColleagues(Application.UPDATEHEADERCOLOR, OptionModule.m_DefMaterialColor)
Application.Msn.NotifyColleagues(Application.LOADOBJTREE)
Map.refManageLayerExpanderVM.UpdateHeaderColor(OptionModule.m_DefMaterialColor)
Map.refManageLayerExpanderVM.LoadObjTree()
NotifyPropertyChanged("DefMaterialColor")
End If
End Sub
+43 -37
View File
@@ -7,7 +7,10 @@ Public Class ProjectV
Private m_bWall As Boolean = False
Private m_bDoors As Boolean = False
Private m_bGunStock 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
@@ -43,43 +46,6 @@ Public Class ProjectV
m_bWall = IniFile.IsActiveWall()
m_bDoors = IniFile.IsActiveDoors()
m_bGunStock = IniFile.IsActiveGunStock()
Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub()
'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, 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)
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
End Sub)
Application.Msn.Register(Application.MACHININGMODE_ISCHECKED, Sub()
'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 = Visibility.Collapsed
BeamPanel.Visibility = Visibility.Collapsed
WallPanel.Visibility = Visibility.Collapsed
BeamWallPanel.Visibility = Visibility.Collapsed
DoorsPanel.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)
End Sub)
Application.Msn.Register(Application.DBPANELVISIBILITY, Sub()
DbPanel.Visibility = If(IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW, Visibility.Collapsed, Visibility.Visible)
End Sub)
End Sub
Private Sub PanelPositioning(FloatingPanel As EgtFloatingPanel, sState As String, nIndex As Integer, nLeft As Integer, nTop As Integer)
@@ -97,6 +63,46 @@ Public Class ProjectV
'End Select
End Sub
Friend Sub SetDbPanelVisibility()
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 = Visibility.Collapsed
BeamPanel.Visibility = Visibility.Collapsed
WallPanel.Visibility = Visibility.Collapsed
BeamWallPanel.Visibility = Visibility.Collapsed
DoorsPanel.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)
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, 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)
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
End Sub
Private Sub UserControl_Unloaded(sender As Object, e As RoutedEventArgs) Handles Me.Unloaded
' Salvo le posizioni di tutti gli EgtPanel
+362 -388
View File
File diff suppressed because it is too large Load Diff
+20 -13
View File
@@ -104,21 +104,28 @@ Public Class ShowPanelVM
#Region "CONSTRUCTOR"
Sub New()
Application.Msn.Register(Application.SHOWMODESTATE, Sub(nShowModeState As Integer)
If nShowModeState = SM.WIREFRAME Then
WireframeIsChecked = True
ElseIf nShowModeState = SM.HIDDENLINE Then
HiddenLineIsChecked = True
Else
ShadingIsChecked = True
End If
End Sub)
Application.Msn.Register(Application.SHOWCURVEDIR, Sub(nShowCurveDir As Integer)
CurveDirIsChecked = (nShowCurveDir <> 0)
End Sub)
' Creo riferimento a questa classe in EgtCAM5Map
Map.SetRefShowPanelVM(Me)
End Sub
#End Region ' CONSTRUCTOR
#Region "METHODS"
Friend Sub ShowModeState(nShowModeState As Integer)
If nShowModeState = SM.WIREFRAME Then
WireframeIsChecked = True
ElseIf nShowModeState = SM.HIDDENLINE Then
HiddenLineIsChecked = True
Else
ShadingIsChecked = True
End If
End Sub
Friend Sub ShowCurveDir(nShowCurveDir As Integer)
CurveDirIsChecked = (nShowCurveDir <> 0)
End Sub
#End Region ' METHODS
End Class
+3 -3
View File
@@ -29,7 +29,7 @@ Module Beam
Return False
End If
' Preparo interfaccia per aggiornamento
Application.Msn.NotifyColleagues(Application.CLEAROBJTREE)
Map.refManageLayerExpanderVM.ClearObjTree()
' Assegno i dati
EgtLuaCreateGlobTable("BEAM")
EgtLuaSetGlobStringVar("BEAM.FILE", sFile)
@@ -51,9 +51,9 @@ Module Beam
EgtLuaResetGlobVar("BEAM")
' Aggiorno interfaccia
Map.refProjectVM.UpdateProjectUI(True)
Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREENOMARK, EgtGetCurrLayer())
Map.refManageLayerExpanderVM.SelectIdInObjTreeNoMark(EgtGetCurrLayer())
If EgtGetCurrMachGroup() <> GDB_ID.NULL Then
Application.Msn.NotifyColleagues(Application.SETMACHININGMODE)
Map.refTopCommandBarVM.SetMachiningMode()
If bOk And nFlag = 2 Then
Map.refSimulationExpanderVM.Simulation_IsExpanded = True
End If
+3 -3
View File
@@ -29,7 +29,7 @@ Module Wall
Return False
End If
' Preparo interfaccia per aggiornamento
Application.Msn.NotifyColleagues(Application.CLEAROBJTREE)
Map.refManageLayerExpanderVM.ClearObjTree()
' Assegno i dati
EgtLuaCreateGlobTable("WALL")
EgtLuaSetGlobStringVar("WALL.FILE", sFile)
@@ -51,9 +51,9 @@ Module Wall
EgtLuaResetGlobVar("WALL")
' Aggiorno interfaccia
Map.refProjectVM.UpdateProjectUI(True)
Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREENOMARK, EgtGetCurrLayer())
Map.refManageLayerExpanderVM.SelectIdInObjTreeNoMark(EgtGetCurrLayer())
If EgtGetCurrMachGroup() <> GDB_ID.NULL Then
Application.Msn.NotifyColleagues(Application.SETMACHININGMODE)
Map.refTopCommandBarVM.SetMachiningMode()
If bOk And nFlag = 2 Then
Map.refSimulationExpanderVM.Simulation_IsExpanded = True
End If
+3 -3
View File
@@ -36,7 +36,7 @@ Public Class DoorPanelVM
''' Execute the Door. This method is invoked by the DoorsCommand.
''' </summary>
Public Sub Doors(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.DOORSSCRIPT, String.Empty)
Map.refProjectVM.DoorsScript(String.Empty)
End Sub
#End Region ' DoorsCommand
@@ -59,7 +59,7 @@ Public Class DoorPanelVM
''' Execute the Open. This method is invoked by the OpenCommand.
''' </summary>
Public Shared Sub OpenMruDoor(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.DOORSSCRIPT, DirectCast(param, String).Replace("__", "_"))
Map.refProjectVM.DoorsScript(DirectCast(param, String).Replace("__", "_"))
End Sub
#End Region ' OpenMruFileCommand
@@ -82,7 +82,7 @@ Public Class DoorPanelVM
''' Execute the Dmach. This method is invoked by the DMachCommand.
''' </summary>
Public Sub DMach(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.DMACHSCRIPT)
Map.refProjectVM.DMachScript()
End Sub
#End Region ' DMachCommand
+4 -4
View File
@@ -72,7 +72,7 @@ Public Class GunStockPanelVM
''' Execute the Door. This method is invoked by the DoorsCommand.
''' </summary>
Public Sub NewGunStock(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.GUNSTOCKNEW, String.Empty)
Map.refProjectVM.GunStockNew(String.Empty)
End Sub
#End Region ' NewGunStockCommand
@@ -95,7 +95,7 @@ Public Class GunStockPanelVM
''' Execute the Door. This method is invoked by the DoorsCommand.
''' </summary>
Public Sub ModifyGunStock(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.GUNSTOCKMODIF, String.Empty)
Map.refProjectVM.GunStockModif(String.Empty)
End Sub
#End Region ' ModifyGunStockCommand
@@ -118,7 +118,7 @@ Public Class GunStockPanelVM
''' Execute the Open. This method is invoked by the OpenCommand.
''' </summary>
Public Shared Sub OpenMruNewGunStock(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.GUNSTOCKNEW, DirectCast(param, String).Replace("__", "_"))
Map.refProjectVM.GunStockNew(DirectCast(param, String).Replace("__", "_"))
End Sub
#End Region ' OpenMruNewGunStockCommand
@@ -141,7 +141,7 @@ Public Class GunStockPanelVM
''' Execute the Open. This method is invoked by the OpenCommand.
''' </summary>
Public Shared Sub OpenMruModifyGunStock(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.GUNSTOCKMODIF, DirectCast(param, String).Replace("__", "_"))
Map.refProjectVM.GunStockModif(DirectCast(param, String).Replace("__", "_"))
End Sub
#End Region ' OpenMruNewGunStockCommand
+2 -2
View File
@@ -86,8 +86,8 @@ Public Class ButtonItem
If Not File.Exists(m_sLuaCmdPath) Then Return
If Not Path.GetExtension(m_sLuaCmdPath).ToLower = ".lua" Then Return
' eseguo file Lua
Application.Msn.NotifyColleagues(Application.PREEXECSCRIPT, False)
Application.Msn.NotifyColleagues(Application.EXECSCRIPT, m_sLuaCmdPath)
Map.refProjectVM.PreExecScript(False)
Map.refProjectVM.ExecScript(m_sLuaCmdPath)
End Sub
#End Region ' LuaExecCommand
+41 -85
View File
@@ -187,87 +187,6 @@ Public Class MyStatusBarVM
Sub New()
' Creo riferimento a questa classe in EgtCAM5Map
Map.SetRefStatusBarVM(Me)
Application.Msn.Register(Application.NOTIFYCURRPOS, Sub(sCursorPos As String)
SetCurrPos(sCursorPos)
End Sub)
Application.Msn.Register(Application.NOTIFYSTATUSOUTPUT, Sub(sStatusOutput As String)
SetOutputMessage(sStatusOutput)
End Sub)
Application.Msn.Register(Application.NOTIFYSTATUSPROGRESS, Sub(sStatusProgress As Integer)
SetLoadingProgress(sStatusProgress)
End Sub)
Application.Msn.Register(Application.NOTIFYSTATUSSTOP, Sub(sStatusStop As Boolean)
SetStopProgress_IsEnabled(sStatusStop)
End Sub)
Application.Msn.Register(Application.UPDATESTATUSGRID, Sub(UpdateStatusGridParam As UpdateStatusGridParam)
UpdateStatusGrid(UpdateStatusGridParam.m_bShowGrid, UpdateStatusGridParam.m_bShowGridFrame)
End Sub)
Application.Msn.Register(Application.STATUSCURRPOSTYPETEXT, Sub(sString As String)
CurrPosTypeText = sString
End Sub)
Application.Msn.Register(Application.UPDATESTATUSUNITS, Sub(bMmUnits As Boolean)
SetMeasureUnit(If(bMmUnits, 1, 0)) 'StatusUnitsText = If(bMmUnits, "mm", "in")
EgtSetUiUnits(bMmUnits)
End Sub)
Application.Msn.Register(Application.STATUSSNAPPOINTTYPETEXT, Sub(sString As String)
SetSnapPointType(sString)
End Sub)
Application.Msn.Register(Application.STATUSSNAPPOINTTYPEBACKGROUND, Sub(Color As SolidColorBrush)
SetSnapPointType_Background(Color)
End Sub)
'SearchMachines()
'Application.Msn.Register(Application.LOADCURRENTMACHINE, Sub()
' If m_MachinesList.Count = 0 Then Return
' Dim CurrMach As String = String.Empty
' GetPrivateProfileString(S_MACH, K_CURRMACH, String.Empty, CurrMach)
' Dim bFound As Boolean = False
' If Not String.IsNullOrEmpty(CurrMach) Then
' For Each Mach In MachinesList
' If Mach.Name = CurrMach Then
' bFound = True
' SelectedMachine = Mach
' Exit For
' End If
' Next
' End If
' If Not bFound And MachinesList.Count > 0 Then
' SelectedMachine = MachinesList(0)
' End If
' End Sub)
'Application.Msn.Register(Application.SAVECURRENTMACHINE, Sub()
' If IsNothing(m_SelectedMachine) Then Return
' WritePrivateProfileString(S_MACH, K_CURRMACH, SelectedMachine.Name)
' End Sub)
'Application.Msn.Register(Application.UPDATECURRENTMACHINE, Sub()
' EgtSetCurrentContext(IniFile.m_ProjectSceneContext)
' Dim sMachName As String = String.Empty
' If EgtGetCurrMachineName(sMachName) Then
' For Each Mach In MachinesList
' If Mach.Name = sMachName Then
' SelectedMachine = Mach
' Exit For
' End If
' Next
' End If
' End Sub)
Application.Msn.Register(Application.MAINWINDOW_CONTENTRENDERED, Sub()
If IniFile.m_bMmUnits Then
GridDimensionText = LenToString(IniFile.dSnapStepMm, 4)
Else
GridDimensionText = LenToString(IniFile.dSnapStepInch, 4)
End If
'If IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then
' MachineListIsEnabled = False
'End If
End Sub)
Application.Msn.Register(Application.MACHININGMODE_ISCHECKED, Sub()
OutputMessage = String.Empty
'MachineListIsEnabled = False
End Sub)
Application.Msn.Register(Application.DRAWMODE_ISCHECKED, Sub()
OutputMessage = String.Empty
'MachineListIsEnabled = True
End Sub)
' Installo funzione gestione eventi per lua
EgtSetProcessEvents(m_ProcEventsCallback)
' Installo funzione output testo su status per lua
@@ -363,7 +282,7 @@ Public Class MyStatusBarVM
IniFile.m_bMachiningShowGrid = Not IniFile.m_bMachiningShowGrid
bGridState = m_bMachiningShowGrid
End If
Application.Msn.NotifyColleagues(Application.UPDATESTATUSGRID, New UpdateStatusGridParam(bGridState, IniFile.m_bShowGridFrame))
Map.refStatusBarVM.UpdateStatusGrid(New UpdateStatusGridParam(bGridState, IniFile.m_bShowGridFrame))
EgtDraw()
End Sub
@@ -387,7 +306,7 @@ Public Class MyStatusBarVM
''' Execute the Point. This method is invoked by the CurrPosTypeCommand.
''' </summary>
Public Sub CurrPosType(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.STATUSCURRPOSTYPECOMMAND)
Map.refProjectVM.StatusCurrPosTypeCommand()
End Sub
#End Region ' CurrPosTypeCommand
@@ -410,7 +329,7 @@ Public Class MyStatusBarVM
''' Execute the Point. This method is invoked by the CurrPosTypeCommand.
''' </summary>
Public Sub StatusUnits(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.STATUSUNITSCOMMAND)
Map.refProjectVM.StatusUnitsCommand()
If IniFile.m_bMmUnits Then
GridDimensionText = LenToString(IniFile.dSnapStepMm, 4)
Else
@@ -472,6 +391,43 @@ Public Class MyStatusBarVM
#Region "METHODS"
Friend Sub NotifyStatusOutput(sStatusOutput As String)
SetOutputMessage(sStatusOutput)
End Sub
Friend Sub NotifyCurrPos(sCursorPos As String)
SetCurrPos(sCursorPos)
End Sub
Friend Sub NotifyStatusProgress(sStatusProgress As Integer)
SetLoadingProgress(sStatusProgress)
End Sub
Friend Sub NotifyStatusStop(sStatusStop As Boolean)
SetStopProgress_IsEnabled(sStatusStop)
End Sub
Friend Sub UpdateStatusGrid(UpdateStatusGridParam As UpdateStatusGridParam)
UpdateStatusGrid(UpdateStatusGridParam.m_bShowGrid, UpdateStatusGridParam.m_bShowGridFrame)
End Sub
Friend Sub StatusCurrPosTypeText(sString As String)
CurrPosTypeText = sString
End Sub
Friend Sub UpdateStatusUnits(bMmUnits As Boolean)
SetMeasureUnit(If(bMmUnits, 1, 0)) 'StatusUnitsText = If(bMmUnits, "mm", "in")
EgtSetUiUnits(bMmUnits)
End Sub
Friend Sub StatusSnapPointTypeText(sString As String)
SetSnapPointType(sString)
End Sub
Friend Sub StatusSnapPointTypeBackground(Color As SolidColorBrush)
SetSnapPointType_Background(Color)
End Sub
Private Sub UpdateStatusGrid(bShowGrid As Boolean, bShowGridFrame As Boolean)
'tsStatusGrid.ForeColor = If(m_bShowGrid, Color.Black, Color.Gray)
StatusGridText = If(bShowGrid, "GRID ON ", "GRID OFF")
@@ -578,7 +534,7 @@ Public Class MyStatusBarVM
' Se previsto, imposto progress
If nProg > 0 Then SetLoadingProgress(Math.Min(nProg, 100))
' Notifico a simulazione aggiornamento dati
Application.Msn.NotifyColleagues(Application.SIMULATIONEXPANDER_UPDATE_CNCDATA)
Map.refSimulationExpanderVM.SimulationExpander_Update_CncData()
' Costringo ad aggiornare
UpdateUI()
' Eventuale attesa
+1 -1
View File
@@ -100,7 +100,7 @@ Public Class MyToolDbWindowVM
End Sub
Public Overrides Sub OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String) 'Handles m_ToolScene.OnCursorPos
Application.Msn.NotifyColleagues(Application.NOTIFYCURRPOS, sCursorPos)
Map.refStatusBarVM.NotifyCurrPos(sCursorPos)
End Sub
#End Region ' Methods
+89 -41
View File
@@ -166,11 +166,13 @@ Public Class TopCommandBarVM
Private Sub SetDrawMode(value As Boolean, bLoadObjTree As Boolean)
If value Then
Application.Msn.NotifyColleagues(Application.DRAWMODE_ISCHECKED)
DrawMode_IsChecked()
EgtResetCurrMachGroup()
EgtResetCurrPartLayer()
EgtZoom(ZM.ALL, False)
If bLoadObjTree Then Application.Msn.NotifyColleagues(Application.LOADOBJTREE)
If Not IsNothing(Map.refManageLayerExpanderVM) Then
If bLoadObjTree Then Map.refManageLayerExpanderVM.LoadObjTree()
End If
IniFile.m_ProjectMode = ProjectModeOpt.DRAW
' attivo database utensili, lavorazioni e setup
If Not IsNothing(Map.refMachinePanelVM) Then
@@ -204,7 +206,7 @@ Public Class TopCommandBarVM
' Eventuale esecuzione script dopo fine Mach
ExecExitMachScript()
' Ricarico albero entità geometriche
Application.Msn.NotifyColleagues(Application.LOADOBJTREE)
Map.refManageLayerExpanderVM.LoadObjTree()
End If
End Sub
@@ -255,34 +257,6 @@ Public Class TopCommandBarVM
Map.SetRefTopCommandBarVM(Me)
' Inizializzo la selezione della modilità Draw all'apertura del programma
DrawIsChecked = True
Application.Msn.Register(Application.SETMACHININGMODE, Sub()
MachiningIsChecked = True
OnPropertyChanged("MachiningIsChecked")
End Sub)
Application.Msn.Register(Application.MACHGROUPSRESULT, Sub(nErr As Integer)
If nErr = 0 Then
Application.Msn.NotifyColleagues(Application.UPDATECURRENTMACHINE)
Application.Msn.NotifyColleagues(Application.MACHININGMODE_ISCHECKED)
Application.Msn.NotifyColleagues(Application.UPDATEOPERATIONMACHININGLIST)
IniFile.m_ProjectMode = ProjectModeOpt.MACHINING
Else
m_MachiningIsChecked = False
If nErr = 1 Then
' Error loading or creating Machining Group - LAVORA
MessageBox.Show(EgtMsg(10008), EgtMsg(5002), MessageBoxButton.OK, MessageBoxImage.Error)
ElseIf nErr = -1 Then
' Non ci sono gruppi di lavoro - LAVORA
MessageBox.Show(EgtMsg(5551), EgtMsg(5002), MessageBoxButton.OK, MessageBoxImage.Information)
End If
End If
End Sub)
Application.Msn.Register(Application.MAINWINDOW_CONTENTRENDERED, Sub()
If IniFile.m_ProjectMode = ProjectModeOpt.ONLYDRAW Then
MachiningIsEnabled = False
Else
MachiningIsEnabled = True
End If
End Sub)
End Sub
#End Region
@@ -308,7 +282,7 @@ Public Class TopCommandBarVM
''' </summary>
Friend Sub NewCmd()
Map.refProjectVM.GetController.NewProject(True)
Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREENOMARK, EgtGetCurrLayer())
Map.refManageLayerExpanderVM.SelectIdInObjTreeNoMark(EgtGetCurrLayer())
OnPropertyChanged("MruFileNames")
End Sub
@@ -343,7 +317,7 @@ Public Class TopCommandBarVM
Else
Map.refProjectVM.GetController.OpenProject(sFilePath, False)
End If
Application.Msn.NotifyColleagues(Application.SELECTIDINOBJTREENOMARK, EgtGetCurrLayer())
Map.refManageLayerExpanderVM.SelectIdInObjTreeNoMark(EgtGetCurrLayer())
End Sub
#End Region ' OpenCommand
@@ -389,7 +363,7 @@ Public Class TopCommandBarVM
''' Execute the Save. This method is invoked by the SaveCommand.
''' </summary>
Public Sub Save(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SAVEPROJECT)
Map.refProjectVM.SaveProject()
End Sub
#End Region ' SaveCommand
@@ -412,7 +386,7 @@ Public Class TopCommandBarVM
''' Execute the SaveAs. This method is invoked by the SaveAsCommand.
''' </summary>
Public Sub SaveAs(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.SAVEASPROJECT)
Map.refProjectVM.SaveAsProject()
End Sub
#End Region ' SaveAsCommand
@@ -435,7 +409,7 @@ Public Class TopCommandBarVM
''' Execute the Insert. This method is invoked by the InsertCommand.
''' </summary>
Public Sub Insert(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.INSERTPROJECT)
Map.refProjectVM.InsertProject()
End Sub
#End Region ' InsertCommand
@@ -458,7 +432,7 @@ Public Class TopCommandBarVM
''' Execute the Import. This method is invoked by the ImportCommand.
''' </summary>
Public Sub Import(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.IMPORTPROJECT)
Map.refProjectVM.ImportProject()
End Sub
#End Region ' ImportCommand
@@ -481,7 +455,7 @@ Public Class TopCommandBarVM
''' Execute the Export. This method is invoked by the ExportCommand.
''' </summary>
Public Sub Export(ByVal param As Object)
Application.Msn.NotifyColleagues(Application.EXPORTPROJECT)
Map.refProjectVM.ExportProject()
End Sub
#End Region ' ExportCommand
@@ -547,14 +521,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
Application.Msn.NotifyColleagues(Application.SAVEPROJECT)
Map.refProjectVM.SaveProject()
End If
EgtGetCurrFilePath(sCurrProject)
' se modificato, chiedo se si vuole salvare
Else
If EgtGetModified() Then
If MessageBox.Show(EgtMsg(MSG_TOPCOMMANDBAR + 11), "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then
Application.Msn.NotifyColleagues(Application.SAVEPROJECT)
Map.refProjectVM.SaveProject()
End If
End If
End If
@@ -647,7 +621,7 @@ Public Class TopCommandBarVM
If bEx OrElse EgtWPFLib5.MapiMailMessage.m_ErrorCode <> 0 Then
MessageBox.Show(String.Format(EgtMsg(MSG_TOPCOMMANDBAR + 12), sSupportAddress, sZipToCreate), EgtMsg(MSG_MESSAGEBOX + 3), MessageBoxButton.OK, MessageBoxImage.Information)
Else
Application.Msn.NotifyColleagues(Application.NOTIFYSTATUSOUTPUT, EgtMsg(MSG_TOPCOMMANDBAR + 14))
Map.refStatusBarVM.NotifyStatusOutput(EgtMsg(MSG_TOPCOMMANDBAR + 14))
End If
End Sub
@@ -655,4 +629,78 @@ Public Class TopCommandBarVM
#End Region ' Commands
#Region "METHODS"
Friend Sub MachGroupsResult(nErr As Integer)
If nErr = 0 Then
Map.refMachinePanelVM.UpdateCurrentMachine()
MachiningMode_IsChecked()
Map.refMachiningTreeExpanderVM.UpdateOperationMachiningList()
IniFile.m_ProjectMode = ProjectModeOpt.MACHINING
Else
m_MachiningIsChecked = False
If nErr = 1 Then
' Error loading or creating Machining Group - LAVORA
MessageBox.Show(EgtMsg(10008), EgtMsg(5002), MessageBoxButton.OK, MessageBoxImage.Error)
ElseIf nErr = -1 Then
' Non ci sono gruppi di lavoro - LAVORA
MessageBox.Show(EgtMsg(5551), EgtMsg(5002), MessageBoxButton.OK, MessageBoxImage.Information)
End If
End If
End Sub
Friend Sub SetMachiningMode()
MachiningIsChecked = True
OnPropertyChanged("MachiningIsChecked")
End Sub
Friend Sub DrawMode_IsChecked()
' OperationsListExpanderVM
If Not IsNothing(Map.refOperationsListExpanderVM) Then
Map.refOperationsListExpanderVM.DrawMode_IsChecked()
End If
' ProjectV
If Not IsNothing(Map.refProjectV) Then
Map.refProjectV.DrawMode_IsChecked()
End If
' ProjectVM
If Not IsNothing(Map.refProjectVM) Then
Map.refProjectVM.DrawMode_IsChecked()
End If
' OptionPanelVM
If Not IsNothing(Map.refOptionPanelVM) Then
Map.refOptionPanelVM.DrawMode_IsChecked()
End If
' MyMachinePanelVM
If Not IsNothing(Map.refMachinePanelVM) Then
Map.refMachinePanelVM.MachineListIsEnabled = True
End If
' InstrumentPanel
If Not IsNothing(Map.refInstrumentPanelVM) Then
Map.refInstrumentPanelVM.AnalyzeIsEnabled = True
End If
' MyStatusBarVM
If Not IsNothing(Map.refStatusBarVM) Then
Map.refStatusBarVM.OutputMessage = String.Empty
End If
End Sub
Friend Sub MachiningMode_IsChecked()
' ProjectV
Map.refProjectV.MachiningMode_IsChecked()
' ProjectVM
Map.refProjectVM.MachiningMode_IsChecked()
' OptionPanelVM
Map.refOptionPanelVM.MachiningMode_IsChecked()
' MyMachinePanelVM
Map.refMachinePanelVM.MachineListIsEnabled = False
' InstrumentPanel
Map.refInstrumentPanelVM.AnalyzeIsChecked = False
Map.refInstrumentPanelVM.AnalyzeIsEnabled = False
' MyStatusBarVM
Map.refStatusBarVM.OutputMessage = String.Empty
End Sub
#End Region
End Class
+64 -2
View File
@@ -20,6 +20,12 @@ Module Map
Private m_refMachiningTreeExpanderVM As MachiningTreeExpanderVM
'Private m_refMachGroupPanelVM As MachGroupPanelVM
Private m_refInstrumentPanelVM As InstrumentPanelVM
Private m_refManageLayerExpanderVM As ManageLayerExpanderVM
Private m_refInputExpanderVM As InputExpanderVM
Private m_refShowPanelVM As ShowPanelVM
Private m_refInfoExpanderVM As InfoExpanderVM
Private m_refDrawPanelVM As DrawPanelVM
Private m_refProjectV As ProjectV
#Region "Get"
@@ -30,7 +36,7 @@ Module Map
End Property
Public ReadOnly Property refStatusBarVM As MyStatusBarVM
Get
Return DirectCast( LibMap.refStatusBarVM, MyStatusBarVM)
Return DirectCast(LibMap.refStatusBarVM, MyStatusBarVM)
End Get
End Property
Public ReadOnly Property refTopCommandBarVM As TopCommandBarVM
@@ -103,6 +109,36 @@ Module Map
Return m_refInstrumentPanelVM
End Get
End Property
Public ReadOnly Property refManageLayerExpanderVM As ManageLayerExpanderVM
Get
Return m_refManageLayerExpanderVM
End Get
End Property
Public ReadOnly Property refInputExpanderVM As InputExpanderVM
Get
Return m_refInputExpanderVM
End Get
End Property
Public ReadOnly Property refShowPanelVM As ShowPanelVM
Get
Return m_refShowPanelVM
End Get
End Property
Public ReadOnly Property refInfoExpanderVM As InfoExpanderVM
Get
Return m_refInfoExpanderVM
End Get
End Property
Public ReadOnly Property refDrawPanelVM As DrawPanelVM
Get
Return m_refDrawPanelVM
End Get
End Property
Public ReadOnly Property refProjectV As ProjectV
Get
Return m_refProjectV
End Get
End Property
#End Region ' Get
@@ -168,6 +204,30 @@ Module Map
m_refInstrumentPanelVM = InstrumentPanelVM
Return Not IsNothing(m_refInstrumentPanelVM)
End Function
Friend Function SetRefManageLayerExpanderVM(ManageLayerExpanderVM As ManageLayerExpanderVM) As Boolean
m_refManageLayerExpanderVM = ManageLayerExpanderVM
Return Not IsNothing(m_refManageLayerExpanderVM)
End Function
Friend Function SetRefInputExpanderVM(InputExpanderVM As InputExpanderVM) As Boolean
m_refInputExpanderVM = InputExpanderVM
Return Not IsNothing(m_refInputExpanderVM)
End Function
Friend Function SetRefShowPanelVM(ShowPanelVM As ShowPanelVM) As Boolean
m_refShowPanelVM = ShowPanelVM
Return Not IsNothing(m_refShowPanelVM)
End Function
Friend Function SetRefInfoExpanderVM(InfoExpanderVM As InfoExpanderVM) As Boolean
m_refInfoExpanderVM = InfoExpanderVM
Return Not IsNothing(m_refInfoExpanderVM)
End Function
Friend Function SetRefDrawPanelVM(DrawPanelVM As DrawPanelVM) As Boolean
m_refDrawPanelVM = DrawPanelVM
Return Not IsNothing(m_refDrawPanelVM)
End Function
Friend Function SetRefProjectV(ProjectV As ProjectV) As Boolean
m_refProjectV = ProjectV
Return Not IsNothing(m_refProjectV)
End Function
#End Region ' Set
@@ -184,7 +244,9 @@ Module Map
Not IsNothing(m_refOptionPanelVM) AndAlso Not IsNothing(m_refDrawOptionPanelVM) AndAlso Not IsNothing(m_refMachiningOptionPanelVM) AndAlso
Not IsNothing(m_refEstimationsExpanderVM) AndAlso Not IsNothing(m_refOperationsListExpanderVM) AndAlso
Not IsNothing(m_refOperationParametersExpanderVM) AndAlso Not IsNothing(m_refMachiningTreeExpanderVM) AndAlso
Not IsNothing(LibMap.refMachGroupPanelVM) AndAlso Not IsNothing(m_refInstrumentPanelVM)
Not IsNothing(LibMap.refMachGroupPanelVM) AndAlso Not IsNothing(m_refInstrumentPanelVM) AndAlso Not IsNothing(m_refManageLayerExpanderVM) AndAlso
Not IsNothing(m_refInputExpanderVM) AndAlso Not IsNothing(m_refShowPanelVM) AndAlso Not IsNothing(m_refInfoExpanderVM) AndAlso
Not IsNothing(m_refDrawPanelVM) AndAlso Not IsNothing(m_refProjectV)
End Function
#End Region ' Init