private void CreateTempRuleNotifyIcon(CustomRule newRule) { if (!tempRules_.Contains(newRule)) { tempRules_.Add(newRule); } if (tempNotifyIcon_ is null) { // tray icon for temporary rule WinForms::NotifyIcon ni = new WinForms::NotifyIcon(); ni.Click += iconClick; // shown in message center on win10 ni.BalloonTipIcon = WinForms::ToolTipIcon.Info; ni.BalloonTipTitle = Common.Properties.Resources.RULE_TEMP_TITLE; ni.BalloonTipText = Messages.RULE_TEMP_DESCRIPTION; // tooltip shown on tray icon ni.Text = Messages.RULE_TEMP_DESCRIPTION_SHORT; // limit 64 chars on win10 ni.Icon = new Icon(SystemIcons.Shield, new System.Drawing.Size(16, 16)); ni.Visible = true; ni.ShowBalloonTip(2000); ni.Visible = true; tempNotifyIcon_ = ni; } }
private void CreateTempRuleNotifyIcon(CustomRule newRule) { if (!tempRules_.Contains(newRule)) { tempRules_.Add(newRule); } if (tempNotifyIcon_ is null) { void iconClick(object sender, EventArgs e) { if (!RemoveTempRulesAndNotfyIcon()) { WinForms::MessageBox.Show(Messages.MSG_RULE_RM_FAILED, Messages.MSG_DLG_ERR_TITLE, WinForms::MessageBoxButtons.OK, WinForms::MessageBoxIcon.Error); } } // tray icon for temporary rule WinForms::NotifyIcon ni = new WinForms::NotifyIcon(); ni.Click += new EventHandler(iconClick); // shown in message center on win10 ni.BalloonTipIcon = WinForms::ToolTipIcon.Info; ni.BalloonTipTitle = Common.Properties.Resources.RULE_TEMP_TITLE; ni.BalloonTipText = Messages.RULE_TEMP_DESCRIPTION; // tooltip shown on tray icon ni.Text = Messages.RULE_TEMP_DESCRIPTION_SHORT; // limit 64 chars on win10 ni.Icon = new Icon(SystemIcons.Shield, new System.Drawing.Size(16, 16)); ni.Visible = true; ni.ShowBalloonTip(2000); ni.Visible = true; tempNotifyIcon_ = ni; } }