diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2017-12-27 16:22:17 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2017-12-27 16:22:17 +0200 |
| commit | 47d7120b81dd646ed9b18740c9cc87a7a33a7c58 (patch) | |
| tree | a40a87c00b514857d6ab817530950a70783a7590 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication | |
| parent | af8530c50d90c12ebe60383e67101920760c314f (diff) | |
| download | Tango-47d7120b81dd646ed9b18740c9cc87a7a33a7c58.tar.gz Tango-47d7120b81dd646ed9b18740c9cc87a7a33a7c58.zip | |
Implemented KeepAlive Mechanism.
Direct Synchronization is now working good.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs | 22 |
1 files changed, 21 insertions, 1 deletions
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 b0315e633..336681801 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -33,7 +33,27 @@ namespace Tango.MachineStudio.UI.StudioApplication public IExternalBridgeClient ConnectedMachine { get { return _connectedMachine; } - set { _connectedMachine = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(IsMachineConnected)); } + set + { + _connectedMachine = value; + RaisePropertyChangedAuto(); + RaisePropertyChanged(nameof(IsMachineConnected)); + + if (_connectedMachine != null) + { + _connectedMachine.StateChanged -= ConnectedMachine_StateChanged; + _connectedMachine.StateChanged += ConnectedMachine_StateChanged; + } + } + } + + private void ConnectedMachine_StateChanged(object sender, Transport.TransportComponentState e) + { + if (e == Transport.TransportComponentState.Disconnected || e == Transport.TransportComponentState.Failed) + { + ConnectedMachine = null; + } + } public bool IsMachineConnected |
