/[AnywhereTS-MSSQL]/trunk/TSControlPanel/Program.cs
ViewVC logotype

Diff of /trunk/TSControlPanel/Program.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4 by william, Wed Jul 11 14:19:13 2012 UTC revision 53 by william, Thu Jul 12 16:30:29 2012 UTC
# Line 1  Line 1 
1  using System;  using System;
2  using System.Collections.Generic;  using System.Collections.Generic;
3  using System.Windows.Forms;  using System.Windows.Forms;
4    using System.Data.SqlClient;
5    
6  namespace AnywhereTS  namespace AnywhereTS
7  {  {
# Line 12  namespace AnywhereTS Line 13  namespace AnywhereTS
13          [STAThread]          [STAThread]
14          static void Main()          static void Main()
15          {          {
16                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
17              Application.EnableVisualStyles();              Application.EnableVisualStyles();
18              Application.SetCompatibleTextRenderingDefault(false);              Application.SetCompatibleTextRenderingDefault(false);
19    
# Line 19  namespace AnywhereTS Line 21  namespace AnywhereTS
21              objCustomDialogBox.dialogMode = frmClientProperties.ATSClientMode.CONTROL_PANEL; // Select the mode to run the form in.              objCustomDialogBox.dialogMode = frmClientProperties.ATSClientMode.CONTROL_PANEL; // Select the mode to run the form in.
22              Application.Run(objCustomDialogBox);                          Application.Run(objCustomDialogBox);            
23          }          }
24            static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
25            {
26                Exception ex = (e.ExceptionObject as Exception);
27                if (ex == null)
28                {
29                    Logging.TSControlPanelLog.Error("Encountered unhandled Exception, but the exception was null");
30                    return;
31                }
32                if (e.ExceptionObject.GetType() == typeof(SqlException))
33                {
34                    SqlException sql_ex = (ex as SqlException);
35                    using (log4net.NDC.Push(string.Format("SqlException: ID={0} MESSAGE={1}{2}Diagnostics:{2}{3}", sql_ex.Number.ToString(), sql_ex.Message, System.Environment.NewLine, sql_ex.ToString())))
36                    {
37                        Logging.TSControlPanelLog.Error("Encountered unhandled SqlException");
38                    }
39                }
40                else
41                {
42                    using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", ex.Message, System.Environment.NewLine, ex.ToString())))
43                    {
44                        Logging.TSControlPanelLog.Error("Encountered unhandled Exception");
45                    }
46                }
47            }
48      }      }
49  }  }

Legend:
Removed from v.4  
changed lines
  Added in v.53

  ViewVC Help
Powered by ViewVC 1.1.22