2022-08-12 21:54:56 +00:00
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
|
|
|
|
|
|
namespace UI_MAUI.Pages;
|
|
|
|
|
|
|
|
|
|
public partial class LoadProject
|
|
|
|
|
{
|
|
|
|
|
private readonly List<RecentProject> recentProjects = new();
|
|
|
|
|
|
|
|
|
|
private string newProjectDestination = string.Empty;
|
|
|
|
|
|
|
|
|
|
#region Overrides of ComponentBase
|
|
|
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
|
|
|
{
|
|
|
|
|
await base.OnInitializedAsync();
|
|
|
|
|
await this.LoadRecentProjects();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
private readonly record struct RecentProject(string Path, string Name, bool Available);
|
|
|
|
|
|
|
|
|
|
private async Task LoadRecentProjects()
|
|
|
|
|
{
|
|
|
|
|
var appDataDirectory = FileSystem.Current.AppDataDirectory;
|
|
|
|
|
var recentProjectsFile = Path.Join(appDataDirectory, "recentProjects.json");
|
|
|
|
|
if (!File.Exists(recentProjectsFile))
|
|
|
|
|
await File.WriteAllTextAsync(recentProjectsFile, string.Empty, Encoding.UTF8);
|
|
|
|
|
|
|
|
|
|
// Read the JSON data from that file & decode it to an array of recent projects:
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async Task WriteRecentProjects()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-14 18:08:57 +00:00
|
|
|
|
private Task ChooseProjectDestination()
|
2022-08-12 21:54:56 +00:00
|
|
|
|
{
|
2022-08-14 18:08:57 +00:00
|
|
|
|
#if WINDOWS
|
|
|
|
|
return this.ChooseProjectDestinationWindows();
|
|
|
|
|
#elif MACCATALYST
|
|
|
|
|
return this.ChooseProjectDestinationMacOS();
|
|
|
|
|
#else
|
|
|
|
|
return Task.CompletedTask;
|
|
|
|
|
#endif
|
2022-08-12 21:54:56 +00:00
|
|
|
|
}
|
|
|
|
|
}
|