mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[GUI] Replace file dialogs with file pickers.
This commit is contained in:
@@ -30,12 +30,14 @@
|
||||
// Copyright © 2011-2024 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reactive;
|
||||
using System.Threading.Tasks;
|
||||
using Aaru.Decoders.DVD;
|
||||
using Aaru.Localization;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Platform.Storage;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Aaru.Gui.ViewModels.Tabs;
|
||||
@@ -250,25 +252,17 @@ public sealed class DvdWritableInfoViewModel
|
||||
|
||||
async Task SaveElement(byte[] data)
|
||||
{
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
"*.bin"
|
||||
}
|
||||
],
|
||||
Name = UI.Dialog_Binary_files
|
||||
FileTypeChoices = new List<FilePickerFileType>
|
||||
{
|
||||
FilePickerFileTypes.Binary
|
||||
}
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result is null) return;
|
||||
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
var saveFs = new FileStream(result.Path.AbsolutePath, FileMode.Create);
|
||||
saveFs.Write(data, 0, data.Length);
|
||||
|
||||
saveFs.Close();
|
||||
|
||||
Reference in New Issue
Block a user