mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 12:18:50 +02:00
Added Enabled & PluginId to BaseSystemPlugin
We still need a way to save the Enabled property
This commit is contained in:
@@ -7,18 +7,30 @@ namespace Wox.Plugin.SystemPlugins {
|
|||||||
public virtual string Name { get { return "System workflow"; } }
|
public virtual string Name { get { return "System workflow"; } }
|
||||||
public virtual string Description { get { return "System workflow"; } }
|
public virtual string Description { get { return "System workflow"; } }
|
||||||
public virtual string IcoPath { get { return null; } }
|
public virtual string IcoPath { get { return null; } }
|
||||||
|
public virtual bool Enabled { get; set; }
|
||||||
|
|
||||||
protected abstract List<Result> QueryInternal(Query query);
|
protected abstract List<Result> QueryInternal(Query query);
|
||||||
|
|
||||||
protected abstract void InitInternal(PluginInitContext context);
|
protected abstract void InitInternal(PluginInitContext context);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public List<Result> Query(Query query) {
|
public List<Result> Query(Query query) {
|
||||||
if (string.IsNullOrEmpty(query.RawQuery)) return new List<Result>();
|
if (Enabled) {
|
||||||
return QueryInternal(query);
|
if (string.IsNullOrEmpty(query.RawQuery)) return new List<Result>();
|
||||||
|
return QueryInternal(query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Init(PluginInitContext context) {
|
public void Init(PluginInitContext context) {
|
||||||
InitInternal(context);
|
InitInternal(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used to save settings
|
||||||
|
/// </summary>
|
||||||
|
public virtual string PluginId {
|
||||||
|
get { return null; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,11 +3,9 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Wox.Plugin.SystemPlugins
|
namespace Wox.Plugin.SystemPlugins {
|
||||||
{
|
public interface ISystemPlugin : IPlugin {
|
||||||
public interface ISystemPlugin : IPlugin
|
string Name { get; }
|
||||||
{
|
string Description { get; }
|
||||||
string Name { get; }
|
}
|
||||||
string Description { get; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Wox.Plugin
|
namespace Wox.Plugin {
|
||||||
{
|
public interface IPlugin {
|
||||||
public interface IPlugin
|
List<Result> Query(Query query);
|
||||||
{
|
void Init(PluginInitContext context);
|
||||||
List<Result> Query(Query query);
|
|
||||||
void Init(PluginInitContext context);
|
/// <summary>
|
||||||
}
|
/// Used when saving Plug-in settings
|
||||||
|
/// </summary>
|
||||||
|
string PluginId { get; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
<TextBlock VerticalAlignment="Center" ToolTip="{Binding Name}" x:Name="tbTitle" Text="{Binding Name}"></TextBlock>
|
<TextBlock VerticalAlignment="Center" ToolTip="{Binding Name}" x:Name="tbTitle" Text="{Binding Name}"></TextBlock>
|
||||||
<TextBlock ToolTip="{Binding Description}" Visibility="{Binding Description, Converter={converters:StringNullOrEmptyToVisibilityConverter}}" Grid.Row="1" x:Name="tbSubTitle" Text="{Binding Description}" Opacity="0.5"></TextBlock>
|
<TextBlock ToolTip="{Binding Description}" Visibility="{Binding Description, Converter={converters:StringNullOrEmptyToVisibilityConverter}}" Grid.Row="1" x:Name="tbSubTitle" Text="{Binding Description}" Opacity="0.5"></TextBlock>
|
||||||
</Grid>
|
</Grid>
|
||||||
<CheckBox Content="Enabled" />
|
<CheckBox Content="Enabled" IsChecked="{Binding Enabled}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
<DataTemplate DataType="{x:Type woxPlugin:PluginPair}">
|
<DataTemplate DataType="{x:Type woxPlugin:PluginPair}">
|
||||||
|
|||||||
Reference in New Issue
Block a user