Use FileDialogHelper
MODIFY
WalletWasabi.Fluent/Controls/QrCode.cs
WalletWasabi.Fluent/Controls/QrCode.cs
-using System.Collections.Generic;
using System.IO;
using System.Reactive;
using System.Reactive.Linq;
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
-using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Media;
using Avalonia.Media.Imaging;
using Avalonia.Metadata;
using Avalonia.Platform;
using ReactiveUI;
+using WalletWasabi.Fluent.Helpers;
namespace WalletWasabi.Fluent.Controls;
@@ -86,19 +85,11 @@ public class QrCode : Control
return;
}
- var sfd = new SaveFileDialog();
- sfd.Title = "Save QR Code...";
- sfd.InitialFileName = $"{address}.png";
- sfd.Directory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
- sfd.Filters = new List<FileDialogFilter>
- {
- new() { Name = "Portable Network Graphics (PNG) Image file", Extensions = { "png" } }
- };
-
- if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime lifetime)
- {
- var path = await sfd.ShowAsync(lifetime.MainWindow);
-
+ var path = await FileDialogHelper.ShowSaveFileDialogAsync(
+ "Save QR Code...",
+ new [] { "png" },
+ $"{address}.png",
+ Environment.GetFolderPath(Environment.SpecialFolder.MyPictures));
if (!string.IsNullOrWhiteSpace(path))
{
var ext = Path.GetExtension(path);
@@ -125,7 +116,6 @@ public class QrCode : Control
rtb.Save(path);
}
}
- }
private bool[,] AddPaddingToMatrix(bool[,] source)
{

Use FileDialogHelper