diff --git a/Plugins/Wox.Plugin.Caculator/Calculator.cs b/Plugins/Wox.Plugin.Caculator/Calculator.cs index da5e580a7b..0f6acdfcce 100644 --- a/Plugins/Wox.Plugin.Caculator/Calculator.cs +++ b/Plugins/Wox.Plugin.Caculator/Calculator.cs @@ -1,11 +1,13 @@ using System.Collections.Generic; +using System.IO; +using System.Reflection; using System.Text.RegularExpressions; using System.Windows; using YAMP; namespace Wox.Plugin.Caculator { - public class Calculator : IPlugin + public class Calculator : IPlugin, IPluginI18n { private static Regex regValidExpressChar = new Regex( @"^(" + @@ -87,5 +89,20 @@ namespace Wox.Plugin.Caculator { this.context = context; } + + public string GetLanguagesFolder() + { + return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages"); + } + + public string GetTranslatedPluginTitle() + { + return context.API.GetTranslation("wox_plugin_caculator_plugin_name"); + } + + public string GetTranslatedPluginDescription() + { + return context.API.GetTranslation("wox_plugin_caculator_plugin_description"); + } } } diff --git a/Plugins/Wox.Plugin.Caculator/Languages/en.xaml b/Plugins/Wox.Plugin.Caculator/Languages/en.xaml new file mode 100644 index 0000000000..a286f18f52 --- /dev/null +++ b/Plugins/Wox.Plugin.Caculator/Languages/en.xaml @@ -0,0 +1,8 @@ + + + Calculator + Provide mathematical calculations.(Try 5*3-2 in Wox) + + \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Caculator/Languages/zh-cn.xaml b/Plugins/Wox.Plugin.Caculator/Languages/zh-cn.xaml new file mode 100644 index 0000000000..34d3fb24e2 --- /dev/null +++ b/Plugins/Wox.Plugin.Caculator/Languages/zh-cn.xaml @@ -0,0 +1,8 @@ + + + 计算器 + 为Wox提供数学计算能力。(试着在Wox输入 5*3-2) + + \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Caculator/Languages/zh-tw.xaml b/Plugins/Wox.Plugin.Caculator/Languages/zh-tw.xaml new file mode 100644 index 0000000000..a0f1a68e77 --- /dev/null +++ b/Plugins/Wox.Plugin.Caculator/Languages/zh-tw.xaml @@ -0,0 +1,8 @@ + + + 計算器 + 為Wox提供數學計算能力。(試著在Wox輸入 5*3-2) + + \ 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 0a3f8ef910..f564925281 100644 --- a/Plugins/Wox.Plugin.Caculator/Wox.Plugin.Caculator.csproj +++ b/Plugins/Wox.Plugin.Caculator/Wox.Plugin.Caculator.csproj @@ -1,95 +1,116 @@ - - - - - Debug - AnyCPU - {59BD9891-3837-438A-958D-ADC7F91F6F7E} - Library - Properties - Wox.Plugin.Caculator - Wox.Plugin.Caculator - v3.5 - 512 - ..\..\ - true - - - - true - full - false - ..\..\Output\Debug\Plugins\Wox.Plugin.Caculator\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - ..\..\Output\Release\Plugins\Wox.Plugin.Caculator\ - TRACE - prompt - 4 - false - - - - - - - - - - - - False - ..\..\packages\YAMP.1.4.0\lib\net35\YAMP.dll - - - - - - - - - - PreserveNewest - - - - - {4fd29318-a8ab-4d8f-aa47-60bc241b8da3} - Wox.Infrastructure - - - {8451ecdd-2ea4-4966-bb0a-7bbc40138e80} - Wox.Plugin - - - - - PreserveNewest - - - - - - - 这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 - - - - - - - + + + + + Debug + AnyCPU + {59BD9891-3837-438A-958D-ADC7F91F6F7E} + Library + Properties + Wox.Plugin.Caculator + Wox.Plugin.Caculator + v3.5 + 512 + ..\..\ + true + + + + true + full + false + ..\..\Output\Debug\Plugins\Wox.Plugin.Caculator\ + DEBUG;TRACE + prompt + 4 + false + + + pdbonly + true + ..\..\Output\Release\Plugins\Wox.Plugin.Caculator\ + TRACE + prompt + 4 + false + + + + + + + + + + + + False + ..\..\packages\YAMP.1.4.0\lib\net35\YAMP.dll + + + + + + + + + + PreserveNewest + + + + + {4fd29318-a8ab-4d8f-aa47-60bc241b8da3} + Wox.Infrastructure + + + {8451ecdd-2ea4-4966-bb0a-7bbc40138e80} + Wox.Plugin + + + + + PreserveNewest + + + + + MSBuild:Compile + Designer + PreserveNewest + + + + + MSBuild:Compile + Designer + PreserveNewest + + + + + MSBuild:Compile + Designer + PreserveNewest + + + + + + + 这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 + + + + + + + + --> \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Color/Color.cs b/Plugins/Wox.Plugin.Color/Color.cs index 36581cca94..2dd5c6d83f 100644 --- a/Plugins/Wox.Plugin.Color/Color.cs +++ b/Plugins/Wox.Plugin.Color/Color.cs @@ -4,13 +4,15 @@ using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; +using System.Reflection; using System.Windows; namespace Wox.Plugin.Color { - public sealed class ColorsPlugin : IPlugin + public sealed class ColorsPlugin : IPlugin, IPluginI18n { private string DIR_PATH = Path.Combine(Path.GetTempPath(), @"Plugins\Colors\"); + private PluginInitContext context; private const int IMG_SIZE = 32; private DirectoryInfo ColorsDirectory { get; set; } @@ -103,6 +105,23 @@ namespace Wox.Plugin.Color public void Init(PluginInitContext context) { + this.context = context; + } + + + public string GetLanguagesFolder() + { + return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages"); + } + + public string GetTranslatedPluginTitle() + { + return context.API.GetTranslation("wox_plugin_color_plugin_name"); + } + + public string GetTranslatedPluginDescription() + { + return context.API.GetTranslation("wox_plugin_color_plugin_description"); } } } \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Color/Languages/en.xaml b/Plugins/Wox.Plugin.Color/Languages/en.xaml new file mode 100644 index 0000000000..b87a8ae8de --- /dev/null +++ b/Plugins/Wox.Plugin.Color/Languages/en.xaml @@ -0,0 +1,8 @@ + + + Colors + Provide hex color preview.(Try #000 in Wox) + + \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Color/Languages/zh-cn.xaml b/Plugins/Wox.Plugin.Color/Languages/zh-cn.xaml new file mode 100644 index 0000000000..32aa83ae8c --- /dev/null +++ b/Plugins/Wox.Plugin.Color/Languages/zh-cn.xaml @@ -0,0 +1,8 @@ + + + 颜色 + 提供在Wox查询hex颜色。(尝试在Wox中输入#000) + + \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Color/Languages/zh-tw.xaml b/Plugins/Wox.Plugin.Color/Languages/zh-tw.xaml new file mode 100644 index 0000000000..b76a9521a6 --- /dev/null +++ b/Plugins/Wox.Plugin.Color/Languages/zh-tw.xaml @@ -0,0 +1,7 @@ + + + 顏色 + 提供在Wox查詢hex顏色。(嘗試在Wox中輸入#000) + \ 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 81347e2f19..8a0428fad2 100644 --- a/Plugins/Wox.Plugin.Color/Wox.Plugin.Color.csproj +++ b/Plugins/Wox.Plugin.Color/Wox.Plugin.Color.csproj @@ -34,6 +34,7 @@ + @@ -62,6 +63,27 @@ Wox.Plugin + + + MSBuild:Compile + Designer + PreserveNewest + + + + + MSBuild:Compile + Designer + PreserveNewest + + + + + MSBuild:Compile + Designer + PreserveNewest + + + --> \ No newline at end of file diff --git a/Plugins/Wox.Plugin.PluginManagement/plugin.json b/Plugins/Wox.Plugin.PluginManagement/plugin.json index 173598b665..f07dcf4799 100644 --- a/Plugins/Wox.Plugin.PluginManagement/plugin.json +++ b/Plugins/Wox.Plugin.PluginManagement/plugin.json @@ -2,7 +2,7 @@ "ID":"D2D2C23B084D422DB66FE0C79D6C2A6A", "ActionKeyword":"wpm", "Name":"Wox Plugin Management", - "Description":"Manage your plugins in Wox", + "Description":"Install/Remove/Update wox plugins", "Author":"qianlifeng", "Version":"1.0", "Language":"csharp", diff --git a/Wox/SettingWindow.xaml b/Wox/SettingWindow.xaml index c44b71cc2d..92f9eb8eba 100644 --- a/Wox/SettingWindow.xaml +++ b/Wox/SettingWindow.xaml @@ -19,7 +19,7 @@ - + @@ -37,7 +37,7 @@ - + @@ -113,7 +113,7 @@ - + @@ -210,7 +210,7 @@ - + diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs index 8a33b19a35..1e8b2190b3 100644 --- a/Wox/SettingWindow.xaml.cs +++ b/Wox/SettingWindow.xaml.cs @@ -17,19 +17,25 @@ using Application = System.Windows.Forms.Application; using File = System.IO.File; using MessageBox = System.Windows.MessageBox; using System.Windows.Data; +using System.Windows.Forms; using Microsoft.Win32; using Wox.Core.i18n; using Wox.Core.Theme; using Wox.Core.Updater; using Wox.Core.UserSettings; +using CheckBox = System.Windows.Controls.CheckBox; +using Control = System.Windows.Controls.Control; +using Cursors = System.Windows.Input.Cursors; +using HorizontalAlignment = System.Windows.HorizontalAlignment; namespace Wox { public partial class SettingWindow : Window { - public MainWindow MainWindow; + public readonly MainWindow MainWindow; bool settingsLoaded = false; private Dictionary featureControls = new Dictionary(); + private bool themeTabLoaded = false; public SettingWindow(MainWindow mainWindow) { @@ -74,8 +80,208 @@ namespace Wox #endregion - #region Theme + #region Proxy + cbEnableProxy.Checked += (o, e) => EnableProxy(); + cbEnableProxy.Unchecked += (o, e) => DisableProxy(); + cbEnableProxy.IsChecked = UserSettingStorage.Instance.ProxyEnabled; + tbProxyServer.Text = UserSettingStorage.Instance.ProxyServer; + tbProxyPort.Text = UserSettingStorage.Instance.ProxyPort.ToString(); + tbProxyUserName.Text = UserSettingStorage.Instance.ProxyUserName; + tbProxyPassword.Password = UserSettingStorage.Instance.ProxyPassword; + if (UserSettingStorage.Instance.ProxyEnabled) + { + EnableProxy(); + } + else + { + DisableProxy(); + } + + #endregion + + #region About + + tbVersion.Text = UpdaterManager.Instance.CurrentVersion.ToString(); + string activateTimes = string.Format(InternationalizationManager.Instance.GetTranslation("about_activate_times"), + UserSettingStorage.Instance.ActivateTimes); + tbActivatedTimes.Text = activateTimes; + + #endregion + + settingsLoaded = true; + } + + #region General + + private void LoadLanguages() + { + cbLanguages.ItemsSource = InternationalizationManager.Instance.LoadAvailableLanguages(); + cbLanguages.DisplayMemberPath = "Display"; + cbLanguages.SelectedValuePath = "LanguageCode"; + cbLanguages.SelectedValue = UserSettingStorage.Instance.Language; + cbLanguages.SelectionChanged += cbLanguages_SelectionChanged; + } + + void cbLanguages_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + InternationalizationManager.Instance.ChangeLanguage(cbLanguages.SelectedItem as Language); + } + + private void CbStartWithWindows_OnChecked(object sender, RoutedEventArgs e) + { + AddApplicationToStartup(); + UserSettingStorage.Instance.StartWoxOnSystemStartup = true; + UserSettingStorage.Instance.Save(); + } + + private void CbStartWithWindows_OnUnchecked(object sender, RoutedEventArgs e) + { + RemoveApplicationFromStartup(); + UserSettingStorage.Instance.StartWoxOnSystemStartup = false; + UserSettingStorage.Instance.Save(); + } + + private void AddApplicationToStartup() + { + using (RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true)) + { + key.SetValue("Wox", "\"" + Application.ExecutablePath + "\" --hidestart"); + } + } + + private void RemoveApplicationFromStartup() + { + using (RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true)) + { + key.DeleteValue("Wox", false); + } + } + + private bool CheckApplicationIsStartupWithWindow() + { + using (RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true)) + { + return key.GetValue("Wox") != null; + } + } + + #endregion + + #region Hotkey + + void ctlHotkey_OnHotkeyChanged(object sender, System.EventArgs e) + { + if (ctlHotkey.CurrentHotkeyAvailable) + { + MainWindow.SetHotkey(ctlHotkey.CurrentHotkey.ToString(), delegate + { + if (!MainWindow.IsVisible) + { + MainWindow.ShowApp(); + } + else + { + MainWindow.HideApp(); + } + }); + MainWindow.RemoveHotkey(UserSettingStorage.Instance.Hotkey); + UserSettingStorage.Instance.Hotkey = ctlHotkey.CurrentHotkey.ToString(); + UserSettingStorage.Instance.Save(); + } + } + + + private void TabHotkey_OnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + var tabItem = sender as TabItem; + var clickingBody = (tabItem.Content as UIElement).IsMouseOver; + if (!clickingBody) + { + OnHotkeyTabSelected(); + } + } + + private void OnHotkeyTabSelected() + { + ctlHotkey.OnHotkeyChanged += ctlHotkey_OnHotkeyChanged; + ctlHotkey.SetHotkey(UserSettingStorage.Instance.Hotkey, false); + lvCustomHotkey.ItemsSource = UserSettingStorage.Instance.CustomPluginHotkeys; + } + + private void BtnDeleteCustomHotkey_OnClick(object sender, RoutedEventArgs e) + { + CustomPluginHotkey item = lvCustomHotkey.SelectedItem as CustomPluginHotkey; + if (item == null) + { + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem")); + return; + } + + string deleteWarning = string.Format(InternationalizationManager.Instance.GetTranslation("deleteCustomHotkeyWarning"), item.Hotkey); + if (MessageBox.Show(deleteWarning, InternationalizationManager.Instance.GetTranslation("delete"), MessageBoxButton.YesNo) == MessageBoxResult.Yes) + { + UserSettingStorage.Instance.CustomPluginHotkeys.Remove(item); + lvCustomHotkey.Items.Refresh(); + UserSettingStorage.Instance.Save(); + MainWindow.RemoveHotkey(item.Hotkey); + } + } + + private void BtnEditCustomHotkey_OnClick(object sender, RoutedEventArgs e) + { + CustomPluginHotkey item = lvCustomHotkey.SelectedItem as CustomPluginHotkey; + if (item != null) + { + CustomQueryHotkeySetting window = new CustomQueryHotkeySetting(this); + window.UpdateItem(item); + window.ShowDialog(); + } + else + { + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem")); + } + } + + private void BtnAddCustomeHotkey_OnClick(object sender, RoutedEventArgs e) + { + new CustomQueryHotkeySetting(this).ShowDialog(); + } + + public void ReloadCustomPluginHotkeyView() + { + lvCustomHotkey.Items.Refresh(); + } + + #endregion + + #region Theme + + private void tbMoreThemes_MouseUp(object sender, MouseButtonEventArgs e) + { + Process.Start("http://www.getwox.com/theme"); + } + + + private void CbOpacityMode_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + UserSettingStorage.Instance.OpacityMode = (OpacityMode)CbOpacityMode.SelectedItem; + UserSettingStorage.Instance.Save(); + + spOpacity.Visibility = UserSettingStorage.Instance.OpacityMode == OpacityMode.LayeredWindow ? Visibility.Visible : Visibility.Collapsed; + + if (UserSettingStorage.Instance.OpacityMode == OpacityMode.LayeredWindow) + PreviewMainPanel.Opacity = UserSettingStorage.Instance.Opacity; + else + PreviewMainPanel.Opacity = 1; + } + + + private void OnThemeTabSelected() + { + if (themeTabLoaded) return; + + themeTabLoaded = true; if (!string.IsNullOrEmpty(UserSettingStorage.Instance.QueryBoxFont) && Fonts.SystemFontFamilies.Count(o => o.FamilyNames.Values.Contains(UserSettingStorage.Instance.QueryBoxFont)) > 0) { @@ -175,196 +381,18 @@ namespace Wox //PreviewPanel ThemeManager.Theme.ChangeTheme(UserSettingStorage.Instance.Theme); - #endregion + } - #region Plugin - - ctlHotkey.OnHotkeyChanged += ctlHotkey_OnHotkeyChanged; - ctlHotkey.SetHotkey(UserSettingStorage.Instance.Hotkey, false); - lvCustomHotkey.ItemsSource = UserSettingStorage.Instance.CustomPluginHotkeys; - - var plugins = new CompositeCollection + private void TabTheme_OnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + var tabItem = sender as TabItem; + var clickingBody = (tabItem.Content as UIElement).IsMouseOver; + if (!clickingBody) { - new CollectionContainer - { - Collection = PluginManager.AllPlugins - } - }; - lbPlugins.ItemsSource = plugins; - lbPlugins.SelectedIndex = 0; - - #endregion - - #region Proxy - - cbEnableProxy.Checked += (o, e) => EnableProxy(); - cbEnableProxy.Unchecked += (o, e) => DisableProxy(); - cbEnableProxy.IsChecked = UserSettingStorage.Instance.ProxyEnabled; - tbProxyServer.Text = UserSettingStorage.Instance.ProxyServer; - tbProxyPort.Text = UserSettingStorage.Instance.ProxyPort.ToString(); - tbProxyUserName.Text = UserSettingStorage.Instance.ProxyUserName; - tbProxyPassword.Password = UserSettingStorage.Instance.ProxyPassword; - if (UserSettingStorage.Instance.ProxyEnabled) - { - EnableProxy(); - } - else - { - DisableProxy(); - } - - #endregion - - #region About - - tbVersion.Text = UpdaterManager.Instance.CurrentVersion.ToString(); - string activateTimes = string.Format(InternationalizationManager.Instance.GetTranslation("about_activate_times"), - UserSettingStorage.Instance.ActivateTimes); - tbActivatedTimes.Text = activateTimes; - - #endregion - - settingsLoaded = true; - } - - private void LoadLanguages() - { - cbLanguages.ItemsSource = InternationalizationManager.Instance.LoadAvailableLanguages(); - cbLanguages.DisplayMemberPath = "Display"; - cbLanguages.SelectedValuePath = "LanguageCode"; - cbLanguages.SelectedValue = UserSettingStorage.Instance.Language; - cbLanguages.SelectionChanged += cbLanguages_SelectionChanged; - } - - void cbLanguages_SelectionChanged(object sender, SelectionChangedEventArgs e) - { - InternationalizationManager.Instance.ChangeLanguage(cbLanguages.SelectedItem as Language); - } - - private void EnableProxy() - { - tbProxyPassword.IsEnabled = true; - tbProxyServer.IsEnabled = true; - tbProxyUserName.IsEnabled = true; - tbProxyPort.IsEnabled = true; - } - - private void DisableProxy() - { - tbProxyPassword.IsEnabled = false; - tbProxyServer.IsEnabled = false; - tbProxyUserName.IsEnabled = false; - tbProxyPort.IsEnabled = false; - } - - private void CbStartWithWindows_OnChecked(object sender, RoutedEventArgs e) - { - AddApplicationToStartup(); - UserSettingStorage.Instance.StartWoxOnSystemStartup = true; - UserSettingStorage.Instance.Save(); - } - - private void CbStartWithWindows_OnUnchecked(object sender, RoutedEventArgs e) - { - RemoveApplicationFromStartup(); - UserSettingStorage.Instance.StartWoxOnSystemStartup = false; - UserSettingStorage.Instance.Save(); - } - - private void AddApplicationToStartup() - { - using (RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true)) - { - key.SetValue("Wox", "\"" + Application.ExecutablePath + "\" --hidestart"); + OnThemeTabSelected(); } } - private void RemoveApplicationFromStartup() - { - using (RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true)) - { - key.DeleteValue("Wox", false); - } - } - - private bool CheckApplicationIsStartupWithWindow() - { - using (RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true)) - { - return key.GetValue("Wox") != null; - } - } - - void ctlHotkey_OnHotkeyChanged(object sender, System.EventArgs e) - { - if (ctlHotkey.CurrentHotkeyAvailable) - { - MainWindow.SetHotkey(ctlHotkey.CurrentHotkey.ToString(), delegate - { - if (!MainWindow.IsVisible) - { - MainWindow.ShowApp(); - } - else - { - MainWindow.HideApp(); - } - }); - MainWindow.RemoveHotkey(UserSettingStorage.Instance.Hotkey); - UserSettingStorage.Instance.Hotkey = ctlHotkey.CurrentHotkey.ToString(); - UserSettingStorage.Instance.Save(); - } - } - - #region Custom Plugin Hotkey - - private void BtnDeleteCustomHotkey_OnClick(object sender, RoutedEventArgs e) - { - CustomPluginHotkey item = lvCustomHotkey.SelectedItem as CustomPluginHotkey; - if (item == null) - { - MessageBox.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem")); - return; - } - - string deleteWarning = string.Format(InternationalizationManager.Instance.GetTranslation("deleteCustomHotkeyWarning"), item.Hotkey); - if (MessageBox.Show(deleteWarning, InternationalizationManager.Instance.GetTranslation("delete"), MessageBoxButton.YesNo) == MessageBoxResult.Yes) - { - UserSettingStorage.Instance.CustomPluginHotkeys.Remove(item); - lvCustomHotkey.Items.Refresh(); - UserSettingStorage.Instance.Save(); - MainWindow.RemoveHotkey(item.Hotkey); - } - } - - private void BtnEditCustomHotkey_OnClick(object sender, RoutedEventArgs e) - { - CustomPluginHotkey item = lvCustomHotkey.SelectedItem as CustomPluginHotkey; - if (item != null) - { - CustomQueryHotkeySetting window = new CustomQueryHotkeySetting(this); - window.UpdateItem(item); - window.ShowDialog(); - } - else - { - MessageBox.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem")); - } - } - - private void BtnAddCustomeHotkey_OnClick(object sender, RoutedEventArgs e) - { - new CustomQueryHotkeySetting(this).ShowDialog(); - } - - public void ReloadCustomPluginHotkeyView() - { - lvCustomHotkey.Items.Refresh(); - } - - #endregion - - #region Theme private void ThemeComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { string themeName = themeComboBox.SelectedItem.ToString(); @@ -452,18 +480,8 @@ namespace Wox } #endregion - private void CbOpacityMode_OnSelectionChanged(object sender, SelectionChangedEventArgs e) - { - UserSettingStorage.Instance.OpacityMode = (OpacityMode)CbOpacityMode.SelectedItem; - UserSettingStorage.Instance.Save(); + #region Plugin - spOpacity.Visibility = UserSettingStorage.Instance.OpacityMode == OpacityMode.LayeredWindow ? Visibility.Visible : Visibility.Collapsed; - - if (UserSettingStorage.Instance.OpacityMode == OpacityMode.LayeredWindow) - PreviewMainPanel.Opacity = UserSettingStorage.Instance.Opacity; - else - PreviewMainPanel.Opacity = 1; - } private void lbPlugins_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { @@ -473,7 +491,6 @@ namespace Wox if (pair != null) { - //third-party plugin provider = pair.Plugin as ISettingProvider; pluginAuthor.Visibility = Visibility.Visible; pluginActionKeyword.Visibility = Visibility.Visible; @@ -491,11 +508,6 @@ namespace Wox pluginId = pair.Metadata.ID; pluginIcon.Source = ImageLoader.ImageLoader.Load(pair.Metadata.FullIcoPath); } - else - { - //system plugin - provider = lbPlugins.SelectedItem as ISettingProvider; - } var customizedPluginConfig = UserSettingStorage.Instance.CustomizedPluginConfigs.FirstOrDefault(o => o.ID == pluginId); cbDisablePlugin.IsChecked = customizedPluginConfig != null && customizedPluginConfig.Disabled; @@ -611,11 +623,33 @@ namespace Wox Process.Start("http://www.getwox.com/plugin"); } - private void tbMoreThemes_MouseUp(object sender, MouseButtonEventArgs e) + private void OnPluginTabSelected() { - Process.Start("http://www.getwox.com/theme"); + var plugins = new CompositeCollection + { + new CollectionContainer + { + Collection = PluginManager.AllPlugins + } + }; + lbPlugins.ItemsSource = plugins; + lbPlugins.SelectedIndex = 0; } + private void TabPlugin_OnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + var tabItem = sender as TabItem; + var clickingBody = (tabItem.Content as UIElement).IsMouseOver; + if (!clickingBody) + { + OnPluginTabSelected(); + } + } + + + #endregion + + #region Proxy private void btnSaveProxy_Click(object sender, RoutedEventArgs e) { UserSettingStorage.Instance.ProxyEnabled = cbEnableProxy.IsChecked ?? false; @@ -698,9 +732,31 @@ namespace Wox } } + private void EnableProxy() + { + tbProxyPassword.IsEnabled = true; + tbProxyServer.IsEnabled = true; + tbProxyUserName.IsEnabled = true; + tbProxyPort.IsEnabled = true; + } + + private void DisableProxy() + { + tbProxyPassword.IsEnabled = false; + tbProxyServer.IsEnabled = false; + tbProxyUserName.IsEnabled = false; + tbProxyPort.IsEnabled = false; + } + + #endregion + + #region About + private void tbWebsite_MouseUp(object sender, MouseButtonEventArgs e) { Process.Start("http://www.getwox.com"); } + + #endregion } }