Implemented save as dialog for Windows.
This commit is contained in:
parent
0580bf0785
commit
b1f5e94069
@ -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
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
#if MACCATALYST
|
||||
|
||||
namespace UI_MAUI.Pages;
|
||||
|
||||
public partial class LoadProject
|
||||
{
|
||||
private Task ChooseProjectDestinationMacOS()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -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<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;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user