Skip to content

Commit 6614771

Browse files
committed
Move initialization to constructor
1 parent 569cb8b commit 6614771

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@
108108
Expanded="Expander_Expanded"
109109
Header="{DynamicResource plugin_explorer_generalsetting_header}"
110110
IsExpanded="False"
111-
Loaded="GeneralSettingsExpander_Loaded"
112111
Style="{StaticResource CustomExpanderStyle}">
113112

114113
<!-- Margin="32 -10 0 0" is to make sure elements is left aligned to the text in the expander text -->

Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
1515
public partial class ExplorerSettings
1616
{
1717
private readonly SettingsViewModel _viewModel;
18-
private readonly List<Expander> _expanders = new();
18+
private readonly List<Expander> _expanders;
1919

2020
public ExplorerSettings(SettingsViewModel viewModel)
2121
{
@@ -27,6 +27,17 @@ public ExplorerSettings(SettingsViewModel viewModel)
2727
DataContext = viewModel;
2828

2929
ActionKeywordModel.Init(viewModel.Settings);
30+
31+
_expanders = new List<Expander>
32+
{
33+
GeneralSettingsExpander,
34+
ContextMenuExpander,
35+
PreviewPanelExpander,
36+
EverythingExpander,
37+
ActionKeywordsExpander,
38+
QuickAccessExpander,
39+
ExcludedPathsExpander
40+
};
3041
}
3142

3243
private void AccessLinkDragDrop(string containerName, DragEventArgs e)
@@ -114,20 +125,5 @@ private void lbxExcludedPaths_Loaded(object sender, RoutedEventArgs e)
114125
{
115126
lbxExcludedPaths.Items.SortDescriptions.Add(new SortDescription("Path", ListSortDirection.Ascending));
116127
}
117-
118-
private void GeneralSettingsExpander_Loaded(object sender, RoutedEventArgs e)
119-
{
120-
var expanders = new List<Expander>
121-
{
122-
GeneralSettingsExpander,
123-
ContextMenuExpander,
124-
PreviewPanelExpander,
125-
EverythingExpander,
126-
ActionKeywordsExpander,
127-
QuickAccessExpander,
128-
ExcludedPathsExpander
129-
};
130-
_expanders.AddRange(expanders);
131-
}
132128
}
133129
}

0 commit comments

Comments
 (0)