From f24a6f0e3c3506103ed52ddfcd98b7a53e2770c0 Mon Sep 17 00:00:00 2001 From: Boris Makogonyuk Date: Tue, 10 Nov 2015 00:51:22 +0100 Subject: [PATCH 01/29] MainWindow: AllowsTransparency set to True WindowIntelopHelper: Added accent handling SettingsWindow: Added combobox with accent selector to Theme tab (not functional yet) Languages: Added entries for accent colors (all are in english for now) [TEMP] Blur and Accent themes experiments [TEMP] blur set in mainwindow on load. --- Wox/Helper/WindowIntelopHelper.cs | 54 ++++++++++++++++++++++++ Wox/Languages/en.xaml | 2 + Wox/Languages/ru.xaml | 1 + Wox/Languages/zh-cn.xaml | 3 +- Wox/Languages/zh-tw.xaml | 1 + Wox/MainWindow.xaml | 4 +- Wox/MainWindow.xaml.cs | 2 + Wox/SettingWindow.xaml | 13 ++++++ Wox/Themes/SimpleBlur.xaml | 41 ++++++++++++++++++ Wox/Themes/Test.xaml | 69 +++++++++++++++++++++++++++++++ Wox/Wox.csproj | 9 ++++ 11 files changed, 197 insertions(+), 2 deletions(-) create mode 100644 Wox/Themes/SimpleBlur.xaml create mode 100644 Wox/Themes/Test.xaml diff --git a/Wox/Helper/WindowIntelopHelper.cs b/Wox/Helper/WindowIntelopHelper.cs index 4a0223a19e..a9dd5ab217 100644 --- a/Wox/Helper/WindowIntelopHelper.cs +++ b/Wox/Helper/WindowIntelopHelper.cs @@ -88,5 +88,59 @@ namespace Wox.Helper public int Right; public int Bottom; } + + internal enum AccentState + { + ACCENT_DISABLED = 0, + ACCENT_ENABLE_GRADIENT = 1, + ACCENT_ENABLE_TRANSPARENTGRADIENT = 2, + ACCENT_ENABLE_BLURBEHIND = 3, + ACCENT_INVALID_STATE = 4 + } + + [StructLayout(LayoutKind.Sequential)] + internal struct AccentPolicy + { + public AccentState AccentState; + public int AccentFlags; + public int GradientColor; + public int AnimationId; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct WindowCompositionAttributeData + { + public WindowCompositionAttribute Attribute; + public IntPtr Data; + public int SizeOfData; + } + + internal enum WindowCompositionAttribute + { + WCA_ACCENT_POLICY = 19 + } + [DllImport("user32.dll")] + internal static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data); + public static void EnableBlur(Window wind) + { + var windowHelper = new WindowInteropHelper(wind); + + var accent = new AccentPolicy(); + accent.AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND; + accent.GradientColor = 16711680; + var accentStructSize = Marshal.SizeOf(accent); + + var accentPtr = Marshal.AllocHGlobal(accentStructSize); + Marshal.StructureToPtr(accent, accentPtr, false); + + var data = new WindowCompositionAttributeData(); + data.Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY; + data.SizeOfData = accentStructSize; + data.Data = accentPtr; + + SetWindowCompositionAttribute(windowHelper.Handle, ref data); + + Marshal.FreeHGlobal(accentPtr); + } } } \ No newline at end of file diff --git a/Wox/Languages/en.xaml b/Wox/Languages/en.xaml index 71b8cccf6a..8f53a74ff0 100644 --- a/Wox/Languages/en.xaml +++ b/Wox/Languages/en.xaml @@ -43,6 +43,8 @@ Result Item Font Window Mode Opacity + Windows Accents + Hotkey diff --git a/Wox/Languages/ru.xaml b/Wox/Languages/ru.xaml index 13a7be86cc..0c25bfb5a2 100644 --- a/Wox/Languages/ru.xaml +++ b/Wox/Languages/ru.xaml @@ -43,6 +43,7 @@ Шрифт результатов Оконный режим Прозрачность + Windows Accents Горячие клавиши diff --git a/Wox/Languages/zh-cn.xaml b/Wox/Languages/zh-cn.xaml index 0823b5f3e0..8db385c98d 100644 --- a/Wox/Languages/zh-cn.xaml +++ b/Wox/Languages/zh-cn.xaml @@ -43,7 +43,8 @@ 结果项字体 窗口模式 透明度 - + Windows Accents + 热键 Wox激活热键 diff --git a/Wox/Languages/zh-tw.xaml b/Wox/Languages/zh-tw.xaml index 5d8907fe7a..780bc115a5 100644 --- a/Wox/Languages/zh-tw.xaml +++ b/Wox/Languages/zh-tw.xaml @@ -43,6 +43,7 @@ 結果項字體 窗口模式 透明度 + Windows Accents 熱鍵 diff --git a/Wox/MainWindow.xaml b/Wox/MainWindow.xaml index 4b5a315fed..e3f249642e 100644 --- a/Wox/MainWindow.xaml +++ b/Wox/MainWindow.xaml @@ -13,7 +13,9 @@ AllowDrop="True" ShowInTaskbar="False" Style="{DynamicResource WindowStyle}" - Icon="Images\app.png"> + Icon="Images\app.png" + AllowsTransparency="True" + > diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index 5a289131ed..ef46b74f51 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -207,6 +207,7 @@ namespace Wox InitialTray(); Closing += MainWindow_Closing; + } @@ -255,6 +256,7 @@ namespace Wox InitProgressbarAnimation(); WindowIntelopHelper.DisableControlBox(this); + WindowIntelopHelper.EnableBlur(this); CheckUpdate(); } diff --git a/Wox/SettingWindow.xaml b/Wox/SettingWindow.xaml index 3d94b8fd5b..402aa1506b 100644 --- a/Wox/SettingWindow.xaml +++ b/Wox/SettingWindow.xaml @@ -199,7 +199,20 @@ + + + + + + + + + + + + + diff --git a/Wox/Themes/SimpleBlur.xaml b/Wox/Themes/SimpleBlur.xaml new file mode 100644 index 0000000000..acb26e0ba8 --- /dev/null +++ b/Wox/Themes/SimpleBlur.xaml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + #4F6180 + + + + + + diff --git a/Wox/Themes/Test.xaml b/Wox/Themes/Test.xaml new file mode 100644 index 0000000000..108852a6f5 --- /dev/null +++ b/Wox/Themes/Test.xaml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + #FFBBBBBB + + + + + + diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index 7d46e6109a..140595f5a5 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -258,6 +258,15 @@ Designer PreserveNewest + + MSBuild:Compile + Designer + PreserveNewest + + + Designer + MSBuild:Compile + Designer MSBuild:Compile From d8b806966a8ced00c0b50d234fcfc8ca2dce9f09 Mon Sep 17 00:00:00 2001 From: Boris Makogonyuk Date: Tue, 10 Nov 2015 03:37:34 +0100 Subject: [PATCH 02/29] Reversing MainWindow Blur call and settings window modification Added WindowsAccentMode to Base theme --- Wox/MainWindow.xaml.cs | 2 -- Wox/SettingWindow.xaml | 13 ------------- Wox/Themes/Base.xaml | 1 + Wox/Themes/SimpleBlur.xaml | 3 ++- 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index ef46b74f51..5a289131ed 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -207,7 +207,6 @@ namespace Wox InitialTray(); Closing += MainWindow_Closing; - } @@ -256,7 +255,6 @@ namespace Wox InitProgressbarAnimation(); WindowIntelopHelper.DisableControlBox(this); - WindowIntelopHelper.EnableBlur(this); CheckUpdate(); } diff --git a/Wox/SettingWindow.xaml b/Wox/SettingWindow.xaml index 402aa1506b..3d94b8fd5b 100644 --- a/Wox/SettingWindow.xaml +++ b/Wox/SettingWindow.xaml @@ -199,20 +199,7 @@ - - - - - - - - - - - - - diff --git a/Wox/Themes/Base.xaml b/Wox/Themes/Base.xaml index 39866e052c..d0d2b4a8eb 100644 --- a/Wox/Themes/Base.xaml +++ b/Wox/Themes/Base.xaml @@ -27,6 +27,7 @@ + 0 From 724cb0787dd8c4c5190e4ee67c6e1c3388646dc0 Mon Sep 17 00:00:00 2001 From: Boris Makogonyuk Date: Tue, 10 Nov 2015 06:35:09 +0100 Subject: [PATCH 03/29] Applying theme before actually setting the theme accent. UserSettingStorage now stores current theme accent mode. Themes: Added a bunch of them. Testing what works. --- Wox/Themes/Accent.xaml | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Wox/Themes/Accent.xaml diff --git a/Wox/Themes/Accent.xaml b/Wox/Themes/Accent.xaml new file mode 100644 index 0000000000..8585d5cb2c --- /dev/null +++ b/Wox/Themes/Accent.xaml @@ -0,0 +1,44 @@ + + + + + + + 2 + + + + + + + + + + + + + + + #4F6180 + + + + + + From 287e15fddc8319bba4b957191f590639f5e8a9ce Mon Sep 17 00:00:00 2001 From: Boris Makogonyuk Date: Tue, 10 Nov 2015 06:36:08 +0100 Subject: [PATCH 04/29] *forgot to stage files on last commit --- Wox.Core/Theme/Theme.cs | 8 ++++---- Wox.Core/UserSettings/UserSettingStorage.cs | 5 +++++ Wox/Helper/WindowIntelopHelper.cs | 8 ++++---- Wox/SettingWindow.xaml.cs | 1 + Wox/Themes/Base.xaml | 3 +++ Wox/Themes/Dark.xaml | 2 ++ Wox/Themes/SimpleBlur.xaml | 3 +++ Wox/Themes/Test.xaml | 7 +++++-- Wox/Wox.csproj | 6 ++++++ 9 files changed, 33 insertions(+), 10 deletions(-) diff --git a/Wox.Core/Theme/Theme.cs b/Wox.Core/Theme/Theme.cs index 9d937b51b1..e9eee2e0fa 100644 --- a/Wox.Core/Theme/Theme.cs +++ b/Wox.Core/Theme/Theme.cs @@ -53,10 +53,11 @@ namespace Wox.Core.Theme } } - UserSettingStorage.Instance.Theme = themeName; - UserSettingStorage.Instance.Save(); - ResourceMerger.ApplyThemeResource(this); + + UserSettingStorage.Instance.Theme = themeName; + UserSettingStorage.Instance.ThemeAccentMode = (int)Application.Current.Resources["WindowsAccentMode"]; + UserSettingStorage.Instance.Save(); } public ResourceDictionary GetResourceDictionary() @@ -89,7 +90,6 @@ namespace Wox.Core.Theme Setter[] setters = new Setter[] { fontFamily, fontStyle, fontWeight, fontStretch }; Array.ForEach(new Style[] { resultItemStyle, resultSubItemStyle, resultItemSelectedStyle, resultSubItemSelectedStyle }, o => Array.ForEach(setters, p => o.Setters.Add(p))); } - return dict; } diff --git a/Wox.Core/UserSettings/UserSettingStorage.cs b/Wox.Core/UserSettings/UserSettingStorage.cs index 32b3a20cc7..1b9f69396c 100644 --- a/Wox.Core/UserSettings/UserSettingStorage.cs +++ b/Wox.Core/UserSettings/UserSettingStorage.cs @@ -55,6 +55,9 @@ namespace Wox.Core.UserSettings [JsonProperty] public string ResultItemFontStretch { get; set; } + [JsonProperty] + public int ThemeAccentMode { get; set; } + [JsonProperty] public double WindowLeft { get; set; } @@ -117,6 +120,8 @@ namespace Wox.Core.UserSettings get { return "config"; } } + + public void IncreaseActivateTimes() { ActivateTimes++; diff --git a/Wox/Helper/WindowIntelopHelper.cs b/Wox/Helper/WindowIntelopHelper.cs index a9dd5ab217..fd40479eca 100644 --- a/Wox/Helper/WindowIntelopHelper.cs +++ b/Wox/Helper/WindowIntelopHelper.cs @@ -121,13 +121,13 @@ namespace Wox.Helper } [DllImport("user32.dll")] internal static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data); - public static void EnableBlur(Window wind) + public static void SetWindowAccent(Window wind, int themeAccentMode) { + if (themeAccentMode < 0 || themeAccentMode > 3) + themeAccentMode = 0; var windowHelper = new WindowInteropHelper(wind); - var accent = new AccentPolicy(); - accent.AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND; - accent.GradientColor = 16711680; + accent.AccentState = (AccentState) themeAccentMode; var accentStructSize = Marshal.SizeOf(accent); var accentPtr = Marshal.AllocHGlobal(accentStructSize); diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs index 4546d8f797..0d8bf200ac 100644 --- a/Wox/SettingWindow.xaml.cs +++ b/Wox/SettingWindow.xaml.cs @@ -460,6 +460,7 @@ namespace Wox Dispatcher.DelayInvoke("delayChangeTheme", () => { ThemeManager.Theme.ChangeTheme(UserSettingStorage.Instance.Theme); + WindowIntelopHelper.SetWindowAccent(MainWindow, UserSettingStorage.Instance.ThemeAccentMode); }, TimeSpan.FromMilliseconds(100)); } diff --git a/Wox/Themes/Base.xaml b/Wox/Themes/Base.xaml index d0d2b4a8eb..18d1edcb4e 100644 --- a/Wox/Themes/Base.xaml +++ b/Wox/Themes/Base.xaml @@ -27,7 +27,10 @@ + 0 + + + + diff --git a/Wox/Themes/SimpleBlur.xaml b/Wox/Themes/SimpleBlur.xaml index fb8882dd33..ff136a15d2 100644 --- a/Wox/Themes/SimpleBlur.xaml +++ b/Wox/Themes/SimpleBlur.xaml @@ -5,6 +5,9 @@ + + 3 + diff --git a/Wox/Themes/Test.xaml b/Wox/Themes/Test.xaml index 108852a6f5..70bc4aedd5 100644 --- a/Wox/Themes/Test.xaml +++ b/Wox/Themes/Test.xaml @@ -5,8 +5,11 @@ + + 3 + - #FFBBBBBB + Transparent + + - #4F6180 + #356ef3 diff --git a/Wox/Themes/SimpleBlur-White.xaml b/Wox/Themes/SimpleBlur-White.xaml new file mode 100644 index 0000000000..f502115e85 --- /dev/null +++ b/Wox/Themes/SimpleBlur-White.xaml @@ -0,0 +1,55 @@ + + + + + + + 3 + + + + + + + + + + + + + + + #356ef3 + + + + + + From ece09a93cdf7a0ddc80eb99be26d7497a1871f6a Mon Sep 17 00:00:00 2001 From: Boris Makogonyuk Date: Tue, 10 Nov 2015 12:18:03 +0100 Subject: [PATCH 06/29] Changed WindowsAccentMode (int32) Theme setting to ThemeBlurEnabled (boolean): - Exposed a new function "SetBlurForWindow" in WindowIntelopHelper that handles the blur. - Deleted Accent and Test themes - Changed SimpleBlur and Base themes according to changes --- Wox.Core/Theme/Theme.cs | 2 +- Wox.Core/UserSettings/UserSettingStorage.cs | 2 +- Wox/Helper/WindowIntelopHelper.cs | 28 ++++++-- Wox/MainWindow.xaml.cs | 1 + Wox/SettingWindow.xaml.cs | 2 +- Wox/Themes/Accent.xaml | 44 ------------- Wox/Themes/Base.xaml | 4 +- Wox/Themes/SimpleBlur-Black.xaml | 7 +- Wox/Themes/SimpleBlur-White.xaml | 7 +- Wox/Themes/Test.xaml | 72 --------------------- Wox/Wox.csproj | 9 +-- 11 files changed, 36 insertions(+), 142 deletions(-) delete mode 100644 Wox/Themes/Accent.xaml delete mode 100644 Wox/Themes/Test.xaml diff --git a/Wox.Core/Theme/Theme.cs b/Wox.Core/Theme/Theme.cs index e9eee2e0fa..87c3406357 100644 --- a/Wox.Core/Theme/Theme.cs +++ b/Wox.Core/Theme/Theme.cs @@ -56,7 +56,7 @@ namespace Wox.Core.Theme ResourceMerger.ApplyThemeResource(this); UserSettingStorage.Instance.Theme = themeName; - UserSettingStorage.Instance.ThemeAccentMode = (int)Application.Current.Resources["WindowsAccentMode"]; + UserSettingStorage.Instance.ThemeBlurEnabled = (bool)Application.Current.Resources["ThemeBlurEnabled"]; UserSettingStorage.Instance.Save(); } diff --git a/Wox.Core/UserSettings/UserSettingStorage.cs b/Wox.Core/UserSettings/UserSettingStorage.cs index 1b9f69396c..7aa48a82df 100644 --- a/Wox.Core/UserSettings/UserSettingStorage.cs +++ b/Wox.Core/UserSettings/UserSettingStorage.cs @@ -56,7 +56,7 @@ namespace Wox.Core.UserSettings public string ResultItemFontStretch { get; set; } [JsonProperty] - public int ThemeAccentMode { get; set; } + public bool ThemeBlurEnabled { get; set; } [JsonProperty] public double WindowLeft { get; set; } diff --git a/Wox/Helper/WindowIntelopHelper.cs b/Wox/Helper/WindowIntelopHelper.cs index fd40479eca..6bd64615ee 100644 --- a/Wox/Helper/WindowIntelopHelper.cs +++ b/Wox/Helper/WindowIntelopHelper.cs @@ -89,7 +89,11 @@ namespace Wox.Helper public int Bottom; } - internal enum AccentState + #region Blur Handling + /* + Found on https://github.com/riverar/sample-win10-aeroglass + */ + public enum AccentState { ACCENT_DISABLED = 0, ACCENT_ENABLE_GRADIENT = 1, @@ -120,14 +124,23 @@ namespace Wox.Helper WCA_ACCENT_POLICY = 19 } [DllImport("user32.dll")] - internal static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data); - public static void SetWindowAccent(Window wind, int themeAccentMode) + private static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data); + + /// + /// Sets the blur for a window via SetWindowCompositionAttribute + /// + /// window to blur + /// true/false - on or off correspondingly + public static void SetBlurForWindow(Window wind, bool status) + { + SetWindowAccent(wind, status ? AccentState.ACCENT_ENABLE_BLURBEHIND : AccentState.ACCENT_DISABLED); + } + + private static void SetWindowAccent(Window wind, AccentState themeAccentMode) { - if (themeAccentMode < 0 || themeAccentMode > 3) - themeAccentMode = 0; var windowHelper = new WindowInteropHelper(wind); var accent = new AccentPolicy(); - accent.AccentState = (AccentState) themeAccentMode; + accent.AccentState = themeAccentMode; var accentStructSize = Marshal.SizeOf(accent); var accentPtr = Marshal.AllocHGlobal(accentStructSize); @@ -142,5 +155,8 @@ namespace Wox.Helper Marshal.FreeHGlobal(accentPtr); } + #endregion + + } } \ No newline at end of file diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index 5a289131ed..8be83c06a7 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -255,6 +255,7 @@ namespace Wox InitProgressbarAnimation(); WindowIntelopHelper.DisableControlBox(this); + WindowIntelopHelper.SetBlurForWindow(this, UserSettingStorage.Instance.ThemeBlurEnabled); CheckUpdate(); } diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs index 0d8bf200ac..c484adbeb0 100644 --- a/Wox/SettingWindow.xaml.cs +++ b/Wox/SettingWindow.xaml.cs @@ -460,7 +460,7 @@ namespace Wox Dispatcher.DelayInvoke("delayChangeTheme", () => { ThemeManager.Theme.ChangeTheme(UserSettingStorage.Instance.Theme); - WindowIntelopHelper.SetWindowAccent(MainWindow, UserSettingStorage.Instance.ThemeAccentMode); + WindowIntelopHelper.SetBlurForWindow(MainWindow, UserSettingStorage.Instance.ThemeBlurEnabled); }, TimeSpan.FromMilliseconds(100)); } diff --git a/Wox/Themes/Accent.xaml b/Wox/Themes/Accent.xaml deleted file mode 100644 index 8585d5cb2c..0000000000 --- a/Wox/Themes/Accent.xaml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - 2 - - - - - - - - - - - - - - - #4F6180 - - - - - - diff --git a/Wox/Themes/Base.xaml b/Wox/Themes/Base.xaml index 18d1edcb4e..5fa7c96c81 100644 --- a/Wox/Themes/Base.xaml +++ b/Wox/Themes/Base.xaml @@ -27,8 +27,8 @@ - - 0 + + false diff --git a/Wox/Themes/SimpleBlur-Black.xaml b/Wox/Themes/SimpleBlur-Black.xaml index fad01abd7a..88e911b931 100644 --- a/Wox/Themes/SimpleBlur-Black.xaml +++ b/Wox/Themes/SimpleBlur-Black.xaml @@ -4,10 +4,9 @@ - - - 3 - + + True + - - - - - - - - - - - - - Transparent - - - - - - diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index aa8737fb38..52b55486ac 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -258,21 +258,16 @@ Designer PreserveNewest - + MSBuild:Compile Designer PreserveNewest - + MSBuild:Compile Designer PreserveNewest - - Designer - MSBuild:Compile - Always - Designer MSBuild:Compile From e33799701bab4bcab40518b4323a1b7d2b7e67cd Mon Sep 17 00:00:00 2001 From: Tobias Johansson Date: Wed, 25 Nov 2015 18:49:44 +0100 Subject: [PATCH 07/29] *Moved everything to dev branch - Sorry for the trouble --- Plugins/Wox.Plugin.Sys/Images/recyclebin.png | Bin 0 -> 4196 bytes Plugins/Wox.Plugin.Sys/Images/restartcomp.png | Bin 0 -> 4196 bytes Plugins/Wox.Plugin.Sys/Languages/en.xaml | 2 + Plugins/Wox.Plugin.Sys/Languages/zh-cn.xaml | 2 + Plugins/Wox.Plugin.Sys/Languages/zh-tw.xaml | 2 + Plugins/Wox.Plugin.Sys/Sys.cs | 37 ++++++++++++++++++ Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj | 9 ++++- 7 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 Plugins/Wox.Plugin.Sys/Images/recyclebin.png create mode 100644 Plugins/Wox.Plugin.Sys/Images/restartcomp.png diff --git a/Plugins/Wox.Plugin.Sys/Images/recyclebin.png b/Plugins/Wox.Plugin.Sys/Images/recyclebin.png new file mode 100644 index 0000000000000000000000000000000000000000..ba1f2703c79e3fc9f06d0fa1354984d57ca73c81 GIT binary patch literal 4196 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=hEV2xxn{IEF-UGAan%e-9KT3^Z%Z zOeFKwE(&KW{uj)Y$BTus6#fI%-dCwG^df9B5h~m#2J?vJsyr9URQM~IuRa&(fJS^+ zB2RT9(4pT&fY`LfQGp06FqIfJ*(=Ev>vW3esxAjwx)1DKp%Vt8Gw#~j<^jp@FYGgnWuIYT_1=KjGEu7 z6-E(QtV9(8T5=Pc0n`u^%~5{uIw6n`)kY+qZKtOOH7vqshIWmG50aIrOp`W88+@9n zA*Wt#8iQ&p63?vN*@_yL;4?#`#xx4aN>rw6Z=jG?wRs9Hu}z1E0;;WpjVDv2nFb6( zP*$Qk7SB^{CFo!IVjYkJFvAjutR`@Y2Bg9BX9+G8`C;y)ex{ zM{wD8dpW`QW^K+gK>58QIZD5=IRseH$-&g(r6uyQS4d(x%Fpe(y#!#IfsKv?VAXpO z=n!}{EnlMBjLmXTsOGP!z+Dl+3Pk^fCb2X(Ol)tAS_j&epaDGw+4tOg4BTO zd0@Ku2&CVFnqtc325E|=`k+=5iX+7HRBjVxIY<#O9;YH30F2Y04!yo$pX=3I>tRcz zKu7Pl?eY`?>38n)2RGx8%>ah#agZEQ0N8}8Le?w?Y*Ha>1eRzkk>x>bU{-tybR;}| zD3$4FA*+!o)Y^({23|I>I8H*=tXQTGuR=AdP2GULeT^&+V*^936K1eZy(LQ90;p#; zOpYL}UTNY3GZaJv6VUmHc_~cZQ^VMR>ESxE9EdGbq;(t^P5*)TyGe_qQu3laCZL5o zk=02TXcDf7U@ij|7-qsKsCL?g0#tn8w-)f~X4IYwy)jN=+)4H}iEIiRwka7{J5AW|sBUJwDB=$T8@8V0_DVS0jR!A}atI zhLPA{hN07-5)oYtnGY%%-KGRdAe&E+4fGwjONML^xolwZ{JU&z9jJdyJOIXbJGmC3 z>jM_wr-`>2s?xUGlTW%(lj2YSmKzW8bxe1$UHyAWjtw|$z`)??>gTe~DWM4fo+IY2 literal 0 HcmV?d00001 diff --git a/Plugins/Wox.Plugin.Sys/Images/restartcomp.png b/Plugins/Wox.Plugin.Sys/Images/restartcomp.png new file mode 100644 index 0000000000000000000000000000000000000000..fdbee813d977e0c74d173b18fe470c0f584fff04 GIT binary patch literal 4196 zcmdUyPe>F|9LL}6pV`?re{=_2hec(TWfwQh5ET5ws$tYdEFvB{?xBN3bO|Ip77^jW zLkH;;9y)ZWkf@N@otfR8ZOv4ILF8vS3JnfVStr@6f=U5c@9&2y$IU4W zvsI@q3QcdV_Vx;(8jVic1sp|LxuM}Y zKtq4`D8%eE6qbDfG@ie2S9ug=6_%BcFMu2jzDJ{U8=K592O7mgjX+5d9_iZ%{Z&Rr z5(k+w?*J6_t0aoE#X#UI5pn}4vFsDH-!&5J5NLs)PU_dEi60~QD+5}CC&Tnq+3mfPFY7@#&d zxTpC30Px|2AhcL)(oUSfV2Ele)wfsANxbV6;C)^S2Iox1FiYfNCyy7YO4H`&AY8DE zcLmTm?g5!k;#Wj*&x1?x`!`5D@oTwU$MFLwL%6ir(Q(pf%aO>mT~CZb6{$ruJOrdJaHIgTwEvm%ODkl1e`X!V`|@Ix5lRaaNinBi;z z{$)&bc1$4gs|AX36vyp)2GGfUK2u|k02l%bd-%TC9{_IHU}#Gg-ZnKQu`MSO=Z$q< zuMY*_Rm3gs{{T>Ve%_6;o^|M>=p{g_HD6B=x3*F8x&_{4GK>-mZMX&2qYfQfpI@g^ ylAhq!l1WK{@F~h#rma>FVZ1$+a9CSzYtvufERX1X?`+ literal 0 HcmV?d00001 diff --git a/Plugins/Wox.Plugin.Sys/Languages/en.xaml b/Plugins/Wox.Plugin.Sys/Languages/en.xaml index be6dbbbd72..65b50edcb8 100644 --- a/Plugins/Wox.Plugin.Sys/Languages/en.xaml +++ b/Plugins/Wox.Plugin.Sys/Languages/en.xaml @@ -6,12 +6,14 @@ Description Shutdown Computer + Restart Computer Log off Lock this computer Close Wox Restart Wox Tweak this app Put computer to sleep + Empty recycle bin System Commands Provide System related commands. e.g. shutdown,lock,setting etc. diff --git a/Plugins/Wox.Plugin.Sys/Languages/zh-cn.xaml b/Plugins/Wox.Plugin.Sys/Languages/zh-cn.xaml index 099003ebb1..e18fc8a832 100644 --- a/Plugins/Wox.Plugin.Sys/Languages/zh-cn.xaml +++ b/Plugins/Wox.Plugin.Sys/Languages/zh-cn.xaml @@ -6,12 +6,14 @@ 描述 关闭电脑 + Restart Computer 注销 锁定这台电脑 退出Wox 重启Wox 设置 休眠这台电脑 + Empty recycle bin 系统命令 系统系统相关的命令。例如,关机,锁定,设置等 diff --git a/Plugins/Wox.Plugin.Sys/Languages/zh-tw.xaml b/Plugins/Wox.Plugin.Sys/Languages/zh-tw.xaml index 0fa2694af7..9772142b29 100644 --- a/Plugins/Wox.Plugin.Sys/Languages/zh-tw.xaml +++ b/Plugins/Wox.Plugin.Sys/Languages/zh-tw.xaml @@ -6,12 +6,14 @@ 描述 關閉電腦 + Restart Computer 註銷 鎖定這臺電腦 退出Wox 重啟Wox 設置 休眠这台电脑 + Empty recycle bin 系統命令 系統系統相關的命令。例如,關機,鎖定,設置等 diff --git a/Plugins/Wox.Plugin.Sys/Sys.cs b/Plugins/Wox.Plugin.Sys/Sys.cs index d3a0db1da6..20426e0b5c 100644 --- a/Plugins/Wox.Plugin.Sys/Sys.cs +++ b/Plugins/Wox.Plugin.Sys/Sys.cs @@ -27,6 +27,10 @@ namespace Wox.Plugin.Sys [DllImport("user32")] private static extern void LockWorkStation(); + // https://msdn.microsoft.com/en-us/library/windows/desktop/bb762160(v=vs.85).aspx + [DllImport("Shell32.dll", CharSet = CharSet.Unicode)] + private static extern uint SHEmptyRecycleBin(System.IntPtr hwnd, string pszRootPath, uint dwFlags); + #endregion public Control CreateSettingPanel() @@ -73,6 +77,19 @@ namespace Wox.Plugin.Sys } }, new Result + { + Title = "Restart", + SubTitle = context.API.GetTranslation("wox_plugin_sys_restart_computer"), + IcoPath = "Images\\restartcomp.png", + Action = (c) => + { + if (MessageBox.Show("Are you sure you want to restart the computer?","Restart Computer?",MessageBoxButtons.YesNo,MessageBoxIcon.Warning) == DialogResult.Yes) { + Process.Start("shutdown", "/r /t 0"); + } + return true; + } + }, + new Result { Title = "Log off", SubTitle = context.API.GetTranslation("wox_plugin_sys_log_off"), @@ -96,6 +113,26 @@ namespace Wox.Plugin.Sys SubTitle = context.API.GetTranslation("wox_plugin_sys_sleep"), IcoPath = "Images\\sleep.png", Action = (c) => Application.SetSuspendState(PowerState.Suspend, false, false) + }, + new Result + { + Title = "Empty Recycle Bin", + SubTitle = context.API.GetTranslation("wox_plugin_sys_emptyrecyclebin"), + IcoPath = "Images\\recyclebin.png", + Action = (c) => + { + try + { + // Using 0 for the last part, let's us use all the windows pop-up and sounds + uint result = SHEmptyRecycleBin(System.IntPtr.Zero, null, 0); + } + catch (System.Exception ex) + { + MessageBox.Show("Error emptying recycle bin. \n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + return true; + } }, new Result { diff --git a/Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj b/Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj index 2bfb924a5c..47af63f417 100644 --- a/Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj +++ b/Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj @@ -63,6 +63,12 @@ + + PreserveNewest + + + PreserveNewest + PreserveNewest @@ -129,5 +135,4 @@ --> - - + \ No newline at end of file From f0765ba743506c108550fac52ac6d60736cf69df Mon Sep 17 00:00:00 2001 From: bao-qian Date: Thu, 26 Nov 2015 01:27:18 +0000 Subject: [PATCH 08/29] Fix System Command plugin 1. Fix error code handle for 39191a55187a36141bff42fcaf803135c0fe0b3c 2. use WPF MessageBox 3. Fix postion / window handle for 39191a55187a36141bff42fcaf803135c0fe0b3c --- Plugins/Wox.Plugin.Sys/Sys.cs | 60 +++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 21 deletions(-) diff --git a/Plugins/Wox.Plugin.Sys/Sys.cs b/Plugins/Wox.Plugin.Sys/Sys.cs index 20426e0b5c..6c3d76e969 100644 --- a/Plugins/Wox.Plugin.Sys/Sys.cs +++ b/Plugins/Wox.Plugin.Sys/Sys.cs @@ -1,10 +1,14 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.InteropServices; -using System.Windows.Forms; +using System.Windows; +using System.Windows.Interop; using Wox.Infrastructure; +using FormsApplication = System.Windows.Forms.Application; +using PowerState = System.Windows.Forms.PowerState; using Control = System.Windows.Controls.Control; namespace Wox.Plugin.Sys @@ -22,14 +26,22 @@ namespace Wox.Plugin.Sys internal const int EWX_FORCE = 0x00000004; internal const int EWX_POWEROFF = 0x00000008; internal const int EWX_FORCEIFHUNG = 0x00000010; + [DllImport("user32")] private static extern bool ExitWindowsEx(uint uFlags, uint dwReason); + [DllImport("user32")] private static extern void LockWorkStation(); - // https://msdn.microsoft.com/en-us/library/windows/desktop/bb762160(v=vs.85).aspx [DllImport("Shell32.dll", CharSet = CharSet.Unicode)] - private static extern uint SHEmptyRecycleBin(System.IntPtr hwnd, string pszRootPath, uint dwFlags); + private static extern uint SHEmptyRecycleBin(IntPtr hWnd, uint dwFlags); + + // http://www.pinvoke.net/default.aspx/Enums/HRESULT.html + private enum HRESULT : uint + { + S_FALSE = 0x0001, + S_OK = 0x0000 + } #endregion @@ -62,7 +74,8 @@ namespace Wox.Plugin.Sys private void LoadCommands() { - availableResults.AddRange(new Result[] { + availableResults.AddRange(new Result[] + { new Result { Title = "Shutdown", @@ -70,7 +83,10 @@ namespace Wox.Plugin.Sys IcoPath = "Images\\exit.png", Action = (c) => { - if (MessageBox.Show("Are you sure you want to shut the computer down?","Shutdown Computer?",MessageBoxButtons.YesNo,MessageBoxIcon.Warning) == DialogResult.Yes) { + var reuslt = MessageBox.Show("Are you sure you want to shut the computer down?", + "Shutdown Computer?", MessageBoxButton.YesNo, MessageBoxImage.Warning); + if (reuslt == MessageBoxResult.Yes) + { Process.Start("shutdown", "/s /t 0"); } return true; @@ -83,7 +99,10 @@ namespace Wox.Plugin.Sys IcoPath = "Images\\restartcomp.png", Action = (c) => { - if (MessageBox.Show("Are you sure you want to restart the computer?","Restart Computer?",MessageBoxButtons.YesNo,MessageBoxIcon.Warning) == DialogResult.Yes) { + var result = MessageBox.Show("Are you sure you want to restart the computer?", + "Restart Computer?", MessageBoxButton.YesNo, MessageBoxImage.Warning); + if (result == MessageBoxResult.Yes) + { Process.Start("shutdown", "/r /t 0"); } return true; @@ -106,31 +125,31 @@ namespace Wox.Plugin.Sys LockWorkStation(); return true; } - }, + }, new Result { Title = "Sleep", SubTitle = context.API.GetTranslation("wox_plugin_sys_sleep"), IcoPath = "Images\\sleep.png", - Action = (c) => Application.SetSuspendState(PowerState.Suspend, false, false) + Action = (c) => FormsApplication.SetSuspendState(PowerState.Suspend, false, false) }, - new Result + new Result { Title = "Empty Recycle Bin", SubTitle = context.API.GetTranslation("wox_plugin_sys_emptyrecyclebin"), IcoPath = "Images\\recyclebin.png", Action = (c) => { - try + // http://www.pinvoke.net/default.aspx/shell32/SHEmptyRecycleBin.html + // 0 for nothing + var result = SHEmptyRecycleBin(new WindowInteropHelper(Application.Current.MainWindow).Handle, 0); + if (result != (uint) HRESULT.S_OK) { - // Using 0 for the last part, let's us use all the windows pop-up and sounds - uint result = SHEmptyRecycleBin(System.IntPtr.Zero, null, 0); + MessageBox.Show($"Error emptying recycle bin, error code: {result}\n" + + "please refer to https://msdn.microsoft.com/en-us/library/windows/desktop/aa378137", + "Error", + MessageBoxButton.OK, MessageBoxImage.Error); } - catch (System.Exception ex) - { - MessageBox.Show("Error emptying recycle bin. \n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - return true; } }, @@ -153,7 +172,7 @@ namespace Wox.Plugin.Sys Action = (c) => { ProcessStartInfo Info = new ProcessStartInfo(); - Info.Arguments = "/C ping 127.0.0.1 -n 1 && \"" + Application.ExecutablePath + "\""; + Info.Arguments = "/C ping 127.0.0.1 -n 1 && \"" + FormsApplication.ExecutablePath + "\""; Info.WindowStyle = ProcessWindowStyle.Hidden; Info.CreateNoWindow = true; Info.FileName = "cmd.exe"; @@ -179,7 +198,6 @@ namespace Wox.Plugin.Sys public string GetLanguagesFolder() { return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages"); - } public string GetTranslatedPluginTitle() @@ -192,4 +210,4 @@ namespace Wox.Plugin.Sys return context.API.GetTranslation("wox_plugin_sys_plugin_description"); } } -} +} \ No newline at end of file From 6023f415a4104ae14a4967f9fcd74bb5c426b201 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Thu, 26 Nov 2015 02:04:44 +0000 Subject: [PATCH 09/29] Fix Wox restart 1. refactoring restart 2. delte some windows forms methods 3. using string inteperlation and delete hard coeded new line char should fix #322 --- Plugins/Wox.Plugin.PluginManagement/Main.cs | 21 ++++----- .../Wox.Plugin.PluginManagement.csproj | 2 + Plugins/Wox.Plugin.Sys/Sys.cs | 10 +--- Wox.Core/Plugin/PluginInstaller.cs | 46 ++++++++----------- Wox.Plugin/IPublicAPI.cs | 5 ++ Wox/App.xaml.cs | 4 ++ Wox/CommandArgs/CommandArgsFactory.cs | 4 +- Wox/Helper/SingleInstance.cs | 18 ++++++-- Wox/MainWindow.xaml.cs | 19 +++++--- 9 files changed, 71 insertions(+), 58 deletions(-) diff --git a/Plugins/Wox.Plugin.PluginManagement/Main.cs b/Plugins/Wox.Plugin.PluginManagement/Main.cs index 934caea04a..c11fa86da1 100644 --- a/Plugins/Wox.Plugin.PluginManagement/Main.cs +++ b/Plugins/Wox.Plugin.PluginManagement/Main.cs @@ -205,22 +205,19 @@ namespace Wox.Plugin.PluginManagement private void UnInstallPlugin(PluginMetadata plugin) { - string content = string.Format("Do you want to uninstall following plugin?\r\n\r\nName: {0}\r\nVersion: {1}\r\nAuthor: {2}", plugin.Name, plugin.Version, plugin.Author); + string content = $"Do you want to uninstall following plugin?{Environment.NewLine}{Environment.NewLine}" + + $"Name: {plugin.Name}{Environment.NewLine}" + + $"Version: {plugin.Version}{Environment.NewLine}" + + $"Author: {plugin.Author}"; if (MessageBox.Show(content, "Wox", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { File.Create(Path.Combine(plugin.PluginDirectory, "NeedDelete.txt")).Close(); - if (MessageBox.Show( - "You have uninstalled plugin " + plugin.Name + " successfully.\r\n Restart Wox to take effect?", - "Install plugin", - MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) + var result = MessageBox.Show($"You have uninstalled plugin {plugin.Name} successfully.{Environment.NewLine}" + + "Restart Wox to take effect?", + "Install plugin", MessageBoxButton.YesNo, MessageBoxImage.Question); + if (result == MessageBoxResult.Yes) { - ProcessStartInfo Info = new ProcessStartInfo(); - Info.Arguments = "/C ping 127.0.0.1 -n 1 && \"" + Assembly.GetExecutingAssembly().Location + "\""; - Info.WindowStyle = ProcessWindowStyle.Hidden; - Info.CreateNoWindow = true; - Info.FileName = "cmd.exe"; - Process.Start(Info); - context.API.CloseApp(); + context.API.RestarApp(); } } } diff --git a/Plugins/Wox.Plugin.PluginManagement/Wox.Plugin.PluginManagement.csproj b/Plugins/Wox.Plugin.PluginManagement/Wox.Plugin.PluginManagement.csproj index f88fb7d916..d4ff899e6c 100644 --- a/Plugins/Wox.Plugin.PluginManagement/Wox.Plugin.PluginManagement.csproj +++ b/Plugins/Wox.Plugin.PluginManagement/Wox.Plugin.PluginManagement.csproj @@ -41,7 +41,9 @@ + + diff --git a/Plugins/Wox.Plugin.Sys/Sys.cs b/Plugins/Wox.Plugin.Sys/Sys.cs index 6c3d76e969..9b2f838e67 100644 --- a/Plugins/Wox.Plugin.Sys/Sys.cs +++ b/Plugins/Wox.Plugin.Sys/Sys.cs @@ -171,14 +171,8 @@ namespace Wox.Plugin.Sys IcoPath = "Images\\restart.png", Action = (c) => { - ProcessStartInfo Info = new ProcessStartInfo(); - Info.Arguments = "/C ping 127.0.0.1 -n 1 && \"" + FormsApplication.ExecutablePath + "\""; - Info.WindowStyle = ProcessWindowStyle.Hidden; - Info.CreateNoWindow = true; - Info.FileName = "cmd.exe"; - Process.Start(Info); - context.API.CloseApp(); - return true; + context.API.RestarApp(); + return false; } }, new Result diff --git a/Wox.Core/Plugin/PluginInstaller.cs b/Wox.Core/Plugin/PluginInstaller.cs index ce6318a81b..f20f2fd079 100644 --- a/Wox.Core/Plugin/PluginInstaller.cs +++ b/Wox.Core/Plugin/PluginInstaller.cs @@ -1,10 +1,10 @@ using System; using System.Diagnostics; using System.IO; -using System.Windows.Forms; using ICSharpCode.SharpZipLib.Zip; using Newtonsoft.Json; using Wox.Plugin; +using System.Windows; namespace Wox.Core.Plugin { @@ -47,22 +47,24 @@ namespace Wox.Core.Plugin .Replace("*", "_") .Replace("|", "_") + "-" + Guid.NewGuid(); - string newPluginPath = Path.Combine(pluginFolerPath,newPluginName); - string content = string.Format( - "Do you want to install following plugin?\r\n\r\nName: {0}\r\nVersion: {1}\r\nAuthor: {2}", - plugin.Name, plugin.Version, plugin.Author); + string newPluginPath = Path.Combine(pluginFolerPath, newPluginName); + string content = $"Do you want to install following plugin?{Environment.NewLine}{Environment.NewLine}" + + $"Name: {plugin.Name}{Environment.NewLine}" + + $"Version: {plugin.Version}{Environment.NewLine}" + + $"Author: {plugin.Author}"; PluginPair existingPlugin = PluginManager.GetPluginForId(plugin.ID); if (existingPlugin != null) { - content = string.Format( - "Do you want to update following plugin?\r\n\r\nName: {0}\r\nOld Version: {1}\r\nNew Version: {2}\r\nAuthor: {3}", - plugin.Name, existingPlugin.Metadata.Version, plugin.Version, plugin.Author); + content = $"Do you want to update following plugin?{Environment.NewLine}{Environment.NewLine}" + + $"Name: {plugin.Name}{Environment.NewLine}" + + $"Old Version: {existingPlugin.Metadata.Version}" + + $"{Environment.NewLine}New Version: {plugin.Version}" + + $"{Environment.NewLine}Author: {plugin.Author}"; } - DialogResult result = System.Windows.Forms.MessageBox.Show(content, "Install plugin", MessageBoxButtons.YesNo, - MessageBoxIcon.Question); - if (result == DialogResult.Yes) + var result = MessageBox.Show(content, "Install plugin", MessageBoxButton.YesNo, MessageBoxImage.Question); + if (result == MessageBoxResult.Yes) { if (existingPlugin != null && Directory.Exists(existingPlugin.Metadata.PluginDirectory)) { @@ -81,17 +83,11 @@ namespace Wox.Core.Plugin //{ // Plugins.Init(); //} - if (MessageBox.Show("You have installed plugin " + plugin.Name + " successfully.\r\n Restart Wox to take effect?", "Install plugin", - MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + if (MessageBox.Show($"You have installed plugin {plugin.Name} successfully.{Environment.NewLine}" + + " Restart Wox to take effect?", + "Install plugin", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { - ProcessStartInfo Info = new ProcessStartInfo(); - Info.Arguments = "/C ping 127.0.0.1 -n 1 && \"" + - System.Windows.Forms.Application.ExecutablePath + "\""; - Info.WindowStyle = ProcessWindowStyle.Hidden; - Info.CreateNoWindow = true; - Info.FileName = "cmd.exe"; - Process.Start(Info); - PluginManager.API.CloseApp(); + PluginManager.API.RestarApp(); } } } @@ -114,7 +110,7 @@ namespace Wox.Core.Plugin } catch (System.Exception) { - string error = string.Format("Parse plugin config {0} failed: json format is not valid", configPath); + string error = $"Parse plugin config {configPath} failed: json format is not valid"; #if (DEBUG) { throw new System.Exception(error); @@ -126,8 +122,7 @@ namespace Wox.Core.Plugin if (!AllowedLanguage.IsAllowed(metadata.Language)) { - string error = string.Format("Parse plugin config {0} failed: invalid language {1}", configPath, - metadata.Language); + string error = $"Parse plugin config {configPath} failed: invalid language {metadata.Language}"; #if (DEBUG) { throw new System.Exception(error); @@ -137,8 +132,7 @@ namespace Wox.Core.Plugin } if (!File.Exists(metadata.ExecuteFilePath)) { - string error = string.Format("Parse plugin config {0} failed: ExecuteFile {1} didn't exist", configPath, - metadata.ExecuteFilePath); + string error = $"Parse plugin config {configPath} failed: ExecuteFile {metadata.ExecuteFilePath} didn't exist"; #if (DEBUG) { throw new System.Exception(error); diff --git a/Wox.Plugin/IPublicAPI.cs b/Wox.Plugin/IPublicAPI.cs index e4ebb3f96b..1672ec9919 100644 --- a/Wox.Plugin/IPublicAPI.cs +++ b/Wox.Plugin/IPublicAPI.cs @@ -51,6 +51,11 @@ namespace Wox.Plugin /// void CloseApp(); + /// + /// Restart Wox + /// + void RestarApp(); + /// /// Hide Wox /// diff --git a/Wox/App.xaml.cs b/Wox/App.xaml.cs index 4e87e6a4db..de80657c37 100644 --- a/Wox/App.xaml.cs +++ b/Wox/App.xaml.cs @@ -52,6 +52,10 @@ namespace Wox public bool OnActivate(IList args) { + if (args.Count > 0 && args[0] == SingleInstance.Restart) + { + Window.CloseApp(); + } CommandArgsFactory.Execute(args); return true; } diff --git a/Wox/CommandArgs/CommandArgsFactory.cs b/Wox/CommandArgs/CommandArgsFactory.cs index 7f2fdfc98b..e6e4a91b74 100644 --- a/Wox/CommandArgs/CommandArgsFactory.cs +++ b/Wox/CommandArgs/CommandArgsFactory.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; +using Wox.Helper; namespace Wox.CommandArgs { @@ -20,7 +21,8 @@ namespace Wox.CommandArgs public static void Execute(IList args) { - if (args.Count > 0) + // todo restart command line args? + if (args.Count > 0 && args[0] != SingleInstance.Restart) { string command = args[0]; ICommandArg cmd = commandArgs.FirstOrDefault(o => o.Command.ToLower() == command); diff --git a/Wox/Helper/SingleInstance.cs b/Wox/Helper/SingleInstance.cs index c01d7e1085..bd68270ffa 100644 --- a/Wox/Helper/SingleInstance.cs +++ b/Wox/Helper/SingleInstance.cs @@ -212,6 +212,8 @@ namespace Wox.Helper where TApplication: Application , ISingleInstanceApp { + public const string Restart = "Restart"; + #region Private Fields /// @@ -273,6 +275,8 @@ namespace Wox.Helper public static bool InitializeAsFirstInstance( string uniqueName ) { commandLineArgs = GetCommandLineArgs(uniqueName); + //remove execute path itself + commandLineArgs.RemoveAt(0); // Build unique application Id and the IPC channel name. string applicationIdentifier = uniqueName + Environment.UserName; @@ -285,13 +289,20 @@ namespace Wox.Helper if (firstInstance) { CreateRemoteService(channelName); + return true; + } + else if (commandLineArgs.Count > 0 && commandLineArgs[0] == Restart) + { + SignalFirstInstance(channelName, commandLineArgs); + singleInstanceMutex = new Mutex(true, applicationIdentifier); + CreateRemoteService(channelName); + return true; } else { SignalFirstInstance(channelName, commandLineArgs); + return false; } - - return firstInstance; } /// @@ -442,8 +453,7 @@ namespace Wox.Helper { return; } - //remove execute path itself - args.RemoveAt(0); + ((TApplication)Application.Current).OnActivate(args); } diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index 8be83c06a7..f25e51e822 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -10,7 +10,6 @@ using System.Reflection; using System.Threading; using System.Windows; using System.Windows.Controls; -using System.Windows.Forms; using System.Windows.Input; using System.Windows.Media.Animation; using NHotkey; @@ -26,14 +25,10 @@ using Wox.Infrastructure.Hotkey; using Wox.Plugin; using Wox.Storage; using ContextMenu = System.Windows.Forms.ContextMenu; -using DataFormats = System.Windows.DataFormats; -using DragEventArgs = System.Windows.DragEventArgs; -using IDataObject = System.Windows.IDataObject; -using KeyEventArgs = System.Windows.Input.KeyEventArgs; +using NotifyIcon = System.Windows.Forms.NotifyIcon; +using Screen = System.Windows.Forms.Screen; using MenuItem = System.Windows.Forms.MenuItem; -using MessageBox = System.Windows.MessageBox; using Stopwatch = Wox.Infrastructure.Stopwatch; -using ToolTip = System.Windows.Controls.ToolTip; namespace Wox { @@ -93,6 +88,16 @@ namespace Wox })); } + public void RestarApp() + { + ProcessStartInfo info = new ProcessStartInfo + { + FileName = Application.ResourceAssembly.Location, + Arguments = SingleInstance.Restart + }; + Process.Start(info); + } + public void HideApp() { Dispatcher.Invoke(new Action(HideWox)); From 9a8032a673b9a7283ad995168eba8f5d364d60a9 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Thu, 26 Nov 2015 08:15:50 +0000 Subject: [PATCH 10/29] Add more badges. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dee8e49ea2..c34c21eefa 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Wox [![Build status](https://ci.appveyor.com/api/projects/status/bfktntbivg32e103)](https://ci.appveyor.com/project/qianlifeng/wox) [![Bountysource](https://www.bountysource.com/badge/team?team_id=39433&style=raised)](https://www.bountysource.com/teams/wox?utm_source=Wox&utm_medium=shield&utm_campaign=raised) +Wox [![Build status](https://ci.appveyor.com/api/projects/status/bfktntbivg32e103)](https://ci.appveyor.com/project/qianlifeng/wox) [![Bountysource](https://www.bountysource.com/badge/team?team_id=39433&style=raised)](https://www.bountysource.com/teams/wox?utm_source=Wox&utm_medium=shield&utm_campaign=raised) [![Issue Stats](http://issuestats.com/github/Wox-launcher/Wox/badge/pr)](http://issuestats.com/github/Wox-launcher/Wox) ========= [Wox](https://www.getwox.com/) is a launcher for Windows, inspired by [Alfred](https://www.alfredapp.com/) and [Launchy](http://www.launchy.net/). You can launch everything with just a few keystrokes!. From daca1b36158e932fc163a6927b2b474f172d1cd3 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Thu, 26 Nov 2015 11:09:56 +0000 Subject: [PATCH 11/29] Update README.md --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c34c21eefa..a993a059b1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,12 @@ Wox [![Build status](https://ci.appveyor.com/api/projects/status/bfktntbivg32e103)](https://ci.appveyor.com/project/qianlifeng/wox) [![Bountysource](https://www.bountysource.com/badge/team?team_id=39433&style=raised)](https://www.bountysource.com/teams/wox?utm_source=Wox&utm_medium=shield&utm_campaign=raised) [![Issue Stats](http://issuestats.com/github/Wox-launcher/Wox/badge/pr)](http://issuestats.com/github/Wox-launcher/Wox) ========= -[Wox](https://www.getwox.com/) is a launcher for Windows, inspired by [Alfred](https://www.alfredapp.com/) and [Launchy](http://www.launchy.net/). You can launch everything with just a few keystrokes!. +[Wox](https://www.getwox.com/) is a launcher for Windows, an alternative to [Alfred](https://www.alfredapp.com/) or [Launchy](http://www.launchy.net/). You can launch everything with just a few keystrokes! + +Screenshot +========= + +More screenshots + Features ========= @@ -9,12 +15,6 @@ Features 3. Build custom themes in [https://www.getwox.com/theme/builder](https://www.getwox.com/theme/builder) 4. Install plugins from [https://www.getwox.com/plugin](https://www.getwox.com/plugin) -Screenshot -========= - -More screenshots - - Installation ========= From 53236faaa03bfa6b1681b5efc5426a36e5b5d619 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Fri, 27 Nov 2015 22:04:13 +0100 Subject: [PATCH 12/29] add french locale & xaml --- Wox.Core/i18n/AvailableLanguages.cs | 4 +- Wox/Languages/fr.xaml | 128 ++++++++++++++++++++++++++++ 2 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 Wox/Languages/fr.xaml diff --git a/Wox.Core/i18n/AvailableLanguages.cs b/Wox.Core/i18n/AvailableLanguages.cs index 3879fc9cd8..6523829430 100644 --- a/Wox.Core/i18n/AvailableLanguages.cs +++ b/Wox.Core/i18n/AvailableLanguages.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace Wox.Core.i18n { @@ -8,6 +8,7 @@ namespace Wox.Core.i18n public static Language Chinese = new Language("zh-cn", "中文"); public static Language Chinese_TW = new Language("zh-tw", "中文(繁体)"); public static Language Russian = new Language("ru", "Русский"); + public static Language French = new Language("fr", "Français"); public static List GetAvailableLanguages() { @@ -17,6 +18,7 @@ namespace Wox.Core.i18n Chinese, Chinese_TW, Russian, + French, }; return languages; } diff --git a/Wox/Languages/fr.xaml b/Wox/Languages/fr.xaml new file mode 100644 index 0000000000..839fae4f23 --- /dev/null +++ b/Wox/Languages/fr.xaml @@ -0,0 +1,128 @@ + + + Échec lors de l'enregistrement du raccourci : {0} + Impossible de lancer {0} + Le format de fichier n'est pas un plugin wox valide + Définir en tant que favori pour cette requête + Annuler le favori + Lancer la requête : {0} + Dernière exécution : {0} + Ouvrir + Paramètres + À propos + Quitter + + + Paramètres - Wox + Général + Lancer Wox au démarrage du système + Cacher Wox lors de la perte de focus + Ne pas afficher le message de mise à jour pour les nouvelles versions + Se souvenir du dernier emplacement de la fenêtre + Langue + Résultats à afficher + Ignore les raccourcis lorsqu'une application est en plein écran + + + Modules + Trouver plus de modules + Désactivé + Mot-clé d'action : + Répertoire + Auteur + Chargement : {0}ms + Utilisation : {0}ms + + + Thème + Trouver plus de thèmes + Hello Wox + Police (barre de recherche) + Police (liste des résultats) + Mode fenêtré + Opacité + + + Raccourcis + Ouvrir Wox + Requêtes personnalisées + Supprimer + Éditer + Ajouter + Veuillez sélectionner un élément + Voulez-vous vraiment supprimer {0} raccourci(s) ? + + + Proxy + Activer le proxy + Serveur + Port + Utilisateur + Mot de passe + Tester + Sauvegarder + Un serveur doit être indiqué + Un port doit être indiqué + Format invalide pour : port + Proxy sauvegardé avec succès + Le proxy est valide + Connection au proxy échouée + + + À propos + Site Web + Version + Vous avez utilisé Wox {0} fois + + + Ancien mot-clé d'action + Nouveau mot-clé d'action + Annuler + Terminé + Impossible de trouver le module spécifié + Le nouveau mot-clé d'action doit être spécifié + Le nouveau mot-clé d'action a été assigné à un autre module, veuillez en choisir un autre + Ajouté + Utilisez * si vous ne souhaitez pas utiliser de mot-clé spécifique + + + + Aperçu + Le raccourci n'est pas disponible, choisissez en un autre + Raccourci invalide + Actualiser + + + Raccourci non disponible + + + + Version + Time + Please tell us how application crashed so we can fix it + Send Report + Cancel + General + Exceptions + Exception Type + Source + Stack Trace + Sending + Report succeed + Report failed + Wox a rencontré une erreur + + + Wox version v{0} est disponible + Une erreur s'est produite lors de l'installation de la mise à jour + Mettre à jour + Annuler + Wox doit redémarrer pour installer cette mise à jour + Les fichiers suivants seront mis à jour + Fichiers mis à jour + Description de la mise à jour + + + \ No newline at end of file From 2d68e3d4f3ad60ca2163c8d710635db73bf688a1 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Fri, 27 Nov 2015 23:22:29 +0100 Subject: [PATCH 13/29] add fr to csproj --- Wox/Wox.csproj | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index 610530607c..88984ecd22 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -1,4 +1,4 @@ - + @@ -203,6 +203,11 @@ Designer PreserveNewest + + MSBuild:Compile + Designer + PreserveNewest + MSBuild:Compile Designer From d7d71d9ff11cd8c309090fc474eb41071af67ace Mon Sep 17 00:00:00 2001 From: bao-qian Date: Sat, 28 Nov 2015 10:47:42 +0000 Subject: [PATCH 14/29] Add solution level AssemblyInfo file, and bump version 1. Add solution level AssemblyInfo file 2. Bump assembly version 3. Fix #324 --- .../Wox.Plugin.CMD/Properties/AssemblyInfo.cs | 33 +------------------ Plugins/Wox.Plugin.CMD/Wox.Plugin.CMD.csproj | 6 ++-- .../Properties/AssemblyInfo.cs | 33 +------------------ .../Wox.Plugin.Caculator.csproj | 3 ++ .../Properties/AssemblyInfo.cs | 33 +------------------ .../Wox.Plugin.Color/Wox.Plugin.Color.csproj | 3 ++ .../Properties/AssemblyInfo.cs | 33 +------------------ .../Wox.Plugin.ControlPanel.csproj | 3 ++ .../Properties/AssemblyInfo.cs | 33 +------------------ .../Wox.Plugin.Everything.csproj | 6 ++-- .../Properties/AssemblyInfo.cs | 33 +------------------ .../Wox.Plugin.Folder.csproj | 6 ++-- .../Properties/AssemblyInfo.cs | 33 +------------------ .../Wox.Plugin.PluginIndicator.csproj | 3 ++ .../Properties/AssemblyInfo.cs | 33 +------------------ .../Wox.Plugin.PluginManagement.csproj | 3 ++ .../Properties/AssemblyInfo.cs | 33 +------------------ .../Wox.Plugin.Program.csproj | 3 ++ .../Wox.Plugin.Sys/Properties/AssemblyInfo.cs | 33 +------------------ Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj | 6 ++-- .../Wox.Plugin.Url/Properties/AssemblyInfo.cs | 33 +------------------ Plugins/Wox.Plugin.Url/Wox.Plugin.Url.csproj | 3 ++ .../Properties/AssemblyInfo.cs | 33 +------------------ .../Wox.Plugin.WebSearch.csproj | 3 ++ SolutionAssemblyInfo.cs | 21 ++++++++++++ Wox.Core/Properties/AssemblyInfo.cs | 33 +------------------ Wox.Core/Wox.Core.csproj | 3 ++ Wox.CrashReporter/Properties/AssemblyInfo.cs | 16 +-------- Wox.CrashReporter/Wox.CrashReporter.csproj | 6 ++-- Wox.Infrastructure/Properties/AssemblyInfo.cs | 14 +------- Wox.Infrastructure/Wox.Infrastructure.csproj | 3 ++ Wox.Plugin/Properties/AssemblyInfo.cs | 11 ------- Wox.Plugin/Wox.Plugin.csproj | 3 ++ Wox.Test/Properties/AssemblyInfo.cs | 33 +------------------ Wox.Test/Wox.Test.csproj | 6 ++-- .../Properties/AssemblyInfo.cs | 33 +------------------ .../Wox.UpdateFeedGenerator.csproj | 6 ++-- Wox.sln | 5 +++ Wox/Properties/AssemblyInfo.cs | 14 -------- Wox/Wox.csproj | 3 ++ 40 files changed, 107 insertions(+), 547 deletions(-) create mode 100644 SolutionAssemblyInfo.cs diff --git a/Plugins/Wox.Plugin.CMD/Properties/AssemblyInfo.cs b/Plugins/Wox.Plugin.CMD/Properties/AssemblyInfo.cs index fac890b6dd..c1968c12aa 100644 --- a/Plugins/Wox.Plugin.CMD/Properties/AssemblyInfo.cs +++ b/Plugins/Wox.Plugin.CMD/Properties/AssemblyInfo.cs @@ -1,36 +1,5 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// 有关程序集的常规信息通过以下 -// 特性集控制。更改这些特性值可修改 -// 与程序集关联的信息。 [assembly: AssemblyTitle("Wox.Plugin.CMD")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wox.Plugin.CMD")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 使此程序集中的类型 -// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, -// 则将该类型上的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("9283a32d-5d3c-4231-96e0-2150ed4716b9")] - -// 程序集的版本信息由下面四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, -// 方法是按如下所示使用“*”: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: Guid("9283a32d-5d3c-4231-96e0-2150ed4716b9")] \ No newline at end of file diff --git a/Plugins/Wox.Plugin.CMD/Wox.Plugin.CMD.csproj b/Plugins/Wox.Plugin.CMD/Wox.Plugin.CMD.csproj index 2b7280a2b5..b0b1fd0df6 100644 --- a/Plugins/Wox.Plugin.CMD/Wox.Plugin.CMD.csproj +++ b/Plugins/Wox.Plugin.CMD/Wox.Plugin.CMD.csproj @@ -53,6 +53,9 @@ + + Properties\SolutionAssemblyInfo.cs + CMDSetting.xaml @@ -110,5 +113,4 @@ --> - - + \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Caculator/Properties/AssemblyInfo.cs b/Plugins/Wox.Plugin.Caculator/Properties/AssemblyInfo.cs index a4ddfc5313..dd66d50a78 100644 --- a/Plugins/Wox.Plugin.Caculator/Properties/AssemblyInfo.cs +++ b/Plugins/Wox.Plugin.Caculator/Properties/AssemblyInfo.cs @@ -1,36 +1,5 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// 有关程序集的常规信息通过以下 -// 特性集控制。更改这些特性值可修改 -// 与程序集关联的信息。 [assembly: AssemblyTitle("Wox.Plugin.Caculator")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wox.Plugin.Caculator")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 使此程序集中的类型 -// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, -// 则将该类型上的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("ba698b90-59ed-4c2e-bce1-497eb2f9e76f")] - -// 程序集的版本信息由下面四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, -// 方法是按如下所示使用“*”: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: Guid("ba698b90-59ed-4c2e-bce1-497eb2f9e76f")] \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Caculator/Wox.Plugin.Caculator.csproj b/Plugins/Wox.Plugin.Caculator/Wox.Plugin.Caculator.csproj index 907c4ff929..9d4306d601 100644 --- a/Plugins/Wox.Plugin.Caculator/Wox.Plugin.Caculator.csproj +++ b/Plugins/Wox.Plugin.Caculator/Wox.Plugin.Caculator.csproj @@ -44,6 +44,9 @@ + + Properties\SolutionAssemblyInfo.cs + diff --git a/Plugins/Wox.Plugin.Color/Properties/AssemblyInfo.cs b/Plugins/Wox.Plugin.Color/Properties/AssemblyInfo.cs index 7578ccd763..1df9ed6e49 100644 --- a/Plugins/Wox.Plugin.Color/Properties/AssemblyInfo.cs +++ b/Plugins/Wox.Plugin.Color/Properties/AssemblyInfo.cs @@ -1,36 +1,5 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// 有关程序集的常规信息通过以下 -// 特性集控制。更改这些特性值可修改 -// 与程序集关联的信息。 [assembly: AssemblyTitle("Wox.Plugin.Color")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wox.Plugin.Color")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 使此程序集中的类型 -// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, -// 则将该类型上的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("46b03f84-5bf7-4ed4-a69b-f0274c8b3776")] - -// 程序集的版本信息由下面四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, -// 方法是按如下所示使用“*”: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: Guid("46b03f84-5bf7-4ed4-a69b-f0274c8b3776")] \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Color/Wox.Plugin.Color.csproj b/Plugins/Wox.Plugin.Color/Wox.Plugin.Color.csproj index 847df6d016..b100f3c606 100644 --- a/Plugins/Wox.Plugin.Color/Wox.Plugin.Color.csproj +++ b/Plugins/Wox.Plugin.Color/Wox.Plugin.Color.csproj @@ -38,6 +38,9 @@ + + Properties\SolutionAssemblyInfo.cs + diff --git a/Plugins/Wox.Plugin.ControlPanel/Properties/AssemblyInfo.cs b/Plugins/Wox.Plugin.ControlPanel/Properties/AssemblyInfo.cs index dbbad24f59..10e8283a21 100644 --- a/Plugins/Wox.Plugin.ControlPanel/Properties/AssemblyInfo.cs +++ b/Plugins/Wox.Plugin.ControlPanel/Properties/AssemblyInfo.cs @@ -1,36 +1,5 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// 有关程序集的常规信息通过以下 -// 特性集控制。更改这些特性值可修改 -// 与程序集关联的信息。 [assembly: AssemblyTitle("Wox.Plugin.ControlPanel")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wox.Plugin.ControlPanel")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 使此程序集中的类型 -// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, -// 则将该类型上的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("59141b10-8941-4e90-a0a6-bc9385a04cc6")] - -// 程序集的版本信息由下面四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, -// 方法是按如下所示使用“*”: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: Guid("59141b10-8941-4e90-a0a6-bc9385a04cc6")] \ No newline at end of file diff --git a/Plugins/Wox.Plugin.ControlPanel/Wox.Plugin.ControlPanel.csproj b/Plugins/Wox.Plugin.ControlPanel/Wox.Plugin.ControlPanel.csproj index 86f8a2c2a8..011dbe4fbd 100644 --- a/Plugins/Wox.Plugin.ControlPanel/Wox.Plugin.ControlPanel.csproj +++ b/Plugins/Wox.Plugin.ControlPanel/Wox.Plugin.ControlPanel.csproj @@ -38,6 +38,9 @@ + + Properties\SolutionAssemblyInfo.cs + diff --git a/Plugins/Wox.Plugin.Everything/Properties/AssemblyInfo.cs b/Plugins/Wox.Plugin.Everything/Properties/AssemblyInfo.cs index a6ff8af12c..22f46590a5 100644 --- a/Plugins/Wox.Plugin.Everything/Properties/AssemblyInfo.cs +++ b/Plugins/Wox.Plugin.Everything/Properties/AssemblyInfo.cs @@ -1,36 +1,5 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// 有关程序集的常规信息通过以下 -// 特性集控制。更改这些特性值可修改 -// 与程序集关联的信息。 [assembly: AssemblyTitle("Wox.Plugin.Everything")] -[assembly: AssemblyDescription("https://github.com/qianlifeng/Wox")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wox.Plugin.Everything")] -[assembly: AssemblyCopyright("The MIT License (MIT)")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 使此程序集中的类型 -// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, -// 则将该类型上的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("97f6ccd0-e9dc-4aa2-b4ce-6b9f14ea20a7")] - -// 程序集的版本信息由下面四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, -// 方法是按如下所示使用“*”: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: Guid("97f6ccd0-e9dc-4aa2-b4ce-6b9f14ea20a7")] \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Everything/Wox.Plugin.Everything.csproj b/Plugins/Wox.Plugin.Everything/Wox.Plugin.Everything.csproj index 1b8afe4139..586aa22330 100644 --- a/Plugins/Wox.Plugin.Everything/Wox.Plugin.Everything.csproj +++ b/Plugins/Wox.Plugin.Everything/Wox.Plugin.Everything.csproj @@ -45,6 +45,9 @@ + + Properties\SolutionAssemblyInfo.cs + @@ -137,5 +140,4 @@ --> - - + \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Folder/Properties/AssemblyInfo.cs b/Plugins/Wox.Plugin.Folder/Properties/AssemblyInfo.cs index 5cf2f0b6e8..17473b64d8 100644 --- a/Plugins/Wox.Plugin.Folder/Properties/AssemblyInfo.cs +++ b/Plugins/Wox.Plugin.Folder/Properties/AssemblyInfo.cs @@ -1,36 +1,5 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// 有关程序集的常规信息通过以下 -// 特性集控制。更改这些特性值可修改 -// 与程序集关联的信息。 [assembly: AssemblyTitle("Wox.Plugin.Folder")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wox.Plugin.Folder")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 使此程序集中的类型 -// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, -// 则将该类型上的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("e047418e-f7b0-4a3a-b855-0bef7178179f")] - -// 程序集的版本信息由下面四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, -// 方法是按如下所示使用“*”: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: Guid("e047418e-f7b0-4a3a-b855-0bef7178179f")] \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Folder/Wox.Plugin.Folder.csproj b/Plugins/Wox.Plugin.Folder/Wox.Plugin.Folder.csproj index 748cd7c6d8..50b66b3654 100644 --- a/Plugins/Wox.Plugin.Folder/Wox.Plugin.Folder.csproj +++ b/Plugins/Wox.Plugin.Folder/Wox.Plugin.Folder.csproj @@ -50,6 +50,9 @@ + + Properties\SolutionAssemblyInfo.cs + @@ -111,5 +114,4 @@ --> - - + \ No newline at end of file diff --git a/Plugins/Wox.Plugin.PluginIndicator/Properties/AssemblyInfo.cs b/Plugins/Wox.Plugin.PluginIndicator/Properties/AssemblyInfo.cs index 81a83a2dcd..5323b0bc14 100644 --- a/Plugins/Wox.Plugin.PluginIndicator/Properties/AssemblyInfo.cs +++ b/Plugins/Wox.Plugin.PluginIndicator/Properties/AssemblyInfo.cs @@ -1,36 +1,5 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// 有关程序集的常规信息通过以下 -// 特性集控制。更改这些特性值可修改 -// 与程序集关联的信息。 [assembly: AssemblyTitle("Wox.Plugin.PluginIndicator")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wox.Plugin.PluginIndicator")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 使此程序集中的类型 -// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, -// 则将该类型上的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("27f6d9fc-340b-47be-90ea-2a86bfca7bad")] - -// 程序集的版本信息由下面四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, -// 方法是按如下所示使用“*”: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: Guid("27f6d9fc-340b-47be-90ea-2a86bfca7bad")] \ No newline at end of file diff --git a/Plugins/Wox.Plugin.PluginIndicator/Wox.Plugin.PluginIndicator.csproj b/Plugins/Wox.Plugin.PluginIndicator/Wox.Plugin.PluginIndicator.csproj index e57ab20a8d..9c359acab6 100644 --- a/Plugins/Wox.Plugin.PluginIndicator/Wox.Plugin.PluginIndicator.csproj +++ b/Plugins/Wox.Plugin.PluginIndicator/Wox.Plugin.PluginIndicator.csproj @@ -36,6 +36,9 @@ + + Properties\SolutionAssemblyInfo.cs + diff --git a/Plugins/Wox.Plugin.PluginManagement/Properties/AssemblyInfo.cs b/Plugins/Wox.Plugin.PluginManagement/Properties/AssemblyInfo.cs index df6fc9c007..6fa58f5d18 100644 --- a/Plugins/Wox.Plugin.PluginManagement/Properties/AssemblyInfo.cs +++ b/Plugins/Wox.Plugin.PluginManagement/Properties/AssemblyInfo.cs @@ -1,36 +1,5 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// 有关程序集的常规信息通过以下 -// 特性集控制。更改这些特性值可修改 -// 与程序集关联的信息。 [assembly: AssemblyTitle("Wox.Plugin.PluginManagement")] -[assembly: AssemblyDescription("https://github.com/qianlifeng/Wox")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wox.Plugin.PluginManagement")] -[assembly: AssemblyCopyright("The MIT License (MIT)")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 使此程序集中的类型 -// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, -// 则将该类型上的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("92b59bab-5c8c-414b-a8d7-326c7be3a11d")] - -// 程序集的版本信息由下面四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, -// 方法是按如下所示使用“*”: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: Guid("92b59bab-5c8c-414b-a8d7-326c7be3a11d")] \ No newline at end of file diff --git a/Plugins/Wox.Plugin.PluginManagement/Wox.Plugin.PluginManagement.csproj b/Plugins/Wox.Plugin.PluginManagement/Wox.Plugin.PluginManagement.csproj index f88fb7d916..b9c91dcccc 100644 --- a/Plugins/Wox.Plugin.PluginManagement/Wox.Plugin.PluginManagement.csproj +++ b/Plugins/Wox.Plugin.PluginManagement/Wox.Plugin.PluginManagement.csproj @@ -44,6 +44,9 @@ + + Properties\SolutionAssemblyInfo.cs + diff --git a/Plugins/Wox.Plugin.Program/Properties/AssemblyInfo.cs b/Plugins/Wox.Plugin.Program/Properties/AssemblyInfo.cs index c2465d39d9..70b369ef5d 100644 --- a/Plugins/Wox.Plugin.Program/Properties/AssemblyInfo.cs +++ b/Plugins/Wox.Plugin.Program/Properties/AssemblyInfo.cs @@ -1,36 +1,5 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// 有关程序集的常规信息通过以下 -// 特性集控制。更改这些特性值可修改 -// 与程序集关联的信息。 [assembly: AssemblyTitle("Wox.Plugin.Program")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wox.Plugin.Program")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 使此程序集中的类型 -// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, -// 则将该类型上的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("82f60d9a-9280-4b6a-8b21-f3c694cb7e1d")] - -// 程序集的版本信息由下面四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, -// 方法是按如下所示使用“*”: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: Guid("82f60d9a-9280-4b6a-8b21-f3c694cb7e1d")] \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj b/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj index 84b26a6cd1..1506641de2 100644 --- a/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj +++ b/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj @@ -48,6 +48,9 @@ + + Properties\SolutionAssemblyInfo.cs + AddProgramSource.xaml diff --git a/Plugins/Wox.Plugin.Sys/Properties/AssemblyInfo.cs b/Plugins/Wox.Plugin.Sys/Properties/AssemblyInfo.cs index c0e3221b08..db9072038a 100644 --- a/Plugins/Wox.Plugin.Sys/Properties/AssemblyInfo.cs +++ b/Plugins/Wox.Plugin.Sys/Properties/AssemblyInfo.cs @@ -1,36 +1,5 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// 有关程序集的常规信息通过以下 -// 特性集控制。更改这些特性值可修改 -// 与程序集关联的信息。 [assembly: AssemblyTitle("Wox.Plugin.Sys")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wox.Plugin.Sys")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 使此程序集中的类型 -// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, -// 则将该类型上的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("e1eecff6-3f25-424d-9bbd-cbd7d6e1e11e")] - -// 程序集的版本信息由下面四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, -// 方法是按如下所示使用“*”: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: Guid("e1eecff6-3f25-424d-9bbd-cbd7d6e1e11e")] \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj b/Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj index 2bfb924a5c..8bd4e7d94f 100644 --- a/Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj +++ b/Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj @@ -46,6 +46,9 @@ + + Properties\SolutionAssemblyInfo.cs + @@ -129,5 +132,4 @@ --> - - + \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Url/Properties/AssemblyInfo.cs b/Plugins/Wox.Plugin.Url/Properties/AssemblyInfo.cs index 894c83bff0..83520f2f11 100644 --- a/Plugins/Wox.Plugin.Url/Properties/AssemblyInfo.cs +++ b/Plugins/Wox.Plugin.Url/Properties/AssemblyInfo.cs @@ -1,36 +1,5 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// 有关程序集的常规信息通过以下 -// 特性集控制。更改这些特性值可修改 -// 与程序集关联的信息。 [assembly: AssemblyTitle("Wox.Plugin.Url")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wox.Plugin.Url")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 使此程序集中的类型 -// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, -// 则将该类型上的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("ea42b60d-34ff-4656-8ee1-012afa397d3e")] - -// 程序集的版本信息由下面四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, -// 方法是按如下所示使用“*”: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: Guid("ea42b60d-34ff-4656-8ee1-012afa397d3e")] \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Url/Wox.Plugin.Url.csproj b/Plugins/Wox.Plugin.Url/Wox.Plugin.Url.csproj index 23e5ac1a8f..cfc35a6cb5 100644 --- a/Plugins/Wox.Plugin.Url/Wox.Plugin.Url.csproj +++ b/Plugins/Wox.Plugin.Url/Wox.Plugin.Url.csproj @@ -37,6 +37,9 @@ + + Properties\SolutionAssemblyInfo.cs + diff --git a/Plugins/Wox.Plugin.WebSearch/Properties/AssemblyInfo.cs b/Plugins/Wox.Plugin.WebSearch/Properties/AssemblyInfo.cs index 23f84e286a..26736bdf44 100644 --- a/Plugins/Wox.Plugin.WebSearch/Properties/AssemblyInfo.cs +++ b/Plugins/Wox.Plugin.WebSearch/Properties/AssemblyInfo.cs @@ -1,36 +1,5 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// 有关程序集的常规信息通过以下 -// 特性集控制。更改这些特性值可修改 -// 与程序集关联的信息。 [assembly: AssemblyTitle("Wox.Plugin.WebSearch")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wox.Plugin.WebSearch")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 使此程序集中的类型 -// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, -// 则将该类型上的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("42c17706-44ba-4549-ab66-7bd994706cd1")] - -// 程序集的版本信息由下面四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, -// 方法是按如下所示使用“*”: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: Guid("42c17706-44ba-4549-ab66-7bd994706cd1")] \ No newline at end of file diff --git a/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj b/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj index f2a5dd05bf..049780ab09 100644 --- a/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj +++ b/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj @@ -49,6 +49,9 @@ + + Properties\SolutionAssemblyInfo.cs + diff --git a/SolutionAssemblyInfo.cs b/SolutionAssemblyInfo.cs new file mode 100644 index 0000000000..58182e660b --- /dev/null +++ b/SolutionAssemblyInfo.cs @@ -0,0 +1,21 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +#if DEBUG +[assembly: AssemblyConfiguration("Debug")] +[assembly: AssemblyDescription("Debug build, https://github.com/Wox-launcher/Wox")] +#else +[assembly: AssemblyConfiguration("Release")] +[assembly: AssemblyDescription("Release build, https://github.com/Wox-launcher/Wox")] +#endif + +[assembly: AssemblyCompany("Wox-launcher")] +[assembly: AssemblyProduct("Wox")] +[assembly: AssemblyCopyright("The MIT License (MIT)")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: ComVisible(false)] +[assembly: AssemblyVersion("1.2.0")] +[assembly: AssemblyFileVersion("1.2.0.0")] +[assembly: AssemblyInformationalVersion("1.2-beta.2")] \ No newline at end of file diff --git a/Wox.Core/Properties/AssemblyInfo.cs b/Wox.Core/Properties/AssemblyInfo.cs index 0ca99a503a..7a4635b29e 100644 --- a/Wox.Core/Properties/AssemblyInfo.cs +++ b/Wox.Core/Properties/AssemblyInfo.cs @@ -1,36 +1,5 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. [assembly: AssemblyTitle("Wox.Core")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wox.Core")] -[assembly: AssemblyCopyright("The MIT License (MIT)")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("693aa0e5-741b-4759-b740-fdbb011a3280")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: Guid("693aa0e5-741b-4759-b740-fdbb011a3280")] \ No newline at end of file diff --git a/Wox.Core/Wox.Core.csproj b/Wox.Core/Wox.Core.csproj index f8d1129aef..2f55e3fb86 100644 --- a/Wox.Core/Wox.Core.csproj +++ b/Wox.Core/Wox.Core.csproj @@ -56,6 +56,9 @@ + + Properties\SolutionAssemblyInfo.cs + diff --git a/Wox.CrashReporter/Properties/AssemblyInfo.cs b/Wox.CrashReporter/Properties/AssemblyInfo.cs index 3a41b0898d..87313ef761 100644 --- a/Wox.CrashReporter/Properties/AssemblyInfo.cs +++ b/Wox.CrashReporter/Properties/AssemblyInfo.cs @@ -1,19 +1,5 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// 有关程序集的常规信息通过以下 -// 特性集控制。更改这些特性值可修改 -// 与程序集关联的信息。 [assembly: AssemblyTitle("Wox.CrashReporter")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wox.CrashReporter")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("0ea3743c-2c0d-4b13-b9ce-e5e1f85aea23")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file +[assembly: Guid("0ea3743c-2c0d-4b13-b9ce-e5e1f85aea23")] \ No newline at end of file diff --git a/Wox.CrashReporter/Wox.CrashReporter.csproj b/Wox.CrashReporter/Wox.CrashReporter.csproj index 0194c1d262..b64a35ef9a 100644 --- a/Wox.CrashReporter/Wox.CrashReporter.csproj +++ b/Wox.CrashReporter/Wox.CrashReporter.csproj @@ -48,6 +48,9 @@ + + Properties\SolutionAssemblyInfo.cs + @@ -95,5 +98,4 @@ --> - - + \ No newline at end of file diff --git a/Wox.Infrastructure/Properties/AssemblyInfo.cs b/Wox.Infrastructure/Properties/AssemblyInfo.cs index 092a409147..a75487010a 100644 --- a/Wox.Infrastructure/Properties/AssemblyInfo.cs +++ b/Wox.Infrastructure/Properties/AssemblyInfo.cs @@ -1,17 +1,5 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; - [assembly: AssemblyTitle("Wox.Infrastructure")] -[assembly: AssemblyDescription("https://github.com/qianlifeng/Wox")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wox.Infrastructure")] -[assembly: AssemblyCopyright("The MIT License (MIT)")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("aee57a31-29e5-4f03-a41f-7917910fe90f")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file +[assembly: Guid("aee57a31-29e5-4f03-a41f-7917910fe90f")] \ No newline at end of file diff --git a/Wox.Infrastructure/Wox.Infrastructure.csproj b/Wox.Infrastructure/Wox.Infrastructure.csproj index 31100d3ae4..6e65f0d1e8 100644 --- a/Wox.Infrastructure/Wox.Infrastructure.csproj +++ b/Wox.Infrastructure/Wox.Infrastructure.csproj @@ -50,6 +50,9 @@ + + Properties\SolutionAssemblyInfo.cs + diff --git a/Wox.Plugin/Properties/AssemblyInfo.cs b/Wox.Plugin/Properties/AssemblyInfo.cs index a7fb46756c..a5d51b0033 100644 --- a/Wox.Plugin/Properties/AssemblyInfo.cs +++ b/Wox.Plugin/Properties/AssemblyInfo.cs @@ -3,18 +3,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Wox.Plugin")] -[assembly: AssemblyDescription("https://github.com/qianlifeng/Wox")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wox.Plugin")] -[assembly: AssemblyCopyright("The MIT License (MIT)")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] [assembly: Guid("c22be00d-a6f5-4e45-8ecc-09ebf297c812")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] - [assembly: InternalsVisibleTo("Wox")] [assembly: InternalsVisibleTo("Wox.Core")] [assembly: InternalsVisibleTo("Wox.Test")] diff --git a/Wox.Plugin/Wox.Plugin.csproj b/Wox.Plugin/Wox.Plugin.csproj index 11c1b4c89b..aa89d8ab18 100644 --- a/Wox.Plugin/Wox.Plugin.csproj +++ b/Wox.Plugin/Wox.Plugin.csproj @@ -38,6 +38,9 @@ + + Properties\SolutionAssemblyInfo.cs + diff --git a/Wox.Test/Properties/AssemblyInfo.cs b/Wox.Test/Properties/AssemblyInfo.cs index 799c988baf..e92ae08bb7 100644 --- a/Wox.Test/Properties/AssemblyInfo.cs +++ b/Wox.Test/Properties/AssemblyInfo.cs @@ -1,36 +1,5 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// 有关程序集的常规信息通过以下 -// 特性集控制。更改这些特性值可修改 -// 与程序集关联的信息。 [assembly: AssemblyTitle("Wox.Test")] -[assembly: AssemblyDescription("https://github.com/qianlifeng/Wox")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wox.Test")] -[assembly: AssemblyCopyright("The MIT License (MIT)")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 使此程序集中的类型 -// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, -// 则将该类型上的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("c42c2b1b-ead4-498c-a06d-7cbde85760e4")] - -// 程序集的版本信息由下面四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, -// 方法是按如下所示使用“*”: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: Guid("c42c2b1b-ead4-498c-a06d-7cbde85760e4")] \ No newline at end of file diff --git a/Wox.Test/Wox.Test.csproj b/Wox.Test/Wox.Test.csproj index 8d54d3612e..2cc0b78146 100644 --- a/Wox.Test/Wox.Test.csproj +++ b/Wox.Test/Wox.Test.csproj @@ -41,6 +41,9 @@ + + Properties\SolutionAssemblyInfo.cs + @@ -77,5 +80,4 @@ --> - - + \ No newline at end of file diff --git a/Wox.UpdateFeedGenerator/Properties/AssemblyInfo.cs b/Wox.UpdateFeedGenerator/Properties/AssemblyInfo.cs index d0f4268282..33c0c07f30 100644 --- a/Wox.UpdateFeedGenerator/Properties/AssemblyInfo.cs +++ b/Wox.UpdateFeedGenerator/Properties/AssemblyInfo.cs @@ -1,36 +1,5 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// 有关程序集的常规信息通过以下 -// 特性集控制。更改这些特性值可修改 -// 与程序集关联的信息。 [assembly: AssemblyTitle("Wox.UpdateFeedGenerator")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wox.UpdateFeedGenerator")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 使此程序集中的类型 -// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, -// 则将该类型上的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("2f3420c0-2c21-4f71-a45d-a47b5305fe20")] - -// 程序集的版本信息由下面四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, -// 方法是按如下所示使用“*”: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: Guid("2f3420c0-2c21-4f71-a45d-a47b5305fe20")] \ No newline at end of file diff --git a/Wox.UpdateFeedGenerator/Wox.UpdateFeedGenerator.csproj b/Wox.UpdateFeedGenerator/Wox.UpdateFeedGenerator.csproj index 8801cc14a6..12f4c1d0f7 100644 --- a/Wox.UpdateFeedGenerator/Wox.UpdateFeedGenerator.csproj +++ b/Wox.UpdateFeedGenerator/Wox.UpdateFeedGenerator.csproj @@ -49,6 +49,9 @@ + + Properties\SolutionAssemblyInfo.cs + @@ -74,5 +77,4 @@ --> - - + \ No newline at end of file diff --git a/Wox.sln b/Wox.sln index d50b7e3b37..ba82bc50d6 100644 --- a/Wox.sln +++ b/Wox.sln @@ -61,6 +61,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.UpdateFeedGenerator", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Plugin.Everything", "Plugins\Wox.Plugin.Everything\Wox.Plugin.Everything.csproj", "{230AE83F-E92E-4E69-8355-426B305DA9C0}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FFD651C7-0546-441F-BC8C-D4EE8FD01EA7}" + ProjectSection(SolutionItems) = preProject + SolutionAssemblyInfo.cs = SolutionAssemblyInfo.cs + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/Wox/Properties/AssemblyInfo.cs b/Wox/Properties/AssemblyInfo.cs index b4d5aea913..aebbd6d320 100644 --- a/Wox/Properties/AssemblyInfo.cs +++ b/Wox/Properties/AssemblyInfo.cs @@ -1,23 +1,9 @@ using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; using System.Windows; - [assembly: AssemblyTitle("Wox")] -[assembly: AssemblyDescription("https://github.com/qianlifeng/Wox")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wox")] -[assembly: AssemblyCopyright("The MIT License (MIT)")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly )] -[assembly: AssemblyVersion("1.1.0")] -[assembly: AssemblyFileVersion("1.1.0")] [assembly: Exceptionless.Configuration.Exceptionless("e0b256fbe9384498ba89aae2a6b7f8ab")] \ No newline at end of file diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index 4b50640702..01730b8f73 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -100,6 +100,9 @@ + + Properties\SolutionAssemblyInfo.cs + From 8e7b40efec1e53de6a4647c9d922b15641cb2ec0 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Sat, 28 Nov 2015 10:55:07 +0000 Subject: [PATCH 15/29] Misc --- Wox.sln | 5 +++++ appveyor.yml | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Wox.sln b/Wox.sln index ba82bc50d6..5d162ebc43 100644 --- a/Wox.sln +++ b/Wox.sln @@ -63,6 +63,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wox.Plugin.Everything", "Pl EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FFD651C7-0546-441F-BC8C-D4EE8FD01EA7}" ProjectSection(SolutionItems) = preProject + .gitattributes = .gitattributes + .gitignore = .gitignore + appveyor.yml = appveyor.yml + LICENSE = LICENSE + README.md = README.md SolutionAssemblyInfo.cs = SolutionAssemblyInfo.cs EndProjectSection EndProject diff --git a/appveyor.yml b/appveyor.yml index 935d638447..d281487a50 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 1.2.0.{build} +version: 1.2.{build} os: Visual Studio 2015 configuration: Release platform: Any CPU @@ -7,7 +7,7 @@ assembly_info: file: AssemblyInfo.* assembly_version: '{version}' assembly_file_version: '{version}' - assembly_informational_version: '{version}-$(APPVEYOR_REPO_COMMIT)' + assembly_informational_version: '{version}-beta.2-$(APPVEYOR_REPO_COMMIT)' before_build: - ps: nuget restore build: From 5bb90828f85591fe07f931c05ad76f56c615f256 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Sun, 29 Nov 2015 03:28:47 +0000 Subject: [PATCH 16/29] Fix Wox restart by wait Mutex to be released Fix bug in 24866ff032829e9bd34704d3d5970d227a4c8db3. Wait existing Mutex to release itself instead of create a new one. Relate issue: #322 --- Wox/App.xaml.cs | 8 +++++--- Wox/Helper/SingleInstance.cs | 22 +++++++--------------- Wox/MainWindow.xaml.cs | 8 ++------ Wox/Wox.csproj | 2 +- 4 files changed, 15 insertions(+), 25 deletions(-) diff --git a/Wox/App.xaml.cs b/Wox/App.xaml.cs index de80657c37..2d950b6892 100644 --- a/Wox/App.xaml.cs +++ b/Wox/App.xaml.cs @@ -50,14 +50,16 @@ namespace Wox AppDomain.CurrentDomain.UnhandledException += ErrorReporting.UnhandledExceptionHandle; } - public bool OnActivate(IList args) + public void OnActivate(IList args) { if (args.Count > 0 && args[0] == SingleInstance.Restart) { Window.CloseApp(); } - CommandArgsFactory.Execute(args); - return true; + else + { + CommandArgsFactory.Execute(args); + } } } } diff --git a/Wox/Helper/SingleInstance.cs b/Wox/Helper/SingleInstance.cs index bd68270ffa..20a51fefa5 100644 --- a/Wox/Helper/SingleInstance.cs +++ b/Wox/Helper/SingleInstance.cs @@ -1,14 +1,4 @@ -//----------------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -// This class checks to make sure that only one instance of -// this application is running at a time. -// -//----------------------------------------------------------------------- - -using System; +using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; @@ -23,7 +13,8 @@ using System.Threading; using System.Windows; using System.Windows.Threading; -//http://blogs.microsoft.co.il/arik/2010/05/28/wpf-single-instance-application/ +// http://blogs.microsoft.co.il/arik/2010/05/28/wpf-single-instance-application/ +// modified to allow single instace restart namespace Wox.Helper { internal enum WM @@ -194,7 +185,7 @@ namespace Wox.Helper public interface ISingleInstanceApp { - bool OnActivate(IList args); + void OnActivate(IList args); } /// @@ -239,7 +230,7 @@ namespace Wox.Helper /// /// Application mutex. /// - private static Mutex singleInstanceMutex; + internal static Mutex singleInstanceMutex; /// /// IPC channel for communications. @@ -291,10 +282,11 @@ namespace Wox.Helper CreateRemoteService(channelName); return true; } + // Restart else if (commandLineArgs.Count > 0 && commandLineArgs[0] == Restart) { SignalFirstInstance(channelName, commandLineArgs); - singleInstanceMutex = new Mutex(true, applicationIdentifier); + singleInstanceMutex.WaitOne(TimeSpan.FromSeconds(10)); CreateRemoteService(channelName); return true; } diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index f25e51e822..7f2aaf60a4 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -80,12 +80,8 @@ namespace Wox public void CloseApp() { - Dispatcher.Invoke(new Action(() => - { - notifyIcon.Visible = false; - Close(); - Environment.Exit(0); - })); + SingleInstance.singleInstanceMutex.ReleaseMutex(); + Application.Current.Shutdown(); } public void RestarApp() diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index c906ccb385..ecd36eeda0 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -1,4 +1,4 @@ - + From a8c6a975799aa846585f1a6c1b09fbbc615ab8d5 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Sun, 29 Nov 2015 05:14:56 +0000 Subject: [PATCH 17/29] Better mutex cleanup --- Wox/Helper/SingleInstance.cs | 6 +----- Wox/MainWindow.xaml.cs | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Wox/Helper/SingleInstance.cs b/Wox/Helper/SingleInstance.cs index 20a51fefa5..c62fefc0ad 100644 --- a/Wox/Helper/SingleInstance.cs +++ b/Wox/Helper/SingleInstance.cs @@ -302,11 +302,7 @@ namespace Wox.Helper /// public static void Cleanup() { - if (singleInstanceMutex != null) - { - singleInstanceMutex.Close(); - singleInstanceMutex = null; - } + singleInstanceMutex?.ReleaseMutex(); if (channel != null) { diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index 7f2aaf60a4..eda169be96 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -80,7 +80,6 @@ namespace Wox public void CloseApp() { - SingleInstance.singleInstanceMutex.ReleaseMutex(); Application.Current.Shutdown(); } From 38791e50ea39c18f8cae8c96043b9f036a4484e5 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Sun, 29 Nov 2015 06:29:32 +0000 Subject: [PATCH 18/29] Refactoring blur 1. Refactoring blur, see discussion in : 7f8bb80 2. Releated issue: #330 --- Wox.Core/Plugin/PluginManager.cs | 2 +- Wox.Core/Theme/ITheme.cs | 10 --- Wox.Core/Theme/Theme.cs | 89 ++++++++++++++++++++- Wox.Core/UI/ResourceMerger.cs | 21 ++--- Wox.Core/UserSettings/UserSettingStorage.cs | 3 - Wox.Core/Wox.Core.csproj | 1 - Wox.Core/i18n/Internationalization.cs | 2 +- Wox/Helper/WindowIntelopHelper.cs | 70 ---------------- Wox/Languages/en.xaml | 1 - Wox/Languages/ru.xaml | 1 - Wox/Languages/zh-cn.xaml | 1 - Wox/Languages/zh-tw.xaml | 1 - Wox/MainWindow.xaml.cs | 10 +-- Wox/SettingWindow.xaml.cs | 18 +---- Wox/Themes/Base.xaml | 4 - Wox/Themes/SimpleBlur-Black.xaml | 30 ++++--- Wox/Themes/SimpleBlur-White.xaml | 30 ++++--- 17 files changed, 131 insertions(+), 163 deletions(-) delete mode 100644 Wox.Core/Theme/ITheme.cs diff --git a/Wox.Core/Plugin/PluginManager.cs b/Wox.Core/Plugin/PluginManager.cs index db05467dd6..5bcabee4fe 100644 --- a/Wox.Core/Plugin/PluginManager.cs +++ b/Wox.Core/Plugin/PluginManager.cs @@ -79,7 +79,7 @@ namespace Wox.Core.Plugin Concat(new JsonRPCPluginLoader().LoadPlugin(metadatas)); //load plugin i18n languages - ResourceMerger.ApplyPluginLanguages(); + ResourceMerger.UpdatePluginLanguages(); foreach (PluginPair pluginPair in AllPlugins) { diff --git a/Wox.Core/Theme/ITheme.cs b/Wox.Core/Theme/ITheme.cs deleted file mode 100644 index 34409068e6..0000000000 --- a/Wox.Core/Theme/ITheme.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Collections.Generic; - -namespace Wox.Core.Theme -{ - interface ITheme - { - void ChangeTheme(string themeName); - List LoadAvailableThemes(); - } -} diff --git a/Wox.Core/Theme/Theme.cs b/Wox.Core/Theme/Theme.cs index 87c3406357..c43b417970 100644 --- a/Wox.Core/Theme/Theme.cs +++ b/Wox.Core/Theme/Theme.cs @@ -3,8 +3,10 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; +using System.Runtime.InteropServices; using System.Windows; using System.Windows.Controls; +using System.Windows.Interop; using System.Windows.Media; using Wox.Core.UI; using Wox.Core.UserSettings; @@ -12,7 +14,7 @@ using Wox.Infrastructure.Logger; namespace Wox.Core.Theme { - public class Theme : IUIResource,ITheme + public class Theme : IUIResource { public const string DirectoryName = "Themes"; private static List themeDirectories = new List(); @@ -53,11 +55,21 @@ namespace Wox.Core.Theme } } - ResourceMerger.ApplyThemeResource(this); - UserSettingStorage.Instance.Theme = themeName; - UserSettingStorage.Instance.ThemeBlurEnabled = (bool)Application.Current.Resources["ThemeBlurEnabled"]; UserSettingStorage.Instance.Save(); + ResourceMerger.UpdateResource(this); + + try + { + var isBlur = Application.Current.FindResource("ThemeBlurEnabled"); + if (isBlur is bool) + { + SetBlurForWindow(Application.Current.MainWindow, (bool)isBlur); + } + } + catch (ResourceReferenceKeyNotFoundException e) + { + } } public ResourceDictionary GetResourceDictionary() @@ -119,5 +131,74 @@ namespace Wox.Core.Theme return string.Empty; } + + #region Blur Handling + /* + Found on https://github.com/riverar/sample-win10-aeroglass + */ + public enum AccentState + { + ACCENT_DISABLED = 0, + ACCENT_ENABLE_GRADIENT = 1, + ACCENT_ENABLE_TRANSPARENTGRADIENT = 2, + ACCENT_ENABLE_BLURBEHIND = 3, + ACCENT_INVALID_STATE = 4 + } + + [StructLayout(LayoutKind.Sequential)] + internal struct AccentPolicy + { + public AccentState AccentState; + public int AccentFlags; + public int GradientColor; + public int AnimationId; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct WindowCompositionAttributeData + { + public WindowCompositionAttribute Attribute; + public IntPtr Data; + public int SizeOfData; + } + + internal enum WindowCompositionAttribute + { + WCA_ACCENT_POLICY = 19 + } + [DllImport("user32.dll")] + private static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data); + + /// + /// Sets the blur for a window via SetWindowCompositionAttribute + /// + /// window to blur + /// true/false - on or off correspondingly + public void SetBlurForWindow(Window wind, bool status) + { + SetWindowAccent(wind, status ? AccentState.ACCENT_ENABLE_BLURBEHIND : AccentState.ACCENT_DISABLED); + } + + private void SetWindowAccent(Window wind, AccentState themeAccentMode) + { + var windowHelper = new WindowInteropHelper(wind); + var accent = new AccentPolicy { AccentState = themeAccentMode }; + var accentStructSize = Marshal.SizeOf(accent); + + var accentPtr = Marshal.AllocHGlobal(accentStructSize); + Marshal.StructureToPtr(accent, accentPtr, false); + + var data = new WindowCompositionAttributeData + { + Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY, + SizeOfData = accentStructSize, + Data = accentPtr + }; + + SetWindowCompositionAttribute(windowHelper.Handle, ref data); + + Marshal.FreeHGlobal(accentPtr); + } + #endregion } } diff --git a/Wox.Core/UI/ResourceMerger.cs b/Wox.Core/UI/ResourceMerger.cs index 2be07e50c6..9ce07a97ee 100644 --- a/Wox.Core/UI/ResourceMerger.cs +++ b/Wox.Core/UI/ResourceMerger.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Linq; using System.Windows; using Wox.Core.i18n; @@ -9,34 +10,34 @@ namespace Wox.Core.UI { public static class ResourceMerger { - private static void RemoveResource(string resourceDirectoryName) + private static void RemoveResource(string directoryName) { - var mergedDictionaries = Application.Current.Resources.MergedDictionaries; - foreach (var resource in mergedDictionaries) + directoryName = $"{Path.DirectorySeparatorChar}{directoryName}"; + var dictionaries = Application.Current.Resources.MergedDictionaries; + foreach (var resource in dictionaries) { - int directoryPosition = resource.Source.Segments.Length - 2; - string currentDirectoryName = resource.Source.Segments[directoryPosition]; - if (currentDirectoryName == resourceDirectoryName) + string currentDirectoryName = Path.GetDirectoryName(resource.Source.AbsolutePath); + if (currentDirectoryName == directoryName) { - mergedDictionaries.Remove(resource); + dictionaries.Remove(resource); break; } } } - public static void ApplyThemeResource(Theme.Theme t) + public static void UpdateResource(Theme.Theme t) { RemoveResource(Theme.Theme.DirectoryName); Application.Current.Resources.MergedDictionaries.Add(t.GetResourceDictionary()); } - public static void ApplyLanguageResources(Internationalization i) + public static void UpdateResources(Internationalization i) { RemoveResource(Internationalization.DirectoryName); Application.Current.Resources.MergedDictionaries.Add(i.GetResourceDictionary()); } - internal static void ApplyPluginLanguages() + internal static void UpdatePluginLanguages() { RemoveResource(PluginManager.DirectoryName); foreach (var languageFile in PluginManager.GetPluginsForInterface(). diff --git a/Wox.Core/UserSettings/UserSettingStorage.cs b/Wox.Core/UserSettings/UserSettingStorage.cs index 7aa48a82df..13017c6ea1 100644 --- a/Wox.Core/UserSettings/UserSettingStorage.cs +++ b/Wox.Core/UserSettings/UserSettingStorage.cs @@ -55,9 +55,6 @@ namespace Wox.Core.UserSettings [JsonProperty] public string ResultItemFontStretch { get; set; } - [JsonProperty] - public bool ThemeBlurEnabled { get; set; } - [JsonProperty] public double WindowLeft { get; set; } diff --git a/Wox.Core/Wox.Core.csproj b/Wox.Core/Wox.Core.csproj index 2f55e3fb86..02376a0340 100644 --- a/Wox.Core/Wox.Core.csproj +++ b/Wox.Core/Wox.Core.csproj @@ -69,7 +69,6 @@ - diff --git a/Wox.Core/i18n/Internationalization.cs b/Wox.Core/i18n/Internationalization.cs index 0cfea890a3..5ce242f187 100644 --- a/Wox.Core/i18n/Internationalization.cs +++ b/Wox.Core/i18n/Internationalization.cs @@ -70,7 +70,7 @@ namespace Wox.Core.i18n UserSettingStorage.Instance.Language = language.LanguageCode; UserSettingStorage.Instance.Save(); - ResourceMerger.ApplyLanguageResources(this); + ResourceMerger.UpdateResources(this); } public ResourceDictionary GetResourceDictionary() diff --git a/Wox/Helper/WindowIntelopHelper.cs b/Wox/Helper/WindowIntelopHelper.cs index 6bd64615ee..4a0223a19e 100644 --- a/Wox/Helper/WindowIntelopHelper.cs +++ b/Wox/Helper/WindowIntelopHelper.cs @@ -88,75 +88,5 @@ namespace Wox.Helper public int Right; public int Bottom; } - - #region Blur Handling - /* - Found on https://github.com/riverar/sample-win10-aeroglass - */ - public enum AccentState - { - ACCENT_DISABLED = 0, - ACCENT_ENABLE_GRADIENT = 1, - ACCENT_ENABLE_TRANSPARENTGRADIENT = 2, - ACCENT_ENABLE_BLURBEHIND = 3, - ACCENT_INVALID_STATE = 4 - } - - [StructLayout(LayoutKind.Sequential)] - internal struct AccentPolicy - { - public AccentState AccentState; - public int AccentFlags; - public int GradientColor; - public int AnimationId; - } - - [StructLayout(LayoutKind.Sequential)] - internal struct WindowCompositionAttributeData - { - public WindowCompositionAttribute Attribute; - public IntPtr Data; - public int SizeOfData; - } - - internal enum WindowCompositionAttribute - { - WCA_ACCENT_POLICY = 19 - } - [DllImport("user32.dll")] - private static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data); - - /// - /// Sets the blur for a window via SetWindowCompositionAttribute - /// - /// window to blur - /// true/false - on or off correspondingly - public static void SetBlurForWindow(Window wind, bool status) - { - SetWindowAccent(wind, status ? AccentState.ACCENT_ENABLE_BLURBEHIND : AccentState.ACCENT_DISABLED); - } - - private static void SetWindowAccent(Window wind, AccentState themeAccentMode) - { - var windowHelper = new WindowInteropHelper(wind); - var accent = new AccentPolicy(); - accent.AccentState = themeAccentMode; - var accentStructSize = Marshal.SizeOf(accent); - - var accentPtr = Marshal.AllocHGlobal(accentStructSize); - Marshal.StructureToPtr(accent, accentPtr, false); - - var data = new WindowCompositionAttributeData(); - data.Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY; - data.SizeOfData = accentStructSize; - data.Data = accentPtr; - - SetWindowCompositionAttribute(windowHelper.Handle, ref data); - - Marshal.FreeHGlobal(accentPtr); - } - #endregion - - } } \ No newline at end of file diff --git a/Wox/Languages/en.xaml b/Wox/Languages/en.xaml index 8f53a74ff0..8040ad6bc7 100644 --- a/Wox/Languages/en.xaml +++ b/Wox/Languages/en.xaml @@ -43,7 +43,6 @@ Result Item Font Window Mode Opacity - Windows Accents diff --git a/Wox/Languages/ru.xaml b/Wox/Languages/ru.xaml index 0c25bfb5a2..13a7be86cc 100644 --- a/Wox/Languages/ru.xaml +++ b/Wox/Languages/ru.xaml @@ -43,7 +43,6 @@ Шрифт результатов Оконный режим Прозрачность - Windows Accents Горячие клавиши diff --git a/Wox/Languages/zh-cn.xaml b/Wox/Languages/zh-cn.xaml index 8db385c98d..40860846b0 100644 --- a/Wox/Languages/zh-cn.xaml +++ b/Wox/Languages/zh-cn.xaml @@ -43,7 +43,6 @@ 结果项字体 窗口模式 透明度 - Windows Accents 热键 diff --git a/Wox/Languages/zh-tw.xaml b/Wox/Languages/zh-tw.xaml index 780bc115a5..5d8907fe7a 100644 --- a/Wox/Languages/zh-tw.xaml +++ b/Wox/Languages/zh-tw.xaml @@ -43,7 +43,6 @@ 結果項字體 窗口模式 透明度 - Windows Accents 熱鍵 diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index eda169be96..39cf8b3c7a 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -198,16 +198,12 @@ namespace Wox pnlResult.ItemDropEvent += pnlResult_ItemDropEvent; pnlContextMenu.LeftMouseClickEvent += SelectResult; pnlResult.RightMouseClickEvent += pnlResult_RightMouseClickEvent; + Closing += MainWindow_Closing; - ThemeManager.Theme.ChangeTheme(UserSettingStorage.Instance.Theme); - InternationalizationManager.Instance.ChangeLanguage(UserSettingStorage.Instance.Language); SetHotkey(UserSettingStorage.Instance.Hotkey, OnHotkey); SetCustomPluginHotkey(); InitialTray(); - - Closing += MainWindow_Closing; - } void pnlResult_ItemDropEvent(Result result, IDataObject dropDataObject, DragEventArgs args) @@ -250,12 +246,14 @@ namespace Wox private void MainWindow_OnLoaded(object sender, RoutedEventArgs e) { + ThemeManager.Theme.ChangeTheme(UserSettingStorage.Instance.Theme); + InternationalizationManager.Instance.ChangeLanguage(UserSettingStorage.Instance.Language); + Left = GetWindowsLeft(); Top = GetWindowsTop(); InitProgressbarAnimation(); WindowIntelopHelper.DisableControlBox(this); - WindowIntelopHelper.SetBlurForWindow(this, UserSettingStorage.Instance.ThemeBlurEnabled); CheckUpdate(); } diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs index c484adbeb0..20d2c02dd5 100644 --- a/Wox/SettingWindow.xaml.cs +++ b/Wox/SettingWindow.xaml.cs @@ -440,9 +440,7 @@ namespace Wox private void ThemeComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { string themeName = themeComboBox.SelectedItem.ToString(); - UserSettingStorage.Instance.Theme = themeName; - DelayChangeTheme(); - UserSettingStorage.Instance.Save(); + ThemeManager.Theme.ChangeTheme(themeName); } private void CbQueryBoxFont_OnSelectionChanged(object sender, SelectionChangedEventArgs e) @@ -451,19 +449,9 @@ namespace Wox string queryBoxFontName = cbQueryBoxFont.SelectedItem.ToString(); UserSettingStorage.Instance.QueryBoxFont = queryBoxFontName; this.cbQueryBoxFontFaces.SelectedItem = ((FontFamily)cbQueryBoxFont.SelectedItem).ChooseRegularFamilyTypeface(); - DelayChangeTheme(); UserSettingStorage.Instance.Save(); } - private void DelayChangeTheme() - { - Dispatcher.DelayInvoke("delayChangeTheme", () => - { - ThemeManager.Theme.ChangeTheme(UserSettingStorage.Instance.Theme); - WindowIntelopHelper.SetBlurForWindow(MainWindow, UserSettingStorage.Instance.ThemeBlurEnabled); - }, TimeSpan.FromMilliseconds(100)); - } - private void CbQueryBoxFontFaces_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { if (!settingsLoaded) return; @@ -481,7 +469,6 @@ namespace Wox UserSettingStorage.Instance.QueryBoxFontWeight = typeface.Weight.ToString(); UserSettingStorage.Instance.QueryBoxFontStyle = typeface.Style.ToString(); UserSettingStorage.Instance.Save(); - DelayChangeTheme(); } } @@ -491,9 +478,7 @@ namespace Wox string resultItemFont = cbResultItemFont.SelectedItem.ToString(); UserSettingStorage.Instance.ResultItemFont = resultItemFont; this.cbResultItemFontFaces.SelectedItem = ((FontFamily)cbResultItemFont.SelectedItem).ChooseRegularFamilyTypeface(); - UserSettingStorage.Instance.Save(); - DelayChangeTheme(); } private void CbResultItemFontFaces_OnSelectionChanged(object sender, SelectionChangedEventArgs e) @@ -511,7 +496,6 @@ namespace Wox UserSettingStorage.Instance.ResultItemFontWeight = typeface.Weight.ToString(); UserSettingStorage.Instance.ResultItemFontStyle = typeface.Style.ToString(); UserSettingStorage.Instance.Save(); - DelayChangeTheme(); } } diff --git a/Wox/Themes/Base.xaml b/Wox/Themes/Base.xaml index 5fa7c96c81..39866e052c 100644 --- a/Wox/Themes/Base.xaml +++ b/Wox/Themes/Base.xaml @@ -27,10 +27,6 @@ - - false - - - + - + + #356ef3 @@ -49,6 +47,6 @@ diff --git a/Wox/Themes/SimpleBlur-White.xaml b/Wox/Themes/SimpleBlur-White.xaml index 132f93333d..040bb0c2af 100644 --- a/Wox/Themes/SimpleBlur-White.xaml +++ b/Wox/Themes/SimpleBlur-White.xaml @@ -8,39 +8,37 @@ True - + - + + #356ef3 @@ -49,6 +47,6 @@ From 66e118abdf720ca137ad3e9c10cb2da887c7103f Mon Sep 17 00:00:00 2001 From: bao-qian Date: Sun, 29 Nov 2015 07:19:58 +0000 Subject: [PATCH 19/29] Misc --- Wox.Core/Theme/Theme.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Wox.Core/Theme/Theme.cs b/Wox.Core/Theme/Theme.cs index c43b417970..e9f55a83ad 100644 --- a/Wox.Core/Theme/Theme.cs +++ b/Wox.Core/Theme/Theme.cs @@ -136,7 +136,7 @@ namespace Wox.Core.Theme /* Found on https://github.com/riverar/sample-win10-aeroglass */ - public enum AccentState + private enum AccentState { ACCENT_DISABLED = 0, ACCENT_ENABLE_GRADIENT = 1, @@ -146,7 +146,7 @@ namespace Wox.Core.Theme } [StructLayout(LayoutKind.Sequential)] - internal struct AccentPolicy + private struct AccentPolicy { public AccentState AccentState; public int AccentFlags; @@ -155,14 +155,14 @@ namespace Wox.Core.Theme } [StructLayout(LayoutKind.Sequential)] - internal struct WindowCompositionAttributeData + private struct WindowCompositionAttributeData { public WindowCompositionAttribute Attribute; public IntPtr Data; public int SizeOfData; } - internal enum WindowCompositionAttribute + private enum WindowCompositionAttribute { WCA_ACCENT_POLICY = 19 } @@ -174,7 +174,7 @@ namespace Wox.Core.Theme /// /// window to blur /// true/false - on or off correspondingly - public void SetBlurForWindow(Window wind, bool status) + private void SetBlurForWindow(Window wind, bool status) { SetWindowAccent(wind, status ? AccentState.ACCENT_ENABLE_BLURBEHIND : AccentState.ACCENT_DISABLED); } From 2c81ff90dad7b09cf9ff51575d321b8e670838ba Mon Sep 17 00:00:00 2001 From: bao-qian Date: Sun, 29 Nov 2015 07:20:37 +0000 Subject: [PATCH 20/29] Use opacity to set blur releated: #330 --- .../{SimpleBlur-Black.xaml => BlurBlack.xaml} | 14 ++++++++++---- .../{SimpleBlur-White.xaml => BlurWhite.xaml} | 14 ++++++++++---- Wox/Wox.csproj | 4 ++-- 3 files changed, 22 insertions(+), 10 deletions(-) rename Wox/Themes/{SimpleBlur-Black.xaml => BlurBlack.xaml} (87%) rename Wox/Themes/{SimpleBlur-White.xaml => BlurWhite.xaml} (87%) diff --git a/Wox/Themes/SimpleBlur-Black.xaml b/Wox/Themes/BlurBlack.xaml similarity index 87% rename from Wox/Themes/SimpleBlur-Black.xaml rename to Wox/Themes/BlurBlack.xaml index 4d4727316e..dc1c5ec540 100644 --- a/Wox/Themes/SimpleBlur-Black.xaml +++ b/Wox/Themes/BlurBlack.xaml @@ -13,13 +13,19 @@