Move initialization to constructor

This commit is contained in:
Jack251970 2025-06-06 17:03:20 +08:00
parent 569cb8bd44
commit 6614771c3d
2 changed files with 12 additions and 17 deletions

View file

@ -108,7 +108,6 @@
Expanded="Expander_Expanded"
Header="{DynamicResource plugin_explorer_generalsetting_header}"
IsExpanded="False"
Loaded="GeneralSettingsExpander_Loaded"
Style="{StaticResource CustomExpanderStyle}">
<!-- Margin="32 -10 0 0" is to make sure elements is left aligned to the text in the expander text -->

View file

@ -15,7 +15,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
public partial class ExplorerSettings
{
private readonly SettingsViewModel _viewModel;
private readonly List<Expander> _expanders = new();
private readonly List<Expander> _expanders;
public ExplorerSettings(SettingsViewModel viewModel)
{
@ -27,6 +27,17 @@ namespace Flow.Launcher.Plugin.Explorer.Views
DataContext = viewModel;
ActionKeywordModel.Init(viewModel.Settings);
_expanders = new List<Expander>
{
GeneralSettingsExpander,
ContextMenuExpander,
PreviewPanelExpander,
EverythingExpander,
ActionKeywordsExpander,
QuickAccessExpander,
ExcludedPathsExpander
};
}
private void AccessLinkDragDrop(string containerName, DragEventArgs e)
@ -114,20 +125,5 @@ namespace Flow.Launcher.Plugin.Explorer.Views
{
lbxExcludedPaths.Items.SortDescriptions.Add(new SortDescription("Path", ListSortDirection.Ascending));
}
private void GeneralSettingsExpander_Loaded(object sender, RoutedEventArgs e)
{
var expanders = new List<Expander>
{
GeneralSettingsExpander,
ContextMenuExpander,
PreviewPanelExpander,
EverythingExpander,
ActionKeywordsExpander,
QuickAccessExpander,
ExcludedPathsExpander
};
_expanders.AddRange(expanders);
}
}
}