25
25
using System . Windows . Documents ;
26
26
using static System . Windows . Forms . LinkLabel ;
27
27
using Droplex ;
28
+ using System . Windows . Forms ;
28
29
29
30
namespace Flow . Launcher . Core . Plugin
30
31
{
@@ -424,7 +425,7 @@ public Control CreateSettingPanel()
424
425
Text = attribute . Description . Replace ( "\\ r\\ n" , "\r \n " ) ,
425
426
Margin = settingTextBlockMargin ,
426
427
Padding = new Thickness ( 0 , 0 , 0 , 0 ) ,
427
- HorizontalAlignment = HorizontalAlignment . Left ,
428
+ HorizontalAlignment = System . Windows . HorizontalAlignment . Left ,
428
429
TextAlignment = TextAlignment . Left ,
429
430
TextWrapping = TextWrapping . Wrap
430
431
} ;
@@ -444,7 +445,7 @@ public Control CreateSettingPanel()
444
445
{
445
446
Text = Settings [ attribute . Name ] as string ?? string . Empty ,
446
447
Margin = settingControlMargin ,
447
- HorizontalAlignment = HorizontalAlignment . Stretch ,
448
+ HorizontalAlignment = System . Windows . HorizontalAlignment . Stretch ,
448
449
ToolTip = attribute . Description
449
450
} ;
450
451
textBox . TextChanged += ( _ , _ ) =>
@@ -461,6 +462,41 @@ public Control CreateSettingPanel()
461
462
Grid . SetColumnSpan ( sep , 2 ) ;
462
463
break ;
463
464
}
465
+ case "inputWithFileBtn" :
466
+ {
467
+ var textBox = new TextBox ( )
468
+ {
469
+ Margin = new Thickness ( 10 , 0 , 0 , 0 ) ,
470
+ Text = Settings [ attribute . Name ] as string ?? string . Empty ,
471
+ HorizontalAlignment = System . Windows . HorizontalAlignment . Stretch ,
472
+ ToolTip = attribute . Description
473
+ } ;
474
+ textBox . TextChanged += ( _ , _ ) =>
475
+ {
476
+ Settings [ attribute . Name ] = textBox . Text ;
477
+ } ;
478
+ var Btn = new System . Windows . Controls . Button ( )
479
+ {
480
+ Margin = new Thickness ( 10 , 0 , 0 , 0 ) ,
481
+ Content = "Browse"
482
+ } ;
483
+ var dockPanel = new DockPanel ( )
484
+ {
485
+ Margin = settingControlMargin
486
+ } ;
487
+ DockPanel . SetDock ( Btn , Dock . Right ) ;
488
+ dockPanel . Children . Add ( Btn ) ;
489
+ dockPanel . Children . Add ( textBox ) ;
490
+ contentControl = dockPanel ;
491
+ Grid . SetColumn ( contentControl , 1 ) ;
492
+ Grid . SetRow ( contentControl , rowCount ) ;
493
+ if ( rowCount != 0 )
494
+ mainPanel . Children . Add ( sep ) ;
495
+ Grid . SetRow ( sep , rowCount ) ;
496
+ Grid . SetColumn ( sep , 0 ) ;
497
+ Grid . SetColumnSpan ( sep , 2 ) ;
498
+ break ;
499
+ }
464
500
case "textarea" :
465
501
{
466
502
var textBox = new TextBox ( )
@@ -470,7 +506,7 @@ public Control CreateSettingPanel()
470
506
VerticalAlignment = VerticalAlignment . Center ,
471
507
TextWrapping = TextWrapping . WrapWithOverflow ,
472
508
AcceptsReturn = true ,
473
- HorizontalAlignment = HorizontalAlignment . Stretch ,
509
+ HorizontalAlignment = System . Windows . HorizontalAlignment . Stretch ,
474
510
Text = Settings [ attribute . Name ] as string ?? string . Empty ,
475
511
ToolTip = attribute . Description
476
512
} ;
@@ -495,7 +531,7 @@ public Control CreateSettingPanel()
495
531
Margin = settingControlMargin ,
496
532
Password = Settings [ attribute . Name ] as string ?? string . Empty ,
497
533
PasswordChar = attribute . passwordChar == default ? '*' : attribute . passwordChar ,
498
- HorizontalAlignment = HorizontalAlignment . Stretch ,
534
+ HorizontalAlignment = System . Windows . HorizontalAlignment . Stretch ,
499
535
ToolTip = attribute . Description
500
536
} ;
501
537
passwordBox . PasswordChanged += ( sender , _ ) =>
@@ -514,17 +550,17 @@ public Control CreateSettingPanel()
514
550
}
515
551
case "dropdown" :
516
552
{
517
- var comboBox = new ComboBox ( )
553
+ var comboBox = new System . Windows . Controls . ComboBox ( )
518
554
{
519
555
ItemsSource = attribute . Options ,
520
556
SelectedItem = Settings [ attribute . Name ] ,
521
557
Margin = settingControlMargin ,
522
- HorizontalAlignment = HorizontalAlignment . Right ,
558
+ HorizontalAlignment = System . Windows . HorizontalAlignment . Right ,
523
559
ToolTip = attribute . Description
524
560
} ;
525
561
comboBox . SelectionChanged += ( sender , _ ) =>
526
562
{
527
- Settings [ attribute . Name ] = ( string ) ( ( ComboBox ) sender ) . SelectedItem ;
563
+ Settings [ attribute . Name ] = ( string ) ( ( System . Windows . Controls . ComboBox ) sender ) . SelectedItem ;
528
564
} ;
529
565
contentControl = comboBox ;
530
566
Grid . SetColumn ( contentControl , 1 ) ;
@@ -541,7 +577,7 @@ public Control CreateSettingPanel()
541
577
{
542
578
IsChecked = Settings [ attribute . Name ] is bool isChecked ? isChecked : bool . Parse ( attribute . DefaultValue ) ,
543
579
Margin = settingCheckboxMargin ,
544
- HorizontalAlignment = HorizontalAlignment . Right ,
580
+ HorizontalAlignment = System . Windows . HorizontalAlignment . Right ,
545
581
ToolTip = attribute . Description
546
582
} ;
547
583
checkBox . Click += ( sender , _ ) =>
@@ -563,9 +599,9 @@ public Control CreateSettingPanel()
563
599
ToolTip = attribute . Description ,
564
600
NavigateUri = attribute . url
565
601
} ;
566
- var linkbtn = new Button
602
+ var linkbtn = new System . Windows . Controls . Button
567
603
{
568
- HorizontalAlignment = HorizontalAlignment . Right ,
604
+ HorizontalAlignment = System . Windows . HorizontalAlignment . Right ,
569
605
Margin = settingControlMargin
570
606
} ;
571
607
linkbtn . Content = attribute . urlLabel ;
@@ -623,7 +659,7 @@ public void UpdateSettings(Dictionary<string, object> settings)
623
659
case PasswordBox passwordBox :
624
660
passwordBox . Dispatcher . Invoke ( ( ) => passwordBox . Password = value as string ) ;
625
661
break ;
626
- case ComboBox comboBox :
662
+ case System . Windows . Controls . ComboBox comboBox :
627
663
comboBox . Dispatcher . Invoke ( ( ) => comboBox . SelectedItem = value ) ;
628
664
break ;
629
665
case CheckBox checkBox :
0 commit comments