public void showAlert(Alert alert, string[] args) { switch (alert.AlertId) { case 6: Reboot reboot = new Reboot(alert.TipTitle, alert.TipText); reboot.Show(); break; default: notifyIcon1.ShowBalloonTip(balloonTimeout, alert.TipTitle, String.Format(alert.TipText, args), alert.TipIcon); break; } }
//public void fireAlertMethod(Alert alert) //{ // if (alert != null) // { // if (alert.Reboot == false) // { // try // { // notifyIcon1.ShowBalloonTip(balloonTimeout, alert.TipTitle, alert.TipText, alert.TipIcon); // } // catch (Exception ex) // { // log.Error(ex); // log.Error("Malformed alert data for alert ID " + alert.AlertId); // MessageBox.Show("Malformed alert data for alert ID " + alert.AlertId); // } // } // else // { // Reboot reboot = new Reboot(alert.TipTitle, alert.TipText); // reboot.Show(); // } // } // else // { // log.Error("Alert ID " + alert.AlertId + " not found."); // } //} public void showAlert(Alert alert, Array alertParams) { switch (alert.AlertId) { //NOTE: You can stack cases, e.g. //case 0: case 1: notifyIcon1.ShowBalloonTip(balloonTimeout, alert.TipTitle, String.Format(alert.TipText, (string)alertParams.GetValue(2)), //Display disk % free alert.TipIcon); break; case 6: Reboot reboot = new Reboot(alert.TipTitle, alert.TipText); reboot.Show(); break; default: notifyIcon1.ShowBalloonTip(balloonTimeout, alert.TipTitle, alert.TipText, alert.TipIcon); break; } }