mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
- Add i18n injection to Application.Resources for DynamicResource bindings - Create Avalonia settings views for plugins: - Explorer (ExplorerSettings + QuickAccessLinkSettings dialog) - BrowserBookmark (SettingsControl + CustomBrowserSettingWindow) - Calculator (CalculatorSettings) - ProcessKiller (SettingsControl) - PluginsManager (PluginsManagerSettings) - WebSearch (SettingsControl) - Shell (ShellSetting + converter) - Program (ProgramSetting) - Add IsAvalonia detection pattern for dual-framework dialog support - Update 11 plugin .csproj files with CopyToAvaloniaOutput targets - Add System.Threading.Tasks using for async RelayCommand support
85 lines
2.5 KiB
C#
85 lines
2.5 KiB
C#
#nullable enable
|
|
using Avalonia.Controls;
|
|
using Avalonia.Interactivity;
|
|
using Avalonia.Markup.Xaml;
|
|
using Avalonia.Platform.Storage;
|
|
using Flow.Launcher.Plugin.Explorer.ViewModels;
|
|
using System;
|
|
|
|
namespace Flow.Launcher.Plugin.Explorer.Views.Avalonia
|
|
{
|
|
public partial class ExplorerSettings : UserControl
|
|
{
|
|
public ExplorerSettings()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public ExplorerSettings(SettingsViewModel viewModel)
|
|
{
|
|
InitializeComponent();
|
|
DataContext = viewModel;
|
|
}
|
|
|
|
private void InitializeComponent()
|
|
{
|
|
AvaloniaXamlLoader.Load(this);
|
|
}
|
|
|
|
private void btnOpenIndexingOptions_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
SettingsViewModel.OpenWindowsIndexingOptions();
|
|
}
|
|
|
|
private async void BtnOpenFileEditorPath_OnClick(object? sender, RoutedEventArgs e)
|
|
{
|
|
if (DataContext is not SettingsViewModel vm) return;
|
|
var topLevel = TopLevel.GetTopLevel(this);
|
|
if (topLevel == null) return;
|
|
|
|
var files = await topLevel.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
|
|
{
|
|
AllowMultiple = false
|
|
});
|
|
|
|
if (files.Count > 0)
|
|
{
|
|
vm.FileEditorPath = files[0].Path.LocalPath;
|
|
}
|
|
}
|
|
|
|
private async void BtnOpenFolderEditorPath_OnClick(object? sender, RoutedEventArgs e)
|
|
{
|
|
if (DataContext is not SettingsViewModel vm) return;
|
|
var topLevel = TopLevel.GetTopLevel(this);
|
|
if (topLevel == null) return;
|
|
|
|
var folders = await topLevel.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
|
|
{
|
|
AllowMultiple = false
|
|
});
|
|
|
|
if (folders.Count > 0)
|
|
{
|
|
vm.FolderEditorPath = folders[0].Path.LocalPath;
|
|
}
|
|
}
|
|
|
|
private async void BtnOpenShellPath_OnClick(object? sender, RoutedEventArgs e)
|
|
{
|
|
if (DataContext is not SettingsViewModel vm) return;
|
|
var topLevel = TopLevel.GetTopLevel(this);
|
|
if (topLevel == null) return;
|
|
|
|
var files = await topLevel.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
|
|
{
|
|
AllowMultiple = false
|
|
});
|
|
|
|
if (files.Count > 0)
|
|
{
|
|
vm.ShellPath = files[0].Path.LocalPath;
|
|
}
|
|
}
|
|
}
|
|
}
|