Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for managed dialogs #329

Open
Sawa121212 opened this issue Dec 18, 2023 · 0 comments
Open

Add support for managed dialogs #329

Sawa121212 opened this issue Dec 18, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@Sawa121212
Copy link

Sawa121212 commented Dec 18, 2023

Avalonia provides managed dialogs.

image
After opening UseManagedSystemDialogs, OpenFileDialog opens abnormally. Add support for managed dialogs.

How to test:

  1. Add the UseManagedSystemDialogs() configuration to AppBuilder
  2. Test on dialog windows
    Example of calling a window:
private async Task OnImportPicture()
{
    if (Application.Current?.ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime desktop ||
        desktop.MainWindow?.StorageProvider is not { } provider)
    {
        throw new NullReferenceException("Missing StorageProvider instance.");
    }

    IReadOnlyList<IStorageFile> files = await provider.OpenFilePickerAsync(new FilePickerOpenOptions
    {
        Title = "Choose File",
        AllowMultiple = false
    }).ConfigureAwait(true);

    if (files.Count >= 1)
    {
        string filePath = files[0].TryGetLocalPath();
        if (File.Exists(filePath))
        {
            Picture = filePath;
        }
    }
}
@Sawa121212 Sawa121212 reopened this Dec 18, 2023
@Sawa121212 Sawa121212 changed the title Add support for Avalonia 1 provides managed dialogs Add support for managed dialogs Dec 18, 2023
@SKProCH SKProCH added the enhancement New feature or request label Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants