From 14cd4ba2174c3e0bd74f58f2cc72769fd326a6e6 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 11 Jul 2018 20:05:13 +0300 Subject: Working on PPC. --- .../Navigation/DefaultNavigationManager.cs | 19 +++++++++++++++++-- .../PPCApplication/DefaultPPCApplicationManager.cs | 10 +++++----- 2 files changed, 22 insertions(+), 7 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs index 448fc0edc..0ede1306f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs @@ -28,6 +28,7 @@ namespace Tango.PPC.UI.Navigation private Object _currentVM; private String _lastFullPath; private bool _preventHistory; + private bool _navigating_back; private Stack _navigationHistory; @@ -139,9 +140,19 @@ namespace Tango.PPC.UI.Navigation if (_currentVM != null && _currentVM is INavigationBlocker) { - if (!await (_currentVM as INavigationBlocker).OnNavigateOutRequest()) + if (_navigating_back) { - return false; + if (!await (_currentVM as INavigationBlocker).OnNavigateBackRequest()) + { + return false; + } + } + else + { + if (!await (_currentVM as INavigationBlocker).OnNavigateOutRequest()) + { + return false; + } } } @@ -260,6 +271,8 @@ namespace Tango.PPC.UI.Navigation /// public async Task NavigateBack() { + _navigating_back = true; + String first = _navigationHistory.Pop(); _preventHistory = true; @@ -268,12 +281,14 @@ namespace Tango.PPC.UI.Navigation { RaisePropertyChanged(nameof(CanNavigateBack)); _preventHistory = false; + _navigating_back = false; return true; } else { _navigationHistory.Push(first); _preventHistory = false; + _navigating_back = false; RaisePropertyChanged(nameof(CanNavigateBack)); return false; } 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 8c112ff7a..c67e83fc6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -193,12 +193,12 @@ namespace Tango.PPC.UI.PPCApplication private async void ConnectToMachine() { - //Transport.Discovery.UsbCommunicationScanner scanner = new Transport.Discovery.UsbCommunicationScanner(UsbSerialBaudRates.BR_9600); - //var response = await scanner.Scan(new ConnectRequest() { Password = "1234" }, TimeSpan.FromSeconds(10)); + Transport.Discovery.UsbCommunicationScanner scanner = new Transport.Discovery.UsbCommunicationScanner(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; + var machine = new MachineOperator(response.Adapter); + await machine.Connect(); + ConnectedMachine = machine; } } } -- cgit v1.3.1