2022-08-14 18:08:57 +00:00
|
|
|
|
#if WINDOWS
|
|
|
|
|
|
|
|
|
|
namespace UI_MAUI.Pages;
|
|
|
|
|
|
|
|
|
|
using Windows.Storage.Pickers;
|
|
|
|
|
using WindowsSavePicker = Windows.Storage.Pickers.FileSavePicker;
|
|
|
|
|
|
|
|
|
|
public partial class LoadProject
|
|
|
|
|
{
|
|
|
|
|
private async Task ChooseProjectDestinationWindows()
|
|
|
|
|
{
|
|
|
|
|
var saveDialog = new WindowsSavePicker
|
|
|
|
|
{
|
|
|
|
|
CommitButtonText = "Create the project here",
|
|
|
|
|
SuggestedStartLocation = PickerLocationId.DocumentsLibrary,
|
|
|
|
|
FileTypeChoices =
|
|
|
|
|
{
|
|
|
|
|
new KeyValuePair<string, IList<string>>("I18N Commander Projects", new List<string> { ".i18nc" }),
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var hwnd = ((MauiWinUIWindow)App.Current.Windows[0].Handler.PlatformView).WindowHandle;
|
|
|
|
|
WinRT.Interop.InitializeWithWindow.Initialize(saveDialog, hwnd);
|
|
|
|
|
|
|
|
|
|
var result = await saveDialog.PickSaveFileAsync();
|
|
|
|
|
if(result is null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
this.newProjectDestination = result.Path;
|
|
|
|
|
}
|
2022-08-15 19:03:38 +00:00
|
|
|
|
|
2022-08-17 19:01:29 +00:00
|
|
|
|
private async Task CreateProjectWindows() => await Task.Run(() =>
|
2022-08-15 19:03:38 +00:00
|
|
|
|
{
|
2022-08-17 19:01:29 +00:00
|
|
|
|
this.DataContextFactory.CreateDataContext(this.newProjectDestination);
|
|
|
|
|
});
|
2022-08-14 18:08:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|