Exemple #1
0
 public static void ReportErrorIf <T>(bool condition, ReportMechanism reportMechanism, string message, string title) where T : Exception
 {
     if (condition)
     {
         ReportError <T>(reportMechanism, message, title);
     }
 }
Exemple #2
0
        public static void ReportError <T>(ReportMechanism reportMechanism, string message, string title) where T : Exception
        {
            switch (reportMechanism)
            {
            case ReportMechanism.Console:
                System.Console.WriteLine(title + ": " + message);
                break;

            case ReportMechanism.Debug:
                System.Diagnostics.Debug.WriteLine(title + ": " + message);
                break;

            case ReportMechanism.Dialog:
                OSMessageBox.Show(message, title, OSMessageBoxButton.OK, OSMessageBoxIcon.Error);
                break;

            case ReportMechanism.Exception:
                throw (Exception)Activator.CreateInstance(typeof(T), message);
            }
        }
Exemple #3
0
 public static void ReportNotImplemented(ReportMechanism reportMechanism, string message)
 {
     ReportError <NotImplementedException>(reportMechanism, message, "Not Implemented");
 }
Exemple #4
0
 public static void ReportError(ReportMechanism reportMechanism, string message)
 {
     ReportError <Exception>(reportMechanism, message, "Error");
 }