aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules
diff options
context:
space:
mode:
authorRoy <Roy.mail.net@gmail.com>2023-07-02 10:18:45 +0300
committerRoy <Roy.mail.net@gmail.com>2023-07-02 10:18:45 +0300
commit2420757c5e5dd6190df3a1e6d6bbf907a7c47806 (patch)
treec9360eec5cef5bd81dc0d6ca7e7e2794a877368c /Software/Visual_Studio/PPC/Modules
parentc267a46b14ebb3babe8a0378bd403346ca182354 (diff)
downloadTango-2420757c5e5dd6190df3a1e6d6bbf907a7c47806.tar.gz
Tango-2420757c5e5dd6190df3a1e6d6bbf907a7c47806.zip
Implemented specific location for storage root.
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs58
1 files changed, 42 insertions, 16 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 9b22fcdb5..a76096725 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
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -108,10 +109,27 @@ namespace Tango.PPC.Storage.ViewModels
_allow_exit = false;
_selectedItem = null;
- if (StorageProvider.IsConnected && StorageProvider.Drive != null)
+ if (BuildProvider.IsEureka)
+ {
+ if (Settings.StorageRootPath == null)
+ {
+ Settings.StorageRootPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Twine", "Tango", "Storage");
+ Directory.CreateDirectory(Settings.StorageRootPath);
+ }
+ }
+
+ if ((StorageProvider.IsConnected && StorageProvider.Drive != null) || Settings.StorageRootPath != null)
{
CurrentPath = null;
- CurrentPath = StorageProvider.Drive.RootDirectory.FullName;
+
+ if (Settings.StorageRootPath != null && Directory.Exists(Settings.StorageRootPath))
+ {
+ CurrentPath = Settings.StorageRootPath;
+ }
+ else
+ {
+ CurrentPath = StorageProvider.Drive.RootDirectory.FullName;
+ }
if (Request.Intent == StorageNavigationIntent.SaveFile)
{
@@ -143,13 +161,16 @@ namespace Tango.PPC.Storage.ViewModels
/// <param name="e">The drive info.</param>
private void StorageProvider_StorageConnected(object sender, System.IO.DriveInfo e)
{
- InvokeUI(async () =>
+ if (!BuildProvider.IsEureka)
{
- if (await NotificationProvider.ShowQuestion("Storage device inserted. Do you want to browse?"))
+ InvokeUI(async () =>
{
- await NavigationManager.NavigateTo<StorageModule>();
- }
- });
+ if (await NotificationProvider.ShowQuestion("Storage device inserted. Do you want to browse?"))
+ {
+ await NavigationManager.NavigateTo<StorageModule>();
+ }
+ });
+ }
}
/// <summary>
@@ -159,21 +180,26 @@ namespace Tango.PPC.Storage.ViewModels
/// <param name="e">The drive info.</param>
private void StorageProvider_StorageDisconnected(object sender, System.IO.DriveInfo e)
{
- InvokeUI(async () =>
+ if (!BuildProvider.IsEureka)
{
- if (IsVisible)
+ InvokeUI(async () =>
{
- _allow_exit = true;
- await NotificationProvider.ShowError("Storage device disconnected.");
- await NavigationManager.NavigateBack();
- CurrentPath = null;
- }
- });
+ if (IsVisible)
+ {
+ _allow_exit = true;
+ await NotificationProvider.ShowError("Storage device disconnected.");
+ await NavigationManager.NavigateBack();
+ CurrentPath = null;
+ }
+ });
+ }
}
public override Task<bool> OnNavigateBackRequest()
{
- if (_allow_exit || CurrentPath == StorageProvider.Drive.RootDirectory.FullName)
+ String path = Settings.StorageRootPath != null ? Settings.StorageRootPath : StorageProvider.Drive.RootDirectory.FullName;
+
+ if (_allow_exit || CurrentPath == path)
{
return Task.FromResult(true);
}