mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
@@ -14,7 +14,7 @@
|
||||
<ListBoxItem HorizontalContentAlignment="Stretch"
|
||||
IsEnabled="False"
|
||||
IsHitTestVisible="False" x:Key="FeatureBoxSeperator">
|
||||
<Separator Width="{Binding ElementName=lbPlugins, Path=ActualWidth}" />
|
||||
<Separator Width="{Binding ElementName=PluginsListBox, Path=ActualWidth}" />
|
||||
</ListBoxItem>
|
||||
<image:ImagePathConverter x:Key="ImageConverter" />
|
||||
</Window.Resources>
|
||||
@@ -62,7 +62,7 @@
|
||||
<TextBlock DockPanel.Dock="Top" Margin="10" HorizontalAlignment="Left" Cursor="Hand"
|
||||
MouseUp="tbMorePlugins_MouseUp" x:Name="tbMorePlugins" Foreground="Blue"
|
||||
Text="{DynamicResource browserMorePlugins}" />
|
||||
<ListBox x:Name="lbPlugins" Margin="10, 0, 10, 10" SelectionChanged="lbPlugins_OnSelectionChanged"
|
||||
<ListBox x:Name="PluginsListBox" Margin="10, 0, 10, 10" SelectionChanged="lbPlugins_OnSelectionChanged"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled" Grid.IsSharedSizeScope="True">
|
||||
<ListBox.Resources>
|
||||
@@ -119,7 +119,7 @@
|
||||
<TextBlock Grid.Row="1" x:Name="pluginSubTitle" Opacity="0.5"
|
||||
ToolTip="{Binding Source=pluginSubTitle, Path=Text}"/>
|
||||
<DockPanel Grid.Row="2" Margin="0 10 0 8">
|
||||
<CheckBox x:Name="cbDisablePlugin" Click="CbDisablePlugin_OnClick">
|
||||
<CheckBox x:Name="cbDisablePlugin" Click="OnDisablePluginClicked">
|
||||
<TextBlock Text="{DynamicResource disable}" />
|
||||
</CheckBox>
|
||||
<TextBlock x:Name="pluginActionKeywordsTitle" Margin="20 0 0 0"
|
||||
|
||||
@@ -21,6 +21,7 @@ using Wox.Core.UserSettings;
|
||||
using Wox.Helper;
|
||||
using Wox.Infrastructure.Hotkey;
|
||||
using Wox.Infrastructure.Image;
|
||||
using Wox.Infrastructure.Logger;
|
||||
using Wox.Plugin;
|
||||
using Wox.ViewModel;
|
||||
using Stopwatch = Wox.Infrastructure.Stopwatch;
|
||||
@@ -566,7 +567,7 @@ namespace Wox
|
||||
private void lbPlugins_OnSelectionChanged(object sender, SelectionChangedEventArgs _)
|
||||
{
|
||||
|
||||
var pair = lbPlugins.SelectedItem as PluginPair;
|
||||
var pair = PluginsListBox.SelectedItem as PluginPair;
|
||||
string pluginId = string.Empty;
|
||||
List<string> actionKeywords = null;
|
||||
if (pair == null) return;
|
||||
@@ -631,24 +632,19 @@ namespace Wox
|
||||
}
|
||||
}
|
||||
|
||||
private void CbDisablePlugin_OnClick(object sender, RoutedEventArgs e)
|
||||
private void OnDisablePluginClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CheckBox cbDisabled = e.Source as CheckBox;
|
||||
if (cbDisabled == null) return;
|
||||
|
||||
var pair = lbPlugins.SelectedItem as PluginPair;
|
||||
if (pair != null)
|
||||
var checkBox = (CheckBox)e.Source;
|
||||
var pair = (PluginPair)PluginsListBox.SelectedItem;
|
||||
var id = pair.Metadata.ID;
|
||||
if (checkBox.IsChecked != null)
|
||||
{
|
||||
var id = pair.Metadata.ID;
|
||||
var customizedPluginConfig = _settings.PluginSettings.Plugins[id];
|
||||
if (customizedPluginConfig.Disabled)
|
||||
{
|
||||
PluginManager.DisablePlugin(pair);
|
||||
}
|
||||
else
|
||||
{
|
||||
PluginManager.EnablePlugin(pair);
|
||||
}
|
||||
var disabled = (bool) checkBox.IsChecked;
|
||||
_settings.PluginSettings.Plugins[id].Disabled = disabled;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Warn($"IsChecked for checkbox is null for plugin: {pair.Metadata.Name}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -656,7 +652,7 @@ namespace Wox
|
||||
{
|
||||
if (e.ChangedButton == MouseButton.Left)
|
||||
{
|
||||
var pair = lbPlugins.SelectedItem as PluginPair;
|
||||
var pair = PluginsListBox.SelectedItem as PluginPair;
|
||||
if (pair != null)
|
||||
{
|
||||
//third-party plugin
|
||||
@@ -675,7 +671,7 @@ namespace Wox
|
||||
{
|
||||
if (e.ChangedButton == MouseButton.Left)
|
||||
{
|
||||
var pair = lbPlugins.SelectedItem as PluginPair;
|
||||
var pair = PluginsListBox.SelectedItem as PluginPair;
|
||||
if (pair != null)
|
||||
{
|
||||
//third-party plugin
|
||||
@@ -697,7 +693,7 @@ namespace Wox
|
||||
{
|
||||
if (e.ChangedButton == MouseButton.Left)
|
||||
{
|
||||
var pair = lbPlugins.SelectedItem as PluginPair;
|
||||
var pair = PluginsListBox.SelectedItem as PluginPair;
|
||||
if (pair != null)
|
||||
{
|
||||
//third-party plugin
|
||||
@@ -729,8 +725,8 @@ namespace Wox
|
||||
Collection = PluginManager.AllPlugins
|
||||
}
|
||||
};
|
||||
lbPlugins.ItemsSource = plugins;
|
||||
lbPlugins.SelectedIndex = 0;
|
||||
PluginsListBox.ItemsSource = plugins;
|
||||
PluginsListBox.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user