private ExtendedNotifyIcon(Icon icon, string text, bool isMinerStudio) { _isMinerStudio = isMinerStudio; _targetNotifyIcon = new NotifyIcon { Icon = icon, Visible = isMinerStudio || NTMinerRoot.GetIsShowNotifyIcon(), Text = text, ContextMenu = new ContextMenu() }; _targetNotifyIcon.ContextMenu.MenuItems.Add(new MenuItem("退出" + text, (sender, e) => { VirtualRoot.Execute(new CloseNTMinerCommand()); })); _targetNotifyIcon.MouseDown += (object sender, MouseEventArgs e) => { if (e.Button == MouseButtons.Left) { VirtualRoot.Execute(new ShowMainWindowCommand(isToggle: true)); } }; }
private ExtendedNotifyIcon(Icon icon, string text, bool isMinerStudio) { _isMinerStudio = isMinerStudio; _targetNotifyIcon = new NotifyIcon { Icon = icon, Visible = isMinerStudio || NTMinerRoot.GetIsShowNotifyIcon(), Text = text, ContextMenuStrip = new ContextMenuStrip { BackColor = Color.White, ShowImageMargin = false } }; _targetNotifyIcon.ContextMenuStrip.Items.Add("退出" + text, null, (sender, e) => { VirtualRoot.Execute(new CloseNTMinerCommand()); }); _targetNotifyIcon.MouseDown += (object sender, MouseEventArgs e) => { if (e.Button == MouseButtons.Left) { VirtualRoot.Execute(new ShowMainWindowCommand(isToggle: true)); } }; }
public void RefreshIcon() { _targetNotifyIcon.Visible = _isMinerStudio || NTMinerRoot.GetIsShowNotifyIcon(); }