44using System . Windows ;
55using System . Windows . Controls ;
66using System . Windows . Documents ;
7+ using System . Windows . Forms ;
78using Flow . Launcher . Infrastructure . Storage ;
89using 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 ;
916
1017namespace Flow . Launcher . Core . Plugin
1118{
@@ -224,6 +231,7 @@ public Control CreateSettingPanel()
224231 break ;
225232 }
226233 case "inputWithFileBtn" :
234+ case "inputWithFolderBtn" :
227235 {
228236 var textBox = new TextBox ( )
229237 {
@@ -243,6 +251,24 @@ public Control CreateSettingPanel()
243251 Margin = new Thickness ( 10 , 0 , 0 , 0 ) , Content = "Browse"
244252 } ;
245253
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+
246272 var dockPanel = new DockPanel ( ) { Margin = settingControlMargin } ;
247273
248274 DockPanel . SetDock ( Btn , Dock . Right ) ;
0 commit comments