mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-14 11:39:16 +08:00
320f78b31b
1. remove this 2. auto property should be only 1 line 3. misc 4. part of refactoring for PR #494
41 lines
1.4 KiB
C#
41 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using Wox.Core.Resource;
|
|
using Wox.Plugin;
|
|
|
|
namespace Wox
|
|
{
|
|
public class NotifyIconManager
|
|
{
|
|
|
|
private NotifyIcon notifyIcon;
|
|
private IPublicAPI _api;
|
|
|
|
public NotifyIconManager(IPublicAPI api)
|
|
{
|
|
InitialTray();
|
|
_api = api;
|
|
}
|
|
|
|
private void InitialTray()
|
|
{
|
|
notifyIcon = new NotifyIcon { Text = "Wox", Icon = Properties.Resources.app, Visible = true };
|
|
notifyIcon.Click += (o, e) => _api.ShowApp();
|
|
var open = new MenuItem(InternationalizationManager.Instance.GetTranslation("iconTrayOpen"));
|
|
open.Click += (o, e) => _api.ShowApp();
|
|
var setting = new MenuItem(InternationalizationManager.Instance.GetTranslation("iconTraySettings"));
|
|
setting.Click += (o, e) => _api.OpenSettingDialog();
|
|
var about = new MenuItem(InternationalizationManager.Instance.GetTranslation("iconTrayAbout"));
|
|
about.Click += (o, e) => _api.OpenSettingDialog("about");
|
|
var exit = new MenuItem(InternationalizationManager.Instance.GetTranslation("iconTrayExit"));
|
|
exit.Click += (o, e) => _api.CloseApp();
|
|
MenuItem[] childen = { open, setting, about, exit };
|
|
notifyIcon.ContextMenu = new ContextMenu(childen);
|
|
}
|
|
}
|
|
}
|