From 7171e1a3b7579420f2060798c649088d70565401 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 30 Aug 2018 12:35:00 +0300 Subject: Implemented In-Memory Transport Adapter. Implemented Embedded In-Memory Emulator. --- .../DefaultStudioApplicationManager.cs | 35 ++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index 17bf57f56..29bb459ee 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -19,6 +19,8 @@ using Tango.Integration.ExternalBridge; using Tango.MachineStudio.Common.EventLogging; using Tango.BL.Enumerations; using Tango.Core.DI; +using Tango.BL.Entities; +using Tango.BL; namespace Tango.MachineStudio.UI.StudioApplication { @@ -55,22 +57,23 @@ namespace Tango.MachineStudio.UI.StudioApplication public bool IsShuttingDown { get; private set; } /// - /// The connected machine + /// Occurs when the connected machine property has changed. /// - private IExternalBridgeClient _connectedMachine; + public event EventHandler ConnectedMachineChanged; /// - /// Occurs when the connected machine property has changed. + /// Gets or sets the machine. /// - public event EventHandler ConnectedMachineChanged; + public Machine Machine { get; private set; } + private IExternalBridgeClient _connectedMachine; /// /// Gets or sets the currently connected machine if any. /// public IExternalBridgeClient ConnectedMachine { get { return _connectedMachine; } - set + private set { _connectedMachine = value; RaisePropertyChangedAuto(); @@ -270,9 +273,31 @@ namespace Tango.MachineStudio.UI.StudioApplication } } + /// + /// Raises the application ready event. + /// public void NotifyApplicationReady() { TangoIOC.Default.GetAllInstancesByBase().ToList().ForEach(x => x.OnApplicationReady()); } + + /// + /// Sets the connected machine. + /// + /// The connected machine. + public void SetConnectedMachine(IExternalBridgeClient connectedMachine) + { + if (connectedMachine != null) + { + Machine = ObservablesStaticCollections.Instance.Machines.SingleOrDefault(x => x.SerialNumber == connectedMachine.SerialNumber); + ConnectedMachine = connectedMachine; + ConnectedMachine.SetMachine(Machine); + } + else + { + Machine = null; + ConnectedMachine = null; + } + } } } -- cgit v1.3.1