4
4
using System . Windows ;
5
5
using System . Windows . Controls ;
6
6
using System . Windows . Documents ;
7
+ using System . Windows . Forms ;
7
8
using Flow . Launcher . Infrastructure . Storage ;
8
9
using Flow . Launcher . Plugin ;
10
+ using CheckBox = System . Windows . Controls . CheckBox ;
11
+ using ComboBox = System . Windows . Controls . ComboBox ;
12
+ using Control = System . Windows . Controls . Control ;
13
+ using Orientation = System . Windows . Controls . Orientation ;
14
+ using TextBox = System . Windows . Controls . TextBox ;
15
+ using UserControl = System . Windows . Controls . UserControl ;
9
16
10
17
namespace Flow . Launcher . Core . Plugin
11
18
{
@@ -224,6 +231,7 @@ public Control CreateSettingPanel()
224
231
break ;
225
232
}
226
233
case "inputWithFileBtn" :
234
+ case "inputWithFolderBtn" :
227
235
{
228
236
var textBox = new TextBox ( )
229
237
{
@@ -243,6 +251,24 @@ public Control CreateSettingPanel()
243
251
Margin = new Thickness ( 10 , 0 , 0 , 0 ) , Content = "Browse"
244
252
} ;
245
253
254
+ Btn . Click += ( _ , _ ) =>
255
+ {
256
+ using CommonDialog dialog = type switch
257
+ {
258
+ "inputWithFolderBtn" => new FolderBrowserDialog ( ) ,
259
+ _ => new OpenFileDialog ( ) ,
260
+ } ;
261
+ if ( dialog . ShowDialog ( ) != DialogResult . OK ) return ;
262
+
263
+ var path = dialog switch
264
+ {
265
+ FolderBrowserDialog folderDialog => folderDialog . SelectedPath ,
266
+ OpenFileDialog fileDialog => fileDialog . FileName ,
267
+ } ;
268
+ textBox . Text = path ;
269
+ Settings [ attribute . Name ] = path ;
270
+ } ;
271
+
246
272
var dockPanel = new DockPanel ( ) { Margin = settingControlMargin } ;
247
273
248
274
DockPanel . SetDock ( Btn , Dock . Right ) ;
0 commit comments