9 |
using System.Windows.Forms; |
using System.Windows.Forms; |
10 |
using System.Runtime.InteropServices; |
using System.Runtime.InteropServices; |
11 |
using System.IO; |
using System.IO; |
12 |
using System.Data.SqlClient; // For File operations |
using System.Data.SqlClient; |
13 |
|
using System.Security.Permissions; // For File operations |
14 |
|
|
15 |
|
|
16 |
public partial class frmAdmin : Form |
public partial class frmAdmin : Form |
24 |
private string selectedClientMacAddress; // The MAC address of the currently selected client. |
private string selectedClientMacAddress; // The MAC address of the currently selected client. |
25 |
public frmAdmin() |
public frmAdmin() |
26 |
{ |
{ |
27 |
InitializeComponent(); |
InitializeComponent(); |
28 |
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); |
} |
|
} |
|
|
|
|
|
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) |
|
|
{ |
|
|
Exception ex = (e.ExceptionObject as Exception); |
|
|
if (ex == null) |
|
|
{ |
|
|
Logging.ATSAdminLog.Error("Encountered unhandled Exception, but the exception was null"); |
|
|
return; |
|
|
} |
|
|
if (ex.GetType() == typeof(SqlException)) |
|
|
{ |
|
|
SqlException sql_ex = (ex as SqlException); |
|
|
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()))) |
|
|
{ |
|
|
Logging.ATSAdminLog.Error("Encountered unhandled SqlException"); |
|
|
} |
|
|
} |
|
|
else |
|
|
{ |
|
|
using (log4net.NDC.Push(string.Format("Exception: MESSAGE={0}{1}Diagnostics:{1}{2}", ex.Message, System.Environment.NewLine, ex.ToString()))) |
|
|
{ |
|
|
Logging.ATSAdminLog.Error("Encountered unhandled Exception"); |
|
|
} |
|
|
} |
|
|
} |
|
29 |
|
|
30 |
private void frmAdmin_Load(object sender, EventArgs e) |
private void frmAdmin_Load(object sender, EventArgs e) |
31 |
{ |
{ |
32 |
this.Cursor = Cursors.WaitCursor; |
//this.Cursor = Cursors.WaitCursor; |
33 |
|
|
34 |
UpdateControlsToReflectProgramVersion(); |
UpdateControlsToReflectProgramVersion(); |
35 |
|
|
609 |
} |
} |
610 |
else |
else |
611 |
{ |
{ |
612 |
throw new Exception("Error: Cannot find record to delete (43556)"); |
string error = string.Format("Error: Cannot find record to delete (43556) for mac address: {0}", selectedClientMacAddress); |
613 |
|
using (log4net.NDC.Push(string.Format("MacAddress={0}", selectedClientMacAddress))) |
614 |
|
{ |
615 |
|
Logging.ATSAdminLog.Error(error); |
616 |
|
} |
617 |
|
MessageBox.Show(string.Format("{0} -> {1}", error, string.Format("MacAddress={0}", selectedClientMacAddress))); |
618 |
|
return; |
619 |
} |
} |
620 |
} |
} |
621 |
} |
} |
744 |
|
|
745 |
|
|
746 |
// Configure AnywhereTS |
// Configure AnywhereTS |
747 |
// Run first time starting ATS and can also be invoked from the Tools menu. |
// Run first time starting ATS and can also be invoked from the Tools menu. |
748 |
private bool ConfigureATS() |
private bool ConfigureATS() |
749 |
{ |
{ |
750 |
|
|
751 |
DialogResult result; |
DialogResult result; |
752 |
|
|
753 |
if (!ProSupport.IsAnAdministrator()) |
if (!ProSupport.IsAnAdministrator()) |