Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@
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
{
Expand Down Expand Up @@ -224,6 +231,7 @@ public Control CreateSettingPanel()
break;
}
case "inputWithFileBtn":
case "inputWithFolderBtn":
{
var textBox = new TextBox()
{
Expand All @@ -243,6 +251,24 @@ public Control CreateSettingPanel()
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);
Expand Down
Loading