Example #1
0
 public static void ReportError(Exception ex, bool displayMessage, LogLevel level)
 {
     //Report an exception to the user
     try {
         string src = (ex.Source != null) ? ex.Source + "-\n" : "";
         string msg = src + ex.Message;
         if (ex.InnerException != null)
         {
             if ((ex.InnerException.Source != null))
             {
                 src = ex.InnerException.Source + "-\n";
             }
             msg = src + ex.Message + "\n\n NOTE: " + ex.InnerException.Message;
         }
         if (displayMessage)
         {
             MessageBox.Show(msg, App.Product, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         if (level != LogLevel.None)
         {
             ArgixTrace.WriteLine(new TraceMessage(ex.ToString(), App.EventLogName, level));
         }
     }
     catch (Exception) { }
 }
Example #2
0
 //Interface
 static App()
 {
     //Class constructor: get application configuration
     try {
         Mediator.SqlCommandTimeout = int.Parse(global::Argix.Properties.Settings.Default.SQLCommandTimeout);
         _Mediator      = new SQLMediator(global::Argix.Properties.ArgixSettings.Default.SQLConnection);
         _ConfigFactory = new ConfigFactory(App.Product);
         _Config        = (Config)_ConfigFactory.Item(new string[] { Environment.UserName, Environment.MachineName });
         ArgixTrace.AddListener(new DBTraceListener((LogLevel)_Config.TraceLevel, _Mediator, "uspLogEntryNew", "Argix08"));
     }
     catch (Exception ex) { ReportError(ex); Application.Exit(); }
 }
Example #3
0
 //Interface
 static App()
 {
     //Class constructor: get application configuration
     try {
         //Mediator.SqlCommandTimeout = global::Argix.Properties.Settings.Default.SQLCommandTimeout;
         _Mediator      = new SQLMediator(global::Argix.Properties.Settings.Default.SQLConnection);
         _ConfigFactory = new ConfigFactory(App.Product);
         _Config        = (Config)_ConfigFactory.Item(new string[] { Environment.UserName, Environment.MachineName });
         ArgixTrace.AddListener(new DBTraceListener((LogLevel)App.Config.TraceLevel, App.Mediator, App.USP_TRACE, App.EventLogName));
     }
     catch (Exception ex) { ReportError(ex, true, LogLevel.Error); Application.Exit(); }
 }
Example #4
0
 public static void Trace(string message, LogLevel level)
 {
     //Trace
     ArgixTrace.WriteLine(new TraceMessage(message, App.Product, level));
 }
Example #5
0
 //Interface
 /// <summary>Constructor</summary>
 public winTrace()
 {
     //Constructor
     InitializeComponent();
     ArgixTrace.AddListener(new ArgixTextBoxListener(LogLevel.Debug, this.txtTrace));
 }