diff --git a/Wox.Plugin/IPublicAPI.cs b/Wox.Plugin/IPublicAPI.cs index 7928440adf..d8d6824426 100644 --- a/Wox.Plugin/IPublicAPI.cs +++ b/Wox.Plugin/IPublicAPI.cs @@ -74,7 +74,7 @@ namespace Wox.Plugin /// /// Open setting dialog /// - void OpenSettingDialog(); + void OpenSettingDialog(string tabName = "general"); /// /// Show loading animation diff --git a/Wox/Helper/WindowOpener.cs b/Wox/Helper/SingletonWindowOpener.cs similarity index 91% rename from Wox/Helper/WindowOpener.cs rename to Wox/Helper/SingletonWindowOpener.cs index 0bc37d7ee6..393b236731 100644 --- a/Wox/Helper/WindowOpener.cs +++ b/Wox/Helper/SingletonWindowOpener.cs @@ -6,7 +6,7 @@ using System.Windows; namespace Wox.Helper { - public static class WindowOpener + public static class SingletonWindowOpener { public static T Open(params object[] args) where T : Window { diff --git a/Wox/Helper/WoxLog4netPathConverter.cs b/Wox/Helper/WoxLog4netPathConverter.cs deleted file mode 100644 index 98cd176206..0000000000 --- a/Wox/Helper/WoxLog4netPathConverter.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; - -namespace Wox.Helper -{ - public class WoxLog4netPathConverter : log4net.Util.PatternConverter - { - protected override void Convert(TextWriter writer, object state) - { - string userProfilePath = Environment.GetEnvironmentVariable("USERPROFILE"); - writer.Write(Path.Combine(userProfilePath, ".Wox")); - } - } -} diff --git a/Wox/Languages/en.xaml b/Wox/Languages/en.xaml index 7d6b10bf31..262e57555a 100644 --- a/Wox/Languages/en.xaml +++ b/Wox/Languages/en.xaml @@ -9,6 +9,10 @@ Cancel topmost in this query Execute query:{0} Last execute time:{0} + Open + Settings + About + Exit Wox Settings diff --git a/Wox/Languages/zh-cn.xaml b/Wox/Languages/zh-cn.xaml index 48b5fe77a5..be99517ce4 100644 --- a/Wox/Languages/zh-cn.xaml +++ b/Wox/Languages/zh-cn.xaml @@ -9,7 +9,11 @@ 取消置顶 执行查询:{0} 上次执行时间:{0} - + 打开 + 设置 + 关于 + 退出 + Wox设置 通用 diff --git a/Wox/Languages/zh-tw.xaml b/Wox/Languages/zh-tw.xaml index 6f97aa2b8c..0f910b67a0 100644 --- a/Wox/Languages/zh-tw.xaml +++ b/Wox/Languages/zh-tw.xaml @@ -9,6 +9,10 @@ 取消置頂 執行查詢:{0} 上次執行時間:{0} + 打開 + 設置 + 关于 + 退出 Wox設置 diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index 4be961e7db..f300bf74d1 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -112,9 +112,13 @@ namespace Wox })); } - public void OpenSettingDialog() + public void OpenSettingDialog(string tabName = "general") { - Dispatcher.Invoke(new Action(() => WindowOpener.Open(this))); + Dispatcher.Invoke(new Action(() => + { + SettingWindow sw = SingletonWindowOpener.Open(this); + sw.SwitchTo(tabName); + })); } public void StartLoadingBar() @@ -190,7 +194,6 @@ namespace Wox WebRequest.RegisterPrefix("data", new DataWebRequestFactory()); GlobalHotkey.Instance.hookedKeyboardCallback += KListener_hookedKeyboardCallback; progressBar.ToolTip = toolTip; - InitialTray(); pnlResult.LeftMouseClickEvent += SelectResult; pnlResult.ItemDropEvent += pnlResult_ItemDropEvent; pnlContextMenu.LeftMouseClickEvent += SelectResult; @@ -201,6 +204,7 @@ namespace Wox SetHotkey(UserSettingStorage.Instance.Hotkey, OnHotkey); SetCustomPluginHotkey(); + InitialTray(); Closing += MainWindow_Closing; //since MainWIndow implement IPublicAPI, so we need to finish ctor MainWindow object before @@ -396,13 +400,15 @@ namespace Wox { notifyIcon = new NotifyIcon { Text = "Wox", Icon = Properties.Resources.app, Visible = true }; notifyIcon.Click += (o, e) => ShowWox(); - var open = new MenuItem("Open"); + var open = new MenuItem(GetTranslation("iconTrayOpen")); open.Click += (o, e) => ShowWox(); - var setting = new MenuItem("Settings"); + var setting = new MenuItem(GetTranslation("iconTraySettings")); setting.Click += (o, e) => OpenSettingDialog(); - var exit = new MenuItem("Exit"); + var about = new MenuItem(GetTranslation("iconTrayAbout")); + about.Click += (o, e) => OpenSettingDialog("about"); + var exit = new MenuItem(GetTranslation("iconTrayExit")); exit.Click += (o, e) => CloseApp(); - MenuItem[] childen = { open, setting, exit }; + MenuItem[] childen = { open, setting, about, exit }; notifyIcon.ContextMenu = new ContextMenu(childen); } diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs index fd4de93bee..b4b0e7b8ae 100644 --- a/Wox/SettingWindow.xaml.cs +++ b/Wox/SettingWindow.xaml.cs @@ -127,6 +127,31 @@ namespace Wox settingsLoaded = true; } + public void SwitchTo(string tabName) + { + switch (tabName) + { + case "general": + settingTab.SelectedIndex = 0; + break; + case "plugin": + settingTab.SelectedIndex = 1; + break; + case "theme": + settingTab.SelectedIndex = 2; + break; + case "hotkey": + settingTab.SelectedIndex = 3; + break; + case "proxy": + settingTab.SelectedIndex = 4; + break; + case "about": + settingTab.SelectedIndex = 5; + break; + } + } + #region General private void LoadLanguages() diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index 19b0992a31..e93a090615 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -122,6 +122,7 @@ + @@ -158,7 +159,6 @@ - CustomQueryHotkeySetting.xaml