diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-12 14:03:47 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-12 14:03:47 +0300 |
| commit | 856a23723afcc9d48c0f019dc33a259ac6c279ed (patch) | |
| tree | 6cc82030ee2d9c74bd7f841bfdc6a0c163def97d /Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication | |
| parent | 70fe7f13b519df86420f8c2b97cf8eb3ab67e9a5 (diff) | |
| download | Tango-856a23723afcc9d48c0f019dc33a259ac6c279ed.tar.gz Tango-856a23723afcc9d48c0f019dc33a259ac6c279ed.zip | |
Implemented continuous request timeouts.
Implemented continuous request abort exception.
Added log object for real time logs.
Some work on PPC & Machine Studio.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs | 58 |
1 files changed, 3 insertions, 55 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs index c67e83fc6..5f5fb4f7e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -18,6 +18,7 @@ using Tango.PPC.Common.Modules; using System.Windows.Threading; using Tango.Transport.Adapters; using Tango.PMR.Connection; +using Tango.PPC.Common.Connection; namespace Tango.PPC.UI.PPCApplication { @@ -31,11 +32,6 @@ namespace Tango.PPC.UI.PPCApplication private List<PPCViewModel> _notifiedViewModels; /// <summary> - /// Occurs when the connected machine property has changed. - /// </summary> - public event EventHandler<IMachineOperator> ConnectedMachineChanged; - - /// <summary> /// Occurs when the application has started. /// </summary> public event EventHandler ApplicationStarted; @@ -50,26 +46,6 @@ namespace Tango.PPC.UI.PPCApplication /// </summary> public bool IsShuttingDown { get; private set; } - private IMachineOperator _connectedMachine; - /// <summary> - /// Gets or sets the currently connected machine if any. - /// </summary> - /// <exception cref="NotImplementedException"> - /// </exception> - public IMachineOperator ConnectedMachine - { - get - { - return _connectedMachine; - } - set - { - _connectedMachine = value; - RaisePropertyChangedAuto(); - ConnectedMachineChanged?.Invoke(this, ConnectedMachine); - } - } - /// <summary> /// Gets the application version. /// </summary> @@ -82,26 +58,10 @@ namespace Tango.PPC.UI.PPCApplication } } - private Machine _machine; - /// <summary> - /// Gets the associated observable entity machine. - /// </summary> - public Machine Machine - { - private set - { - _machine = value; - } - get - { - return _machine; - } - } - /// <summary> /// Initializes a new instance of the <see cref="DefaultPPCApplicationManager"/> class. /// </summary> - public DefaultPPCApplicationManager() + public DefaultPPCApplicationManager(IMachineProvider machineProvider) { if (!DesignMode) { @@ -136,7 +96,6 @@ namespace Tango.PPC.UI.PPCApplication } ObservablesEntitiesAdapter.Instance.Initialize(); - Machine = ObservablesEntitiesAdapter.Instance.Machines.FirstOrDefault(); }); ApplicationStarted?.Invoke(this, new EventArgs()); @@ -168,8 +127,7 @@ namespace Tango.PPC.UI.PPCApplication } ModulesInitialized?.Invoke(this, new EventArgs()); - - ConnectToMachine(); + machineProvider.Init(); }; } }; @@ -190,15 +148,5 @@ namespace Tango.PPC.UI.PPCApplication vm.OnApplicationShuttingDown(); } } - - private async void ConnectToMachine() - { - Transport.Discovery.UsbCommunicationScanner<ConnectRequest, ConnectResponse> scanner = new Transport.Discovery.UsbCommunicationScanner<ConnectRequest, ConnectResponse>(UsbSerialBaudRates.BR_9600); - var response = await scanner.Scan(new ConnectRequest() { Password = "1234" }, TimeSpan.FromSeconds(10)); - - var machine = new MachineOperator(response.Adapter); - await machine.Connect(); - ConnectedMachine = machine; - } } } |
