private ExtendedNotifyIcon(Icon icon, string text, bool isMinerStudio) { _isMinerStudio = isMinerStudio; _targetNotifyIcon = new NotifyIcon { Icon = icon, Visible = isMinerStudio || NTMinerRegistry.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)); } }; }
public void RefreshIcon() { _targetNotifyIcon.Visible = _isMinerStudio || NTMinerRegistry.GetIsShowNotifyIcon(); }