9 |
|
using System.Windows.Forms; |
10 |
|
using System.Runtime.InteropServices; |
11 |
|
using System.IO; |
12 |
< |
using System.Data.SqlClient; // For File operations |
12 |
> |
using System.Data.SqlClient; |
13 |
> |
using System.Security.Permissions; // For File operations |
14 |
|
|
15 |
|
|
16 |
|
public partial class frmAdmin : Form |
25 |
|
public frmAdmin() |
26 |
|
{ |
27 |
|
InitializeComponent(); |
28 |
< |
} |
28 |
< |
|
29 |
< |
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) |
30 |
< |
{ |
31 |
< |
Exception ex = (e.ExceptionObject as Exception); |
32 |
< |
if (ex == null) |
33 |
< |
{ |
34 |
< |
Logging.ATSAdminLog.Error("Encountered unhandled Exception, but the exception was null"); |
35 |
< |
return; |
36 |
< |
} |
37 |
< |
if (ex.GetType() == typeof(SqlException)) |
38 |
< |
{ |
39 |
< |
SqlException sql_ex = (ex as SqlException); |
40 |
< |
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()))) |
41 |
< |
{ |
42 |
< |
Logging.ATSAdminLog.Error("Encountered unhandled SqlException"); |
43 |
< |
} |
44 |
< |
} |
45 |
< |
else |
46 |
< |
{ |
47 |
< |
using (log4net.NDC.Push(string.Format("Exception: MESSAGE={0}{1}Diagnostics:{1}{2}", ex.Message, System.Environment.NewLine, ex.ToString()))) |
48 |
< |
{ |
49 |
< |
Logging.ATSAdminLog.Error("Encountered unhandled Exception"); |
50 |
< |
} |
51 |
< |
} |
52 |
< |
} |
28 |
> |
} |
29 |
|
|
30 |
|
private void frmAdmin_Load(object sender, EventArgs e) |
31 |
|
{ |
738 |
|
|
739 |
|
|
740 |
|
// Configure AnywhereTS |
741 |
< |
// Run first time starting ATS and can also be invoked from the Tools menu. |
741 |
> |
// Run first time starting ATS and can also be invoked from the Tools menu. |
742 |
|
private bool ConfigureATS() |
743 |
|
{ |
744 |
< |
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); |
744 |
> |
|
745 |
|
DialogResult result; |
746 |
|
|
747 |
|
if (!ProSupport.IsAnAdministrator()) |