@@ -7,17 +7,23 @@ namespace Flow.Launcher.Plugin.Program
7
7
public partial class ProgramSuffixes
8
8
{
9
9
private PluginInitContext context ;
10
- public Settings _settings ;
11
- public Dictionary < string , bool > SuffixesStatus => _settings . BuiltinSuffixesStatus ;
12
- public Dictionary < string , bool > ProtocolsStatus => _settings . BuiltinProtocolsStatus ;
10
+ private Settings _settings ;
11
+ public Dictionary < string , bool > SuffixesStatus { get ; set ; }
12
+ public Dictionary < string , bool > ProtocolsStatus { get ; set ; }
13
+ public bool UseCustomSuffixes { get ; set ; }
14
+ public bool UseCustomProtocols { get ; set ; }
13
15
14
16
public ProgramSuffixes ( PluginInitContext context , Settings settings )
15
17
{
16
18
this . context = context ;
17
19
_settings = settings ;
20
+ SuffixesStatus = new Dictionary < string , bool > ( _settings . BuiltinSuffixesStatus ) ;
21
+ ProtocolsStatus = new Dictionary < string , bool > ( _settings . BuiltinProtocolsStatus ) ;
22
+ UseCustomSuffixes = _settings . UseCustomSuffixes ;
23
+ UseCustomProtocols = _settings . UseCustomProtocols ;
18
24
InitializeComponent ( ) ;
19
- tbSuffixes . Text = string . Join ( Settings . SuffixSeperator , _settings . CustomSuffixes ) ;
20
- tbProtocols . Text = string . Join ( Settings . SuffixSeperator , _settings . CustomProtocols ) ;
25
+ tbSuffixes . Text = string . Join ( Settings . SuffixSeparator , _settings . CustomSuffixes ) ;
26
+ tbProtocols . Text = string . Join ( Settings . SuffixSeparator , _settings . CustomProtocols ) ;
21
27
}
22
28
23
29
private void BtnCancel_OnClick ( object sender , RoutedEventArgs e )
@@ -27,17 +33,17 @@ private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
27
33
28
34
private void BtnAdd_OnClick ( object sender , RoutedEventArgs e )
29
35
{
30
- var suffixes = tbSuffixes . Text . Split ( Settings . SuffixSeperator , StringSplitOptions . RemoveEmptyEntries ) ;
31
- var protocols = tbProtocols . Text . Split ( Settings . SuffixSeperator , StringSplitOptions . RemoveEmptyEntries ) ;
36
+ var suffixes = tbSuffixes . Text . Split ( Settings . SuffixSeparator , StringSplitOptions . RemoveEmptyEntries ) ;
37
+ var protocols = tbProtocols . Text . Split ( Settings . SuffixSeparator , StringSplitOptions . RemoveEmptyEntries ) ;
32
38
33
- if ( suffixes . Length == 0 && _settings . UseCustomSuffixes )
39
+ if ( suffixes . Length == 0 && UseCustomSuffixes )
34
40
{
35
41
string warning = context . API . GetTranslation ( "flowlauncher_plugin_program_suffixes_cannot_empty" ) ;
36
42
MessageBox . Show ( warning ) ;
37
43
return ;
38
44
}
39
45
40
- if ( protocols . Length == 0 && _settings . UseCustomProtocols )
46
+ if ( protocols . Length == 0 && UseCustomProtocols )
41
47
{
42
48
string warning = context . API . GetTranslation ( "flowlauncher_plugin_protocols_cannot_empty" ) ;
43
49
MessageBox . Show ( warning ) ;
@@ -46,6 +52,10 @@ private void BtnAdd_OnClick(object sender, RoutedEventArgs e)
46
52
47
53
_settings . CustomSuffixes = suffixes ;
48
54
_settings . CustomProtocols = protocols ;
55
+ _settings . BuiltinSuffixesStatus = new Dictionary < string , bool > ( SuffixesStatus ) ;
56
+ _settings . BuiltinProtocolsStatus = new Dictionary < string , bool > ( ProtocolsStatus ) ;
57
+ _settings . UseCustomSuffixes = UseCustomSuffixes ;
58
+ _settings . UseCustomProtocols = UseCustomProtocols ;
49
59
50
60
DialogResult = true ;
51
61
}
0 commit comments