mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 11:46:30 +02:00
add v2ex workflow
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using Microsoft.VisualBasic.ApplicationServices;
|
||||
using WinAlfred.Commands;
|
||||
using StartupEventArgs = System.Windows.StartupEventArgs;
|
||||
|
||||
namespace WinAlfred
|
||||
@@ -57,12 +58,14 @@ namespace WinAlfred
|
||||
base.OnStartup(e);
|
||||
|
||||
window = new MainWindow();
|
||||
window.ShowApp(e.Args);
|
||||
window.ShowApp();
|
||||
window.ParseArgs(e.Args);
|
||||
}
|
||||
|
||||
public void Activate(string[] commandLine)
|
||||
public void Activate(string[] args)
|
||||
{
|
||||
window.ShowApp(commandLine);
|
||||
window.ShowApp();
|
||||
window.ParseArgs(args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,9 +59,9 @@ namespace WinAlfred
|
||||
private void InitialTray()
|
||||
{
|
||||
notifyIcon = new NotifyIcon { Text = "WinAlfred", Icon = Properties.Resources.app, Visible = true };
|
||||
notifyIcon.Click += (o, e) => ShowWinAlfred(null);
|
||||
notifyIcon.Click += (o, e) => ShowWinAlfred();
|
||||
System.Windows.Forms.MenuItem open = new System.Windows.Forms.MenuItem("Open");
|
||||
open.Click += (o, e) => ShowWinAlfred(null);
|
||||
open.Click += (o, e) => ShowWinAlfred();
|
||||
System.Windows.Forms.MenuItem exit = new System.Windows.Forms.MenuItem("Exit");
|
||||
exit.Click += (o, e) => CloseApp();
|
||||
System.Windows.Forms.MenuItem[] childen = { open, exit };
|
||||
@@ -78,7 +78,7 @@ namespace WinAlfred
|
||||
{
|
||||
if (!IsVisible)
|
||||
{
|
||||
ShowWinAlfred(null);
|
||||
ShowWinAlfred();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -132,7 +132,15 @@ namespace WinAlfred
|
||||
Hide();
|
||||
}
|
||||
|
||||
private void ShowWinAlfred(string[] args)
|
||||
private void ShowWinAlfred()
|
||||
{
|
||||
Show();
|
||||
Activate();
|
||||
tbQuery.Focus();
|
||||
tbQuery.SelectAll();
|
||||
}
|
||||
|
||||
public void ParseArgs(string[] args)
|
||||
{
|
||||
if (args != null && args.Length > 0)
|
||||
{
|
||||
@@ -147,15 +155,11 @@ namespace WinAlfred
|
||||
{
|
||||
string query = args[1];
|
||||
tbQuery.Text = query;
|
||||
tbQuery.SelectAll();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Show();
|
||||
Activate();
|
||||
tbQuery.Focus();
|
||||
tbQuery.SelectAll();
|
||||
}
|
||||
|
||||
private void SetAutoStart(bool IsAtuoRun)
|
||||
@@ -261,9 +265,9 @@ namespace WinAlfred
|
||||
HideWinAlfred();
|
||||
}
|
||||
|
||||
public void ShowApp(string[] args)
|
||||
public void ShowApp()
|
||||
{
|
||||
ShowWinAlfred(args);
|
||||
ShowWinAlfred();
|
||||
}
|
||||
|
||||
public void ShowMsg(string title, string subTitle, string iconPath)
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
using WinAlfred.Helper;
|
||||
using WinAlfred.Plugin;
|
||||
using WinAlfred.Plugin.System;
|
||||
@@ -11,7 +12,7 @@ namespace WinAlfred.PluginLoader
|
||||
{
|
||||
public abstract class BasePluginLoader
|
||||
{
|
||||
private static string PluginPath = "Plugins";
|
||||
private static string PluginPath = AppDomain.CurrentDomain.BaseDirectory + "Plugins";
|
||||
private static string PluginConfigName = "plugin.ini";
|
||||
protected static List<PluginMetadata> pluginMetadatas = new List<PluginMetadata>();
|
||||
public abstract List<PluginPair> LoadPlugin();
|
||||
@@ -70,8 +71,8 @@ namespace WinAlfred.PluginLoader
|
||||
metadata.Version = ini.GetSetting("plugin", "Version");
|
||||
metadata.PluginType = PluginType.ThirdParty;
|
||||
metadata.ActionKeyword = ini.GetSetting("plugin", "ActionKeyword");
|
||||
metadata.ExecuteFilePath = AppDomain.CurrentDomain.BaseDirectory + directory + "\\" + ini.GetSetting("plugin", "ExecuteFile");
|
||||
metadata.PluginDirecotry = AppDomain.CurrentDomain.BaseDirectory + directory + "\\";
|
||||
metadata.ExecuteFilePath = directory + "\\" + ini.GetSetting("plugin", "ExecuteFile");
|
||||
metadata.PluginDirecotry = directory + "\\";
|
||||
metadata.ExecuteFileName = ini.GetSetting("plugin", "ExecuteFile");
|
||||
|
||||
if (!AllowedLanguage.IsAllowed(metadata.Language))
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace WinAlfred.PluginLoader
|
||||
ChangeQuery = s => window.ChangeQuery(s),
|
||||
CloseApp = window.CloseApp,
|
||||
HideApp = window.HideApp,
|
||||
ShowApp = () => window.ShowApp(null),
|
||||
ShowApp = () => window.ShowApp(),
|
||||
ShowMsg = (title, subTitle, iconPath) => window.ShowMsg(title, subTitle, iconPath)
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -1,56 +1,56 @@
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// 有关程序集的常规信息通过以下
|
||||
// 特性集控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("WinAlfredWPF")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("WinAlfredWPF")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 使此程序集中的类型
|
||||
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
|
||||
// 则将该类型上的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//若要开始生成可本地化的应用程序,请在
|
||||
//<PropertyGroup> 中的 .csproj 文件中
|
||||
//设置 <UICulture>CultureYouAreCodingWith</UICulture>。例如,如果您在源文件中
|
||||
//使用的是美国英语,请将 <UICulture> 设置为 en-US。然后取消
|
||||
//对以下 NeutralResourceLanguage 特性的注释。更新
|
||||
//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //主题特定资源词典所处位置
|
||||
//(在页面或应用程序资源词典中
|
||||
// 未找到某个资源的情况下使用)
|
||||
ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
|
||||
//(在页面、应用程序或任何主题特定资源词典中
|
||||
// 未找到某个资源的情况下使用)
|
||||
)]
|
||||
|
||||
|
||||
// 程序集的版本信息由下面四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||
// 方法是按如下所示使用“*”:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// 有关程序集的常规信息通过以下
|
||||
// 特性集控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("WinAlfred")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("WinAlfred")]
|
||||
[assembly: AssemblyCopyright("Copyright © qianlifeng 2014")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 使此程序集中的类型
|
||||
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
|
||||
// 则将该类型上的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//若要开始生成可本地化的应用程序,请在
|
||||
//<PropertyGroup> 中的 .csproj 文件中
|
||||
//设置 <UICulture>CultureYouAreCodingWith</UICulture>。例如,如果您在源文件中
|
||||
//使用的是美国英语,请将 <UICulture> 设置为 en-US。然后取消
|
||||
//对以下 NeutralResourceLanguage 特性的注释。更新
|
||||
//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //主题特定资源词典所处位置
|
||||
//(在页面或应用程序资源词典中
|
||||
// 未找到某个资源的情况下使用)
|
||||
ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
|
||||
//(在页面、应用程序或任何主题特定资源词典中
|
||||
// 未找到某个资源的情况下使用)
|
||||
)]
|
||||
|
||||
|
||||
// 程序集的版本信息由下面四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||
// 方法是按如下所示使用“*”:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
|
||||
Reference in New Issue
Block a user