diff --git a/I18N Commander/UI MAUI/Pages/LoadProject.razor.cs b/I18N Commander/UI MAUI/Pages/LoadProject.razor.cs index 0dc893f..6b0ec1a 100644 --- a/I18N Commander/UI MAUI/Pages/LoadProject.razor.cs +++ b/I18N Commander/UI MAUI/Pages/LoadProject.razor.cs @@ -37,16 +37,14 @@ public partial class LoadProject } - private async Task ChooseProjectDestination() + private Task ChooseProjectDestination() { - var projectDestination = await FilePicker.PickAsync(new PickOptions - { - PickerTitle = "Choose the project destination", - }); - - if(projectDestination is null) - return; - - this.newProjectDestination = projectDestination!.FullPath; +#if WINDOWS + return this.ChooseProjectDestinationWindows(); +#elif MACCATALYST + return this.ChooseProjectDestinationMacOS(); +#else + return Task.CompletedTask; +#endif } } \ No newline at end of file diff --git a/I18N Commander/UI MAUI/Platforms/MacCatalyst/Pages/LoadProject.razor.mac.cs b/I18N Commander/UI MAUI/Platforms/MacCatalyst/Pages/LoadProject.razor.mac.cs new file mode 100644 index 0000000..7950590 --- /dev/null +++ b/I18N Commander/UI MAUI/Platforms/MacCatalyst/Pages/LoadProject.razor.mac.cs @@ -0,0 +1,13 @@ +#if MACCATALYST + +namespace UI_MAUI.Pages; + +public partial class LoadProject +{ + private Task ChooseProjectDestinationMacOS() + { + return Task.CompletedTask; + } +} + +#endif \ No newline at end of file diff --git a/I18N Commander/UI MAUI/Platforms/Windows/Pages/LoadProject.razor.win.cs b/I18N Commander/UI MAUI/Platforms/Windows/Pages/LoadProject.razor.win.cs new file mode 100644 index 0000000..9c44bf6 --- /dev/null +++ b/I18N Commander/UI MAUI/Platforms/Windows/Pages/LoadProject.razor.win.cs @@ -0,0 +1,33 @@ +#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>("I18N Commander Projects", new List { ".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; + } +} + +#endif \ No newline at end of file