6 |
|
using System.Text; |
7 |
|
using System.Windows.Forms; |
8 |
|
using System.Data.SqlClient; |
9 |
+ |
using System.Security.Permissions; |
10 |
|
|
11 |
|
namespace AnywhereTS |
12 |
|
{ |
16 |
|
{ |
17 |
|
InitializeComponent(); |
18 |
|
} |
18 |
– |
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) |
19 |
– |
{ |
20 |
– |
Exception ex = (e.ExceptionObject as Exception); |
21 |
– |
if (ex == null) |
22 |
– |
{ |
23 |
– |
Logging.TSControlPanelLog.Error("Encountered unhandled Exception, but the exception was null"); |
24 |
– |
return; |
25 |
– |
} |
26 |
– |
if (ex.GetType() == typeof(SqlException)) |
27 |
– |
{ |
28 |
– |
SqlException sql_ex = (ex as SqlException); |
29 |
– |
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()))) |
30 |
– |
{ |
31 |
– |
Logging.TSControlPanelLog.Error("Encountered unhandled SqlException"); |
32 |
– |
} |
33 |
– |
} |
34 |
– |
else |
35 |
– |
{ |
36 |
– |
using (log4net.NDC.Push(string.Format("Exception: MESSAGE={0}{1}Diagnostics:{1}{2}", ex.Message, System.Environment.NewLine, ex.ToString()))) |
37 |
– |
{ |
38 |
– |
Logging.TSControlPanelLog.Error("Encountered unhandled Exception"); |
39 |
– |
} |
40 |
– |
} |
41 |
– |
} |
19 |
|
|
20 |
|
public enum ATSClientMode //The modes that this form can be started in. |
21 |
|
{ EDIT_CLIENT, // Normal mode edit a client (only admins) |
41 |
|
|
42 |
|
bool changedByUser = true; // Used on some checkbox controls to determine if state was changed by user or code. |
43 |
|
|
44 |
< |
|
44 |
> |
|
45 |
|
private void frmClientProperties_Load(object sender, EventArgs e) |
46 |
|
{ |
70 |
– |
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); |
47 |
|
//this.Cursor = Cursors.WaitCursor; |
48 |
|
changedByUser = false; // To prevent the some controls from triggering changed event. |
49 |
|
|