mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 04:07:40 +02:00
Removed notify icon component
This commit is contained in:
@@ -27,7 +27,6 @@ namespace Wox
|
|||||||
|
|
||||||
private readonly Storyboard _progressBarStoryboard = new Storyboard();
|
private readonly Storyboard _progressBarStoryboard = new Storyboard();
|
||||||
private Settings _settings;
|
private Settings _settings;
|
||||||
private NotifyIcon _notifyIcon;
|
|
||||||
private MainViewModel _viewModel;
|
private MainViewModel _viewModel;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -46,14 +45,11 @@ namespace Wox
|
|||||||
|
|
||||||
private void OnClosing(object sender, CancelEventArgs e)
|
private void OnClosing(object sender, CancelEventArgs e)
|
||||||
{
|
{
|
||||||
_notifyIcon.Visible = false;
|
|
||||||
_viewModel.Save();
|
_viewModel.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInitialized(object sender, EventArgs e)
|
private void OnInitialized(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// show notify icon when wox is hided
|
|
||||||
InitializeNotifyIcon();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnLoaded(object sender, RoutedEventArgs _)
|
private void OnLoaded(object sender, RoutedEventArgs _)
|
||||||
@@ -85,13 +81,6 @@ namespace Wox
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
_settings.PropertyChanged += (o, e) =>
|
|
||||||
{
|
|
||||||
if (e.PropertyName == nameof(Settings.HideNotifyIcon))
|
|
||||||
{
|
|
||||||
_notifyIcon.Visible = !_settings.HideNotifyIcon;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
InitializePosition();
|
InitializePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,42 +92,6 @@ namespace Wox
|
|||||||
_settings.WindowLeft = Left;
|
_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()
|
private void InitProgressbarAnimation()
|
||||||
{
|
{
|
||||||
var da = new DoubleAnimation(ProgressBar.X2, ActualWidth + 100, new Duration(new TimeSpan(0, 0, 0, 0, 1600)));
|
var da = new DoubleAnimation(ProgressBar.X2, ActualWidth + 100, new Duration(new TimeSpan(0, 0, 0, 0, 1600)));
|
||||||
|
|||||||
Reference in New Issue
Block a user