aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs14
1 files changed, 11 insertions, 3 deletions
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<bool> OnNavigateBackRequest()
{
- if (CurrentPath == StorageProvider.Drive.RootDirectory.FullName || _allow_exit)
+ if (_allow_exit || CurrentPath == StorageProvider.Drive.RootDirectory.FullName)
{
return Task.FromResult(true);
}