39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
using Avalonia.Controls;
|
|
using Avalonia.Interactivity;
|
|
using Avalonia.Platform.Storage;
|
|
using ModpackUpdater.Apps.Manager.LangRes;
|
|
using Pilz.UI.AvaloniaUI.Dialogs;
|
|
|
|
namespace ModpackUpdater.Apps.Manager.Features.Workspaces.LocalFolder;
|
|
|
|
public partial class LocalFolderWorkspaceConfigEditorView : AvaloniaFlyoutBase
|
|
{
|
|
public LocalFolderWorkspaceConfig Settings { get; }
|
|
|
|
public LocalFolderWorkspaceConfigEditorView() : this(new())
|
|
{
|
|
}
|
|
|
|
public LocalFolderWorkspaceConfigEditorView(LocalFolderWorkspaceConfig settings)
|
|
{
|
|
Settings = settings;
|
|
DataContext = settings;
|
|
InitializeComponent();
|
|
ButtonSearch.ImageSource = AppGlobals.Symbols.GetImageSource(AppSymbols.opened_folder);
|
|
}
|
|
|
|
private async void ButtonSearch_OnClick(object? sender, RoutedEventArgs e)
|
|
{
|
|
if (TopLevel.GetTopLevel(this) is not { } topLevel)
|
|
return;
|
|
|
|
var filePaths = await topLevel.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
|
|
{
|
|
Title = GeneralLangRes.SelectRootFolder,
|
|
AllowMultiple = false,
|
|
});
|
|
|
|
if (filePaths.Count >= 1)
|
|
TextBoxRootFolderPath.Text = filePaths[0].Path.AbsolutePath;
|
|
}
|
|
} |