diff --git a/src/modules/launcher/Wox.Plugin/IPublicAPI.cs b/src/modules/launcher/Wox.Plugin/IPublicAPI.cs
index 754b76d36b..72e400e26e 100644
--- a/src/modules/launcher/Wox.Plugin/IPublicAPI.cs
+++ b/src/modules/launcher/Wox.Plugin/IPublicAPI.cs
@@ -83,11 +83,6 @@ namespace Wox.Plugin
/// Message icon path (relative path to your plugin folder)
void ShowMsg(string title, string subTitle = "", string iconPath = "", bool useMainWindowAsOwner = true);
- ///
- /// Open setting dialog
- ///
- void OpenSettingDialog();
-
///
/// Show loading animation
///
diff --git a/src/modules/launcher/Wox/App.xaml.cs b/src/modules/launcher/Wox/App.xaml.cs
index 0fc1e8c95e..f6dcc8ee2f 100644
--- a/src/modules/launcher/Wox/App.xaml.cs
+++ b/src/modules/launcher/Wox/App.xaml.cs
@@ -94,13 +94,6 @@ namespace Wox
private void AutoStartup()
{
- if (_settings.StartWoxOnSystemStartup)
- {
- if (!SettingWindow.StartupSet())
- {
- SettingWindow.SetStartup();
- }
- }
}
//[Conditional("RELEASE")]
diff --git a/src/modules/launcher/Wox/CustomQueryHotkeySetting.xaml b/src/modules/launcher/Wox/CustomQueryHotkeySetting.xaml
deleted file mode 100644
index a4e3d77f69..0000000000
--- a/src/modules/launcher/Wox/CustomQueryHotkeySetting.xaml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/modules/launcher/Wox/CustomQueryHotkeySetting.xaml.cs b/src/modules/launcher/Wox/CustomQueryHotkeySetting.xaml.cs
deleted file mode 100644
index f5ce9cabf3..0000000000
--- a/src/modules/launcher/Wox/CustomQueryHotkeySetting.xaml.cs
+++ /dev/null
@@ -1,129 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Windows;
-using NHotkey;
-using NHotkey.Wpf;
-using Wox.Core.Resource;
-using Wox.Infrastructure.Hotkey;
-using Wox.Infrastructure.UserSettings;
-
-namespace Wox
-{
- public partial class CustomQueryHotkeySetting : Window
- {
- private SettingWindow _settingWidow;
- private bool update;
- private CustomPluginHotkey updateCustomHotkey;
- private Settings _settings;
-
- public CustomQueryHotkeySetting(SettingWindow settingWidow, Settings settings)
- {
- _settingWidow = settingWidow;
- InitializeComponent();
- _settings = settings;
- }
-
- private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
- {
- Close();
- }
-
- private void btnAdd_OnClick(object sender, RoutedEventArgs e)
- {
- if (!update)
- {
- if (!ctlHotkey.CurrentHotkeyAvailable)
- {
- MessageBox.Show(InternationalizationManager.Instance.GetTranslation("hotkeyIsNotUnavailable"));
- return;
- }
-
- if (_settings.CustomPluginHotkeys == null)
- {
- _settings.CustomPluginHotkeys = new ObservableCollection();
- }
-
- var pluginHotkey = new CustomPluginHotkey
- {
- Hotkey = ctlHotkey.CurrentHotkey.ToString(),
- ActionKeyword = tbAction.Text
- };
- _settings.CustomPluginHotkeys.Add(pluginHotkey);
-
- SetHotkey(ctlHotkey.CurrentHotkey, delegate
- {
- App.API.ChangeQuery(pluginHotkey.ActionKeyword);
- Application.Current.MainWindow.Visibility = Visibility.Visible;
- });
- MessageBox.Show(InternationalizationManager.Instance.GetTranslation("success"));
- }
- else
- {
- if (updateCustomHotkey.Hotkey != ctlHotkey.CurrentHotkey.ToString() && !ctlHotkey.CurrentHotkeyAvailable)
- {
- MessageBox.Show(InternationalizationManager.Instance.GetTranslation("hotkeyIsNotUnavailable"));
- return;
- }
- var oldHotkey = updateCustomHotkey.Hotkey;
- updateCustomHotkey.ActionKeyword = tbAction.Text;
- updateCustomHotkey.Hotkey = ctlHotkey.CurrentHotkey.ToString();
- //remove origin hotkey
- RemoveHotkey(oldHotkey);
- SetHotkey(new HotkeyModel(updateCustomHotkey.Hotkey), delegate
- {
- App.API.ChangeQuery(updateCustomHotkey.ActionKeyword);
- Application.Current.MainWindow.Visibility = Visibility.Visible;
- });
- MessageBox.Show(InternationalizationManager.Instance.GetTranslation("success"));
- }
-
- Close();
- }
-
- public void UpdateItem(CustomPluginHotkey item)
- {
- updateCustomHotkey = _settings.CustomPluginHotkeys.FirstOrDefault(o => o.ActionKeyword == item.ActionKeyword && o.Hotkey == item.Hotkey);
- if (updateCustomHotkey == null)
- {
- MessageBox.Show(InternationalizationManager.Instance.GetTranslation("invalidPluginHotkey"));
- Close();
- return;
- }
-
- tbAction.Text = updateCustomHotkey.ActionKeyword;
- ctlHotkey.SetHotkey(updateCustomHotkey.Hotkey, false);
- update = true;
- lblAdd.Text = InternationalizationManager.Instance.GetTranslation("update");
- }
-
- private void BtnTestActionKeyword_OnClick(object sender, RoutedEventArgs e)
- {
- App.API.ChangeQuery(tbAction.Text);
- Application.Current.MainWindow.Visibility = Visibility.Visible;
- }
-
- private void RemoveHotkey(string hotkeyStr)
- {
- if (!string.IsNullOrEmpty(hotkeyStr))
- {
- HotkeyManager.Current.Remove(hotkeyStr);
- }
- }
-
- private void SetHotkey(HotkeyModel hotkey, EventHandler action)
- {
- string hotkeyStr = hotkey.ToString();
- try
- {
- HotkeyManager.Current.AddOrReplace(hotkeyStr, hotkey.CharKey, hotkey.ModifierKeys, action);
- }
- catch (Exception)
- {
- string errorMsg = string.Format(InternationalizationManager.Instance.GetTranslation("registerHotkeyFailed"), hotkeyStr);
- MessageBox.Show(errorMsg);
- }
- }
- }
-}
diff --git a/src/modules/launcher/Wox/MainWindow.xaml.cs b/src/modules/launcher/Wox/MainWindow.xaml.cs
index 427f641a4e..e0ee4ef3f5 100644
--- a/src/modules/launcher/Wox/MainWindow.xaml.cs
+++ b/src/modules/launcher/Wox/MainWindow.xaml.cs
@@ -16,7 +16,6 @@ using DataFormats = System.Windows.DataFormats;
using DragEventArgs = System.Windows.DragEventArgs;
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
using MessageBox = System.Windows.MessageBox;
-using NotifyIcon = System.Windows.Forms.NotifyIcon;
namespace Wox
{
@@ -27,7 +26,6 @@ namespace Wox
private readonly Storyboard _progressBarStoryboard = new Storyboard();
private Settings _settings;
- private NotifyIcon _notifyIcon;
private MainViewModel _viewModel;
#endregion
@@ -46,14 +44,11 @@ namespace Wox
private void OnClosing(object sender, CancelEventArgs e)
{
- _notifyIcon.Visible = false;
_viewModel.Save();
}
private void OnInitialized(object sender, EventArgs e)
{
- // show notify icon when wox is hided
- InitializeNotifyIcon();
}
private void OnLoaded(object sender, RoutedEventArgs _)
@@ -85,13 +80,6 @@ namespace Wox
}
}
};
- _settings.PropertyChanged += (o, e) =>
- {
- if (e.PropertyName == nameof(Settings.HideNotifyIcon))
- {
- _notifyIcon.Visible = !_settings.HideNotifyIcon;
- }
- };
InitializePosition();
}
@@ -103,42 +91,6 @@ namespace Wox
_settings.WindowLeft = Left;
}
- private void InitializeNotifyIcon()
- {
- _notifyIcon = new NotifyIcon
- {
- Text = Infrastructure.Constant.Wox,
- Icon = Properties.Resources.app,
- Visible = !_settings.HideNotifyIcon
- };
- var menu = new ContextMenuStrip();
- var items = menu.Items;
-
- var open = items.Add(InternationalizationManager.Instance.GetTranslation("iconTrayOpen"));
- open.Click += (o, e) => Visibility = Visibility.Visible;
- var setting = items.Add(InternationalizationManager.Instance.GetTranslation("iconTraySettings"));
- setting.Click += (o, e) => App.API.OpenSettingDialog();
- var exit = items.Add(InternationalizationManager.Instance.GetTranslation("iconTrayExit"));
- exit.Click += (o, e) => Close();
-
- _notifyIcon.ContextMenuStrip = menu;
- _notifyIcon.MouseClick += (o, e) =>
- {
- if (e.Button == MouseButtons.Left)
- {
- if (menu.Visible)
- {
- menu.Close();
- }
- else
- {
- var p = System.Windows.Forms.Cursor.Position;
- menu.Show(p);
- }
- }
- };
- }
-
private void InitProgressbarAnimation()
{
var da = new DoubleAnimation(ProgressBar.X2, ActualWidth + 100, new Duration(new TimeSpan(0, 0, 0, 0, 1600)));
@@ -205,10 +157,8 @@ namespace Wox
private void OnContextMenusForSettingsClick(object sender, RoutedEventArgs e)
{
- App.API.OpenSettingDialog();
}
-
private void OnDeactivated(object sender, EventArgs e)
{
if (_settings.HideWhenDeactive)
diff --git a/src/modules/launcher/Wox/PublicAPIInstance.cs b/src/modules/launcher/Wox/PublicAPIInstance.cs
index 58915f87b2..21057a78e9 100644
--- a/src/modules/launcher/Wox/PublicAPIInstance.cs
+++ b/src/modules/launcher/Wox/PublicAPIInstance.cs
@@ -106,14 +106,6 @@ namespace Wox
});
}
- public void OpenSettingDialog()
- {
- Application.Current.Dispatcher.Invoke(() =>
- {
- SettingWindow sw = SingletonWindowOpener.Open(this, _settingsVM);
- });
- }
-
public void StartLoadingBar()
{
_mainVM.ProgressBarVisibility = Visibility.Visible;
diff --git a/src/modules/launcher/Wox/SettingWindow.xaml b/src/modules/launcher/Wox/SettingWindow.xaml
deleted file mode 100644
index 1eddd8ab6a..0000000000
--- a/src/modules/launcher/Wox/SettingWindow.xaml
+++ /dev/null
@@ -1,402 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/modules/launcher/Wox/SettingWindow.xaml.cs b/src/modules/launcher/Wox/SettingWindow.xaml.cs
deleted file mode 100644
index 52addf3628..0000000000
--- a/src/modules/launcher/Wox/SettingWindow.xaml.cs
+++ /dev/null
@@ -1,293 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Input;
-using System.Windows.Navigation;
-using Microsoft.Win32;
-using NHotkey;
-using NHotkey.Wpf;
-using Wox.Core;
-using Wox.Core.Plugin;
-using Wox.Core.Resource;
-using Wox.Infrastructure.Hotkey;
-using Wox.Infrastructure.UserSettings;
-using Wox.Plugin;
-using Wox.ViewModel;
-
-namespace Wox
-{
- public partial class SettingWindow
- {
- private const string StartupPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
-
- public readonly IPublicAPI _api;
- private Settings _settings;
- private SettingWindowViewModel _viewModel;
-
- public SettingWindow(IPublicAPI api, SettingWindowViewModel viewModel)
- {
- InitializeComponent();
- _settings = viewModel.Settings;
- DataContext = viewModel;
- _viewModel = viewModel;
- _api = api;
- }
-
- #region General
-
- void OnLanguageChanged(object sender, SelectionChangedEventArgs e)
- {
- var language = (Language)e.AddedItems[0];
- InternationalizationManager.Instance.ChangeLanguage(language);
- }
-
- private void OnAutoStartupChecked(object sender, RoutedEventArgs e)
- {
- SetStartup();
- }
-
- private void OnAutoStartupUncheck(object sender, RoutedEventArgs e)
- {
- RemoveStartup();
- }
-
- public static void SetStartup()
- {
- using (var key = Registry.CurrentUser.OpenSubKey(StartupPath, true))
- {
- key?.SetValue(Infrastructure.Constant.Wox, Infrastructure.Constant.ExecutablePath);
- }
- }
-
- private void RemoveStartup()
- {
- using (var key = Registry.CurrentUser.OpenSubKey(StartupPath, true))
- {
- key?.DeleteValue(Infrastructure.Constant.Wox, false);
- }
- }
-
- public static bool StartupSet()
- {
- using (var key = Registry.CurrentUser.OpenSubKey(StartupPath, true))
- {
- var path = key?.GetValue(Infrastructure.Constant.Wox) as string;
- if (path != null)
- {
- return path == Infrastructure.Constant.ExecutablePath;
- }
- else
- {
- return false;
- }
- }
- }
-
- private void OnSelectPythonDirectoryClick(object sender, RoutedEventArgs e)
- {
- var dlg = new System.Windows.Forms.FolderBrowserDialog
- {
- SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
- };
-
- var result = dlg.ShowDialog();
- if (result == System.Windows.Forms.DialogResult.OK)
- {
- string pythonDirectory = dlg.SelectedPath;
- if (!string.IsNullOrEmpty(pythonDirectory))
- {
- var pythonPath = Path.Combine(pythonDirectory, PluginsLoader.PythonExecutable);
- if (File.Exists(pythonPath))
- {
- _settings.PluginSettings.PythonDirectory = pythonDirectory;
- MessageBox.Show("Remember to restart Wox use new Python path");
- }
- else
- {
- MessageBox.Show("Can't find python in given directory");
- }
- }
- }
- }
-
- #endregion
-
- #region Hotkey
-
- private void OnHotkeyControlLoaded(object sender, RoutedEventArgs e)
- {
- HotkeyControl.SetHotkey(_viewModel.Settings.Hotkey, false);
- }
-
- void OnHotkeyChanged(object sender, EventArgs e)
- {
- if (HotkeyControl.CurrentHotkeyAvailable)
- {
- SetHotkey(HotkeyControl.CurrentHotkey, (o, args) =>
- {
- if (!Application.Current.MainWindow.IsVisible)
- {
- Application.Current.MainWindow.Visibility = Visibility.Visible;
- }
- else
- {
- Application.Current.MainWindow.Visibility = Visibility.Hidden;
- }
- });
- RemoveHotkey(_settings.Hotkey);
- _settings.Hotkey = HotkeyControl.CurrentHotkey.ToString();
- }
- }
-
- void SetHotkey(HotkeyModel hotkey, EventHandler action)
- {
- string hotkeyStr = hotkey.ToString();
- try
- {
- HotkeyManager.Current.AddOrReplace(hotkeyStr, hotkey.CharKey, hotkey.ModifierKeys, action);
- }
- catch (Exception)
- {
- string errorMsg =
- string.Format(InternationalizationManager.Instance.GetTranslation("registerHotkeyFailed"), hotkeyStr);
- MessageBox.Show(errorMsg);
- }
- }
-
- void RemoveHotkey(string hotkeyStr)
- {
- if (!string.IsNullOrEmpty(hotkeyStr))
- {
- HotkeyManager.Current.Remove(hotkeyStr);
- }
- }
-
- private void OnDeleteCustomHotkeyClick(object sender, RoutedEventArgs e)
- {
- var item = _viewModel.SelectedCustomPluginHotkey;
- 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)
- {
- _settings.CustomPluginHotkeys.Remove(item);
- RemoveHotkey(item.Hotkey);
- }
- }
-
- private void OnnEditCustomHotkeyClick(object sender, RoutedEventArgs e)
- {
- var item = _viewModel.SelectedCustomPluginHotkey;
- if (item != null)
- {
- CustomQueryHotkeySetting window = new CustomQueryHotkeySetting(this, _settings);
- window.UpdateItem(item);
- window.ShowDialog();
- }
- else
- {
- MessageBox.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
- }
- }
-
- private void OnAddCustomeHotkeyClick(object sender, RoutedEventArgs e)
- {
- new CustomQueryHotkeySetting(this, _settings).ShowDialog();
- }
-
- #endregion
-
- #region Plugin
-
- private void OnPluginToggled(object sender, RoutedEventArgs e)
- {
- var id = _viewModel.SelectedPlugin.PluginPair.Metadata.ID;
- // used to sync the current status from the plugin manager into the setting to keep consistency after save
- _settings.PluginSettings.Plugins[id].Disabled = _viewModel.SelectedPlugin.PluginPair.Metadata.Disabled;
- }
-
- private void OnPluginActionKeywordsClick(object sender, MouseButtonEventArgs e)
- {
- if (e.ChangedButton == MouseButton.Left)
- {
- var id = _viewModel.SelectedPlugin.PluginPair.Metadata.ID;
- ActionKeywords changeKeywordsWindow = new ActionKeywords(id, _settings);
- changeKeywordsWindow.ShowDialog();
- }
- }
-
- private void OnPluginNameClick(object sender, MouseButtonEventArgs e)
- {
- if (e.ChangedButton == MouseButton.Left)
- {
- var website = _viewModel.SelectedPlugin.PluginPair.Metadata.Website;
- if (!string.IsNullOrEmpty(website))
- {
- var uri = new Uri(website);
- if (Uri.CheckSchemeName(uri.Scheme))
- {
- Process.Start(website);
- }
- }
- }
- }
-
- private void OnPluginDirecotyClick(object sender, MouseButtonEventArgs e)
- {
- if (e.ChangedButton == MouseButton.Left)
- {
- var directory = _viewModel.SelectedPlugin.PluginPair.Metadata.PluginDirectory;
- if (!string.IsNullOrEmpty(directory) && Directory.Exists(directory))
- {
- Process.Start(directory);
- }
- }
- }
- #endregion
-
- #region Proxy
-
- private void OnTestProxyClick(object sender, RoutedEventArgs e)
- { // TODO: change to command
- var msg = _viewModel.TestProxy();
- MessageBox.Show(msg); // TODO: add message box service
- }
-
- #endregion
-
- private async void OnCheckUpdates(object sender, RoutedEventArgs e)
- {
- _viewModel.UpdateApp(); // TODO: change to command
- }
-
- private void OnRequestNavigate(object sender, RequestNavigateEventArgs e)
- {
- Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
- e.Handled = true;
- }
-
- private void OnClosed(object sender, EventArgs e)
- {
- _viewModel.Save();
- PluginManager.Save();
- }
-
- private void OnCloseExecuted(object sender, ExecutedRoutedEventArgs e)
- {
- Close();
- }
- }
-}