mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Added Control Panel
This commit is contained in:
parent
b8e034e33c
commit
1d5f72f9ab
4 changed files with 95 additions and 0 deletions
87
Wox.Plugin.SystemPlugins/ControlPanel/ControlPanel.cs
Normal file
87
Wox.Plugin.SystemPlugins/ControlPanel/ControlPanel.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -41,6 +41,9 @@
|
|||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="WindowsControlPanelItems">
|
||||
<HintPath>..\packages\WindowsControlPanelItems.dll.1.0.0\lib\net35\WindowsControlPanelItems.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="YAMP">
|
||||
<HintPath>..\packages\YAMP.1.3.0\lib\net35\YAMP.dll</HintPath>
|
||||
</Reference>
|
||||
|
|
@ -59,6 +62,7 @@
|
|||
</Compile>
|
||||
<Compile Include="CMD\CMDStorage.cs" />
|
||||
<Compile Include="ColorsPlugin.cs" />
|
||||
<Compile Include="ControlPanel\ControlPanel.cs" />
|
||||
<Compile Include="Folder\FolderPluginSettings.xaml.cs">
|
||||
<DependentUpon>FolderPluginSettings.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
|
@ -130,6 +134,9 @@
|
|||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
|
|
|
|||
|
|
@ -2,5 +2,6 @@
|
|||
<packages>
|
||||
<package id="ini-parser" version="2.0.2" 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" />
|
||||
</packages>
|
||||
BIN
Wox/Images/ControlPanel.png
Normal file
BIN
Wox/Images/ControlPanel.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
Loading…
Reference in a new issue