From f779e2b6f0bb1dedc7644c64651b59e31ce62c00 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 25 Nov 2018 11:24:33 +0200 Subject: Some changes in PPC. --- .../PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs index cb48958dd..e62ebc932 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs @@ -52,17 +52,23 @@ namespace Tango.PPC.Storage.ViewModels StorageProvider.StorageDisconnected += StorageProvider_StorageDisconnected; } - public override void OnNavigatedTo() + public override async void OnNavigatedTo() { base.OnNavigatedTo(); _allow_exit = false; _selectedItem = null; - if (StorageProvider.Drive != null) + if (StorageProvider.IsConnected && StorageProvider.Drive != null) { CurrentPath = StorageProvider.Drive.RootDirectory.FullName; } + else + { + _allow_exit = true; + await NotificationProvider.ShowError("No storage device connected."); + await NavigationManager.NavigateBack(); + } } private async void Close() @@ -97,14 +103,16 @@ namespace Tango.PPC.Storage.ViewModels { if (IsVisible) { + await NotificationProvider.ShowError("Storage device disconnected."); await NavigationManager.NavigateBack(); + CurrentPath = null; } }); } public override Task OnNavigateBackRequest() { - if (CurrentPath == StorageProvider.Drive.RootDirectory.FullName || _allow_exit) + if (_allow_exit || CurrentPath == StorageProvider.Drive.RootDirectory.FullName) { return Task.FromResult(true); } -- cgit v1.3.1