mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Fix inputWithFileBtn not working in SettingsTemplate.yml
This commit is contained in:
parent
943425bfa1
commit
6604710a3f
1 changed files with 26 additions and 0 deletions
|
|
@ -4,8 +4,15 @@ using System.Threading.Tasks;
|
|||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Forms;
|
||||
using Flow.Launcher.Infrastructure.Storage;
|
||||
using Flow.Launcher.Plugin;
|
||||
using CheckBox = System.Windows.Controls.CheckBox;
|
||||
using ComboBox = System.Windows.Controls.ComboBox;
|
||||
using Control = System.Windows.Controls.Control;
|
||||
using Orientation = System.Windows.Controls.Orientation;
|
||||
using TextBox = System.Windows.Controls.TextBox;
|
||||
using UserControl = System.Windows.Controls.UserControl;
|
||||
|
||||
namespace Flow.Launcher.Core.Plugin
|
||||
{
|
||||
|
|
@ -224,6 +231,7 @@ namespace Flow.Launcher.Core.Plugin
|
|||
break;
|
||||
}
|
||||
case "inputWithFileBtn":
|
||||
case "inputWithFolderBtn":
|
||||
{
|
||||
var textBox = new TextBox()
|
||||
{
|
||||
|
|
@ -243,6 +251,24 @@ namespace Flow.Launcher.Core.Plugin
|
|||
Margin = new Thickness(10, 0, 0, 0), Content = "Browse"
|
||||
};
|
||||
|
||||
Btn.Click += (_, _) =>
|
||||
{
|
||||
CommonDialog dialog = type switch
|
||||
{
|
||||
"inputWithFolderBtn" => new FolderBrowserDialog(),
|
||||
_ => new OpenFileDialog(),
|
||||
};
|
||||
if (dialog.ShowDialog() != DialogResult.OK) return;
|
||||
|
||||
var path = dialog switch
|
||||
{
|
||||
FolderBrowserDialog folderDialog => folderDialog.SelectedPath,
|
||||
OpenFileDialog fileDialog => fileDialog.FileName,
|
||||
};
|
||||
textBox.Text = path;
|
||||
Settings[attribute.Name] = path;
|
||||
};
|
||||
|
||||
var dockPanel = new DockPanel() { Margin = settingControlMargin };
|
||||
|
||||
DockPanel.SetDock(Btn, Dock.Right);
|
||||
|
|
|
|||
Loading…
Reference in a new issue