/// <summary> /// This method communicates to the user that a fatal error occurred. /// /// First, it displays msg param to the user via the msg label, /// followed by directing the user to err.log to view the details /// of the error. /// /// This method also writes to the err.log file in the program's /// directory, and then terminates the process after sleeping for /// the duration of the message being displayed to the user. /// </summary> /// <param name="msg">brief explanation of the fatal error</param> /// <param name="msgExtended">error msg explained in more detail</param> /// <param name="solutions">possible solution(s) that the user could implement</param> public static void Fatal(string msg, string msgExtended, string solutions) { // set string that will be written to err.log string log = "Date: " + DateTime.Now.ToString() + Environment.NewLine + "Abstract: " + msg + Environment.NewLine + "Log: " + msgExtended + Environment.NewLine + "Possible solution(s): " + solutions + Environment.NewLine; // append log string to err.log, creating the file if it doesn't exist using (StreamWriter sw = MsgLabel.errLogFile.AppendText()) { sw.WriteLine(log); } // send fatal error message to user MsgLabel.SendMsg("***FATAL*** " + msg + "; see err.log for details."); // sleep for the duration of msg being displayed Thread.Sleep(MsgLabel.timer.Interval); // terminate the process Application.Exit(); }
public static void Warn(string msg) { // send warning message to user MsgLabel.SendMsg("***WARNING*** " + msg); }
public static void Normal(string msg) { // send normal message to user MsgLabel.SendMsg(msg); }