Added Control Panel

This commit is contained in:
CoenraadS
2014-07-17 17:14:58 +02:00
parent b8e034e33c
commit 1d5f72f9ab
4 changed files with 95 additions and 0 deletions

View File

@@ -0,0 +1,87 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Wox.Infrastructure;
using Wox.Infrastructure.Storage.UserSettings;
using WindowsControlPanelItems;
using System.Diagnostics;
using System.IO;
namespace Wox.Plugin.SystemPlugins.ControlPanel
{
public class ControlPanel : BaseSystemPlugin
{
#region Properties
private PluginInitContext context;
public override string Description
{
get
{
return "Search within the Control Panel.";
}
}
public override string ID
{
get { return "209621585B9B4D81813913C507C058C6"; }
}
public override string Name { get { return "Control Panel"; } }
public override string IcoPath { get { return @"Images\ControlPanel.png"; } }
private List<ControlPanelItem> controlPanelItems;
private string iconFolder;
#endregion Properties
protected override void InitInternal(PluginInitContext context)
{
this.context = context;
controlPanelItems = WindowsControlPanelItems.List.Create(48);
iconFolder = @"Images\ControlPanelIcons\";
foreach (ControlPanelItem item in controlPanelItems)
{
if (!File.Exists(iconFolder + item.ApplicationName + ".ico"))
{
item.Icon.ToBitmap().Save(iconFolder + item.ApplicationName + ".ico"); //Wierd hack to not lose quality when saving as .ico
}
}
}
protected override List<Result> QueryInternal(Query query)
{
List<Result> results = new List<Result>();
foreach (var item in controlPanelItems)
{
if (item.LocalizedString.IndexOf(query.RawQuery, StringComparison.OrdinalIgnoreCase) >= 0 || item.InfoTip.IndexOf(query.RawQuery, StringComparison.OrdinalIgnoreCase) >= 0)
{
results.Add(new Result()
{
Title = item.LocalizedString,
SubTitle = item.InfoTip,
IcoPath = "Images\\ControlPanelIcons\\" + item.ApplicationName + ".ico", //Relative path to plugin directory
Action = e =>
{
try
{
Process.Start(item.ExecutablePath);
}
catch (Exception)
{
//Silently Fail for now..
}
return true;
}
});
}
}
return results;
}
}
}

View File

@@ -41,6 +41,9 @@
<Reference Include="PresentationCore" /> <Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" /> <Reference Include="PresentationFramework" />
<Reference Include="WindowsBase" /> <Reference Include="WindowsBase" />
<Reference Include="WindowsControlPanelItems">
<HintPath>..\packages\WindowsControlPanelItems.dll.1.0.0\lib\net35\WindowsControlPanelItems.dll</HintPath>
</Reference>
<Reference Include="YAMP"> <Reference Include="YAMP">
<HintPath>..\packages\YAMP.1.3.0\lib\net35\YAMP.dll</HintPath> <HintPath>..\packages\YAMP.1.3.0\lib\net35\YAMP.dll</HintPath>
</Reference> </Reference>
@@ -59,6 +62,7 @@
</Compile> </Compile>
<Compile Include="CMD\CMDStorage.cs" /> <Compile Include="CMD\CMDStorage.cs" />
<Compile Include="ColorsPlugin.cs" /> <Compile Include="ColorsPlugin.cs" />
<Compile Include="ControlPanel\ControlPanel.cs" />
<Compile Include="Folder\FolderPluginSettings.xaml.cs"> <Compile Include="Folder\FolderPluginSettings.xaml.cs">
<DependentUpon>FolderPluginSettings.xaml</DependentUpon> <DependentUpon>FolderPluginSettings.xaml</DependentUpon>
</Compile> </Compile>
@@ -130,6 +134,9 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>
<PostBuildEvent> <PostBuildEvent>

View File

@@ -2,5 +2,6 @@
<packages> <packages>
<package id="ini-parser" version="2.0.2" targetFramework="net35" /> <package id="ini-parser" version="2.0.2" targetFramework="net35" />
<package id="Newtonsoft.Json" version="5.0.8" targetFramework="net35" /> <package id="Newtonsoft.Json" version="5.0.8" targetFramework="net35" />
<package id="WindowsControlPanelItems.dll" version="1.0.0" targetFramework="net35" />
<package id="YAMP" version="1.3.0" targetFramework="net35" /> <package id="YAMP" version="1.3.0" targetFramework="net35" />
</packages> </packages>

BIN
Wox/Images/ControlPanel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB