mirror of
https://github.com/muskit/MercuryConverter.git
synced 2026-06-02 20:24:26 -07:00
40 lines
929 B
C#
40 lines
929 B
C#
using System;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Avalonia.Controls;
|
|
using Avalonia.Platform.Storage;
|
|
using Avalonia.Threading;
|
|
|
|
namespace MercuryConverter.UI.Dialogs;
|
|
|
|
public partial class DataOpen : Window
|
|
{
|
|
public DataOpen()
|
|
{
|
|
InitializeComponent();
|
|
BeginDirSelection();
|
|
}
|
|
|
|
private void BeginDirSelection()
|
|
{
|
|
Dispatcher.UIThread.Invoke(async () =>
|
|
{
|
|
await Task.Delay(200);
|
|
var dirSelection = await GetTopLevel(this)!.StorageProvider.OpenFolderPickerAsync
|
|
(
|
|
new FolderPickerOpenOptions
|
|
{
|
|
Title = "Open Data Folder",
|
|
AllowMultiple = false,
|
|
}
|
|
);
|
|
|
|
if (dirSelection.Count <= 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var d = dirSelection!.First().TryGetLocalPath()!;
|
|
});
|
|
}
|
|
} |