From 97b5526cc1e5373e024391199b9e6385e63eed38 Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Mon, 6 Jan 2014 21:25:24 +0800 Subject: [PATCH] fix program plugin doesn't work in XP issue. --- WinAlfred.2010.sln | 110 +++++++++++++ WinAlfred.Plugin.System/DirectoryIndicator.cs | 58 +++++++ WinAlfred.Plugin.System/Programs.cs | 12 +- .../WinAlfred.Plugin.System.csproj | 1 + WinAlfred/App.config | 2 +- WinAlfred/App.xaml | 1 - WinAlfred/Images/folder.png | Bin 0 -> 4260 bytes WinAlfred/MainWindow.xaml.cs | 6 + WinAlfred/Properties/Resources.Designer.cs | 146 +++++++++--------- WinAlfred/Properties/Settings.Designer.cs | 52 +++---- WinAlfred/ResultPanel.xaml.cs | 2 + WinAlfred/WinAlfred.csproj | 5 +- WinAlfred/packages.config | 4 +- 13 files changed, 291 insertions(+), 108 deletions(-) create mode 100644 WinAlfred.2010.sln create mode 100644 WinAlfred.Plugin.System/DirectoryIndicator.cs create mode 100644 WinAlfred/Images/folder.png diff --git a/WinAlfred.2010.sln b/WinAlfred.2010.sln new file mode 100644 index 0000000000..1fa6a84748 --- /dev/null +++ b/WinAlfred.2010.sln @@ -0,0 +1,110 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinAlfred.Test", "WinAlfred.Test\WinAlfred.Test.csproj", "{FF742965-9A80-41A5-B042-D6C7D3A21708}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinAlfred.Plugin", "WinAlfred.Plugin\WinAlfred.Plugin.csproj", "{8451ECDD-2EA4-4966-BB0A-7BBC40138E80}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugin", "Plugin", "{3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinAlfred", "WinAlfred\WinAlfred.csproj", "{DB90F671-D861-46BB-93A3-F1304F5BA1C5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinAlfred.Plugin.System", "WinAlfred.Plugin.System\WinAlfred.Plugin.System.csproj", "{69CE0206-CB41-453D-88AF-DF86092EF9B8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinAlfred.Plugin.Fanyi", "Plugins\WinAlfred.Plugin.Fanyi\WinAlfred.Plugin.Fanyi.csproj", "{353769D3-D11C-4D86-BD06-AC8C1D68642B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FF742965-9A80-41A5-B042-D6C7D3A21708}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FF742965-9A80-41A5-B042-D6C7D3A21708}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FF742965-9A80-41A5-B042-D6C7D3A21708}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {FF742965-9A80-41A5-B042-D6C7D3A21708}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {FF742965-9A80-41A5-B042-D6C7D3A21708}.Debug|Win32.ActiveCfg = Debug|Any CPU + {FF742965-9A80-41A5-B042-D6C7D3A21708}.Debug|x64.ActiveCfg = Debug|Any CPU + {FF742965-9A80-41A5-B042-D6C7D3A21708}.Debug|x86.ActiveCfg = Debug|Any CPU + {FF742965-9A80-41A5-B042-D6C7D3A21708}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FF742965-9A80-41A5-B042-D6C7D3A21708}.Release|Any CPU.Build.0 = Release|Any CPU + {FF742965-9A80-41A5-B042-D6C7D3A21708}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {FF742965-9A80-41A5-B042-D6C7D3A21708}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {FF742965-9A80-41A5-B042-D6C7D3A21708}.Release|Win32.ActiveCfg = Release|Any CPU + {FF742965-9A80-41A5-B042-D6C7D3A21708}.Release|x64.ActiveCfg = Release|Any CPU + {FF742965-9A80-41A5-B042-D6C7D3A21708}.Release|x86.ActiveCfg = Release|Any CPU + {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Debug|Win32.ActiveCfg = Debug|x86 + {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Debug|Win32.Build.0 = Debug|x86 + {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Debug|x64.ActiveCfg = Debug|Any CPU + {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Debug|x86.ActiveCfg = Debug|Any CPU + {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Debug|x86.Build.0 = Debug|Any CPU + {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Release|Any CPU.Build.0 = Release|Any CPU + {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Release|Win32.ActiveCfg = Release|x86 + {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Release|Win32.Build.0 = Release|x86 + {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Release|x64.ActiveCfg = Release|Any CPU + {8451ECDD-2EA4-4966-BB0A-7BBC40138E80}.Release|x86.ActiveCfg = Release|Any CPU + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Debug|Win32.ActiveCfg = Debug|Any CPU + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Debug|x64.ActiveCfg = Debug|Any CPU + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Debug|x86.ActiveCfg = Debug|Any CPU + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Release|Any CPU.Build.0 = Release|Any CPU + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Release|Win32.ActiveCfg = Release|Any CPU + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Release|x64.ActiveCfg = Release|Any CPU + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Release|x86.ActiveCfg = Release|Any CPU + {69CE0206-CB41-453D-88AF-DF86092EF9B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {69CE0206-CB41-453D-88AF-DF86092EF9B8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {69CE0206-CB41-453D-88AF-DF86092EF9B8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {69CE0206-CB41-453D-88AF-DF86092EF9B8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {69CE0206-CB41-453D-88AF-DF86092EF9B8}.Debug|Win32.ActiveCfg = Debug|Any CPU + {69CE0206-CB41-453D-88AF-DF86092EF9B8}.Debug|x64.ActiveCfg = Debug|Any CPU + {69CE0206-CB41-453D-88AF-DF86092EF9B8}.Debug|x86.ActiveCfg = Debug|Any CPU + {69CE0206-CB41-453D-88AF-DF86092EF9B8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {69CE0206-CB41-453D-88AF-DF86092EF9B8}.Release|Any CPU.Build.0 = Release|Any CPU + {69CE0206-CB41-453D-88AF-DF86092EF9B8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {69CE0206-CB41-453D-88AF-DF86092EF9B8}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {69CE0206-CB41-453D-88AF-DF86092EF9B8}.Release|Win32.ActiveCfg = Release|Any CPU + {69CE0206-CB41-453D-88AF-DF86092EF9B8}.Release|x64.ActiveCfg = Release|Any CPU + {69CE0206-CB41-453D-88AF-DF86092EF9B8}.Release|x86.ActiveCfg = Release|Any CPU + {353769D3-D11C-4D86-BD06-AC8C1D68642B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {353769D3-D11C-4D86-BD06-AC8C1D68642B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {353769D3-D11C-4D86-BD06-AC8C1D68642B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {353769D3-D11C-4D86-BD06-AC8C1D68642B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {353769D3-D11C-4D86-BD06-AC8C1D68642B}.Debug|Win32.ActiveCfg = Debug|Any CPU + {353769D3-D11C-4D86-BD06-AC8C1D68642B}.Debug|x64.ActiveCfg = Debug|Any CPU + {353769D3-D11C-4D86-BD06-AC8C1D68642B}.Debug|x86.ActiveCfg = Debug|Any CPU + {353769D3-D11C-4D86-BD06-AC8C1D68642B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {353769D3-D11C-4D86-BD06-AC8C1D68642B}.Release|Any CPU.Build.0 = Release|Any CPU + {353769D3-D11C-4D86-BD06-AC8C1D68642B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {353769D3-D11C-4D86-BD06-AC8C1D68642B}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {353769D3-D11C-4D86-BD06-AC8C1D68642B}.Release|Win32.ActiveCfg = Release|Any CPU + {353769D3-D11C-4D86-BD06-AC8C1D68642B}.Release|x64.ActiveCfg = Release|Any CPU + {353769D3-D11C-4D86-BD06-AC8C1D68642B}.Release|x86.ActiveCfg = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {353769D3-D11C-4D86-BD06-AC8C1D68642B} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87} + EndGlobalSection +EndGlobal diff --git a/WinAlfred.Plugin.System/DirectoryIndicator.cs b/WinAlfred.Plugin.System/DirectoryIndicator.cs new file mode 100644 index 0000000000..79e4ae3f03 --- /dev/null +++ b/WinAlfred.Plugin.System/DirectoryIndicator.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; + +namespace WinAlfred.Plugin.System +{ + public class DirectoryIndicator : ISystemPlugin + { + public List Query(Query query) + { + List results = new List(); + if (string.IsNullOrEmpty(query.RawQuery)) return results; + + if (CheckIfDirectory(query.RawQuery)) + { + Result result = new Result + { + Title = "Open this directory", + SubTitle = string.Format("path: {0}", query.RawQuery), + Score = 50, + IcoPath = "Images/folder.png", + Action = () => Process.Start(query.RawQuery) + }; + results.Add(result); + } + + return results; + } + + private bool CheckIfDirectory(string path) + { + return Directory.Exists(path); + } + + public void Init(PluginInitContext context) + { + } + + public string Name + { + get + { + return "DirectoryIndicator"; + } + } + + public string Description + { + get + { + return "DirectoryIndicator"; + } + } + } +} diff --git a/WinAlfred.Plugin.System/Programs.cs b/WinAlfred.Plugin.System/Programs.cs index 556932af07..7a2d31b865 100644 --- a/WinAlfred.Plugin.System/Programs.cs +++ b/WinAlfred.Plugin.System/Programs.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; +using System.Runtime.InteropServices; using System.Text; using System.Windows.Forms; using Microsoft.Win32; @@ -27,6 +28,12 @@ namespace WinAlfred.Plugin.System List installedList = new List(); + + [DllImport("shell32.dll")] + static extern bool SHGetSpecialFolderPath(IntPtr hwndOwner,[Out] StringBuilder lpszPath, int nFolder, bool fCreate); + const int CSIDL_COMMON_STARTMENU = 0x16; // \Windows\Start Menu\Programs + const int CSIDL_COMMON_PROGRAMS = 0x17; + public List Query(Query query) { if (string.IsNullOrEmpty(query.RawQuery) || query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1) return new List(); @@ -64,7 +71,10 @@ namespace WinAlfred.Plugin.System public void Init(PluginInitContext context) { indexDirectory.Add(Environment.GetFolderPath(Environment.SpecialFolder.Programs)); - indexDirectory.Add(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\Microsoft\Windows\Start Menu\Programs"); + + StringBuilder commonStartMenuPath = new StringBuilder(560); + SHGetSpecialFolderPath(IntPtr.Zero, commonStartMenuPath, CSIDL_COMMON_PROGRAMS, false); + indexDirectory.Add(commonStartMenuPath.ToString()); GetAppFromStartMenu(); } diff --git a/WinAlfred.Plugin.System/WinAlfred.Plugin.System.csproj b/WinAlfred.Plugin.System/WinAlfred.Plugin.System.csproj index f7d8449ea4..779af70e42 100644 --- a/WinAlfred.Plugin.System/WinAlfred.Plugin.System.csproj +++ b/WinAlfred.Plugin.System/WinAlfred.Plugin.System.csproj @@ -41,6 +41,7 @@ + diff --git a/WinAlfred/App.config b/WinAlfred/App.config index 01c0f5391e..e1eb5518f6 100644 --- a/WinAlfred/App.config +++ b/WinAlfred/App.config @@ -17,4 +17,4 @@ - + diff --git a/WinAlfred/App.xaml b/WinAlfred/App.xaml index ba0967d5dc..9acfef20e1 100644 --- a/WinAlfred/App.xaml +++ b/WinAlfred/App.xaml @@ -14,7 +14,6 @@ - diff --git a/WinAlfred/Images/folder.png b/WinAlfred/Images/folder.png new file mode 100644 index 0000000000000000000000000000000000000000..330cb2e4bf8ac344014dd3d22910de1ae884343a GIT binary patch literal 4260 zcmV;V5L@qwP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}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%+esTo3_RcfP}Y+{b}NR(i2HZ>TD*EW14h zRJCwH?+7|jREBLPuP!St>ger#aN?6c7*Gp>7IEDXVdrgt1_}WVV899yX4&>(c=9tp z9?XCQK}1neoa+HFF!dT{is800Kp{@uhJgn^``Gp_$hBZVRJ-mrAgD4(Q>xYt$1Ve| z5MirTr#h1I-v5Cjw*M}O`&F6#c5!sIA3Ps&?nHdD|Y(an$|b0lfi8V0Fi!C)Hz&d zPNTZICD$Qhc;BBOi?0gFFg{6Lt8HoAyc8dIOb7OaB1J{)08rI#y!UQmrl@*0Tl-E< zP#oF`QwI!1EA@H^us#4u;s^%08a{S6sTkG=pxgWOKkMlYFg#EJh9lzwv?73h2E20& zrAfg+CkKdPRum^SjqOw{7j6&$!*?o_!viD0XmrC(Ad4*YhvDPDI{l5m|8x1N(UGB8 zlZp@%HL2Aq;m-YIj8w~%O9>uu7OQ7ZpXV_0U_5sLZnP}%j`0XW;+-LEUk%}@XP#Sl zw%N*?4}JXopKfeqIB(P&S^X!!e(`5>Gn1uv-!pOF14pax%0*^}E9FwH5I4?>_wncX+7~`@s#+gZU8I5E5MJw^zA>)j@E|mfA2e|K79OvgC{@u zp6O#>{?6~e`i~c{JPm9N+I%+v03P}J5C77>@7_B;CBh59xm%M-9B)MX;}^gA+wYaq zq?+Y&W2Z~&wg66j|JmNJ-#T{x>@T#qeA+HRx1#Mh{yzX~hW#;ZfI(gW0000eRN literal 0 HcmV?d00001 diff --git a/WinAlfred/MainWindow.xaml.cs b/WinAlfred/MainWindow.xaml.cs index 4a12ba4f75..d231c8c9ea 100644 --- a/WinAlfred/MainWindow.xaml.cs +++ b/WinAlfred/MainWindow.xaml.cs @@ -91,8 +91,14 @@ namespace WinAlfred { Show(); //FocusManager.SetFocusedElement(this, tbQuery); + tbQuery.Focusable = true; Keyboard.Focus(tbQuery); tbQuery.SelectAll(); + + if (!tbQuery.IsKeyboardFocused) + { + MessageBox.Show("didnt focus"); + } } private void MainWindow_OnLoaded(object sender, RoutedEventArgs e) diff --git a/WinAlfred/Properties/Resources.Designer.cs b/WinAlfred/Properties/Resources.Designer.cs index 5b4270b0d5..c04e7374ec 100644 --- a/WinAlfred/Properties/Resources.Designer.cs +++ b/WinAlfred/Properties/Resources.Designer.cs @@ -1,73 +1,73 @@ -//------------------------------------------------------------------------------ -// -// 此代码由工具生成。 -// 运行时版本:4.0.30319.18052 -// -// 对此文件的更改可能会导致不正确的行为,并且如果 -// 重新生成代码,这些更改将会丢失。 -// -//------------------------------------------------------------------------------ - -namespace WinAlfred.Properties { - using System; - - - /// - /// 一个强类型的资源类,用于查找本地化的字符串等。 - /// - // 此类是由 StronglyTypedResourceBuilder - // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 - // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen - // (以 /str 作为命令选项),或重新生成 VS 项目。 - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// 返回此类使用的缓存的 ResourceManager 实例。 - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WinAlfred.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// 使用此强类型资源类,为所有资源查找 - /// 重写当前线程的 CurrentUICulture 属性。 - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// 查找类似于 (Icon) 的 System.Drawing.Icon 类型的本地化资源。 - /// - internal static System.Drawing.Icon app { - get { - object obj = ResourceManager.GetObject("app", resourceCulture); - return ((System.Drawing.Icon)(obj)); - } - } - } -} +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.18052 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace WinAlfred.Properties { + using System; + + + /// + /// 一个强类型的资源类,用于查找本地化的字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// 返回此类使用的缓存的 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WinAlfred.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 使用此强类型资源类,为所有资源查找 + /// 重写当前线程的 CurrentUICulture 属性。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// 查找类似于 (Icon) 的 System.Drawing.Icon 类型的本地化资源。 + /// + internal static System.Drawing.Icon app { + get { + object obj = ResourceManager.GetObject("app", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + } +} diff --git a/WinAlfred/Properties/Settings.Designer.cs b/WinAlfred/Properties/Settings.Designer.cs index d6abbf65e1..caf9c18c10 100644 --- a/WinAlfred/Properties/Settings.Designer.cs +++ b/WinAlfred/Properties/Settings.Designer.cs @@ -1,26 +1,26 @@ -//------------------------------------------------------------------------------ -// -// 此代码由工具生成。 -// 运行时版本:4.0.30319.18052 -// -// 对此文件的更改可能会导致不正确的行为,并且如果 -// 重新生成代码,这些更改将会丢失。 -// -//------------------------------------------------------------------------------ - -namespace WinAlfred.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.18052 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace WinAlfred.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/WinAlfred/ResultPanel.xaml.cs b/WinAlfred/ResultPanel.xaml.cs index 6cf568da4f..35af12e2ac 100644 --- a/WinAlfred/ResultPanel.xaml.cs +++ b/WinAlfred/ResultPanel.xaml.cs @@ -195,6 +195,8 @@ namespace WinAlfred public bool AcceptSelect() { int index = GetCurrentSelectedResultIndex(); + if (index < 0) return false; + var resultItemControl = pnlContainer.Children[index] as ResultItem; if (resultItemControl != null) { diff --git a/WinAlfred/WinAlfred.csproj b/WinAlfred/WinAlfred.csproj index 722066c294..c695a139c8 100644 --- a/WinAlfred/WinAlfred.csproj +++ b/WinAlfred/WinAlfred.csproj @@ -9,7 +9,7 @@ Properties WinAlfred WinAlfred - v4.0 + v3.5 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 @@ -59,9 +59,6 @@ - - C:\Users\Scott\Desktop\Jurassic.dll - ..\packages\log4net.2.0.3\lib\net35-full\log4net.dll diff --git a/WinAlfred/packages.config b/WinAlfred/packages.config index e25e951af7..0db9c4556d 100644 --- a/WinAlfred/packages.config +++ b/WinAlfred/packages.config @@ -1,5 +1,5 @@  - - + + \ No newline at end of file