From 6354d4b911735ed1295a807670c81f96539d099f Mon Sep 17 00:00:00 2001 From: jhdxr Date: Thu, 19 May 2016 23:49:03 +0800 Subject: [PATCH] move disabled plugins to the bottom of the list --- Wox/SettingWindow.xaml.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs index 909667ba1b..1e23b8fb0a 100644 --- a/Wox/SettingWindow.xaml.cs +++ b/Wox/SettingWindow.xaml.cs @@ -744,14 +744,22 @@ namespace Wox private void OnPluginTabSelected() { - var plugins = new CompositeCollection + var plugins = PluginManager.AllPlugins; + //move all disabled to bottom + plugins.Sort(delegate (PluginPair a, PluginPair b) + { + int res = _settings.PluginSettings.Plugins[a.Metadata.ID].Disabled ? 1 : 0; + res += _settings.PluginSettings.Plugins[b.Metadata.ID].Disabled ? -1 : 0; + return res; + }); + + PluginsListBox.ItemsSource = new CompositeCollection { new CollectionContainer { - Collection = PluginManager.AllPlugins + Collection = plugins } - }; - PluginsListBox.ItemsSource = plugins; + }; ; PluginsListBox.SelectedIndex = 0; }