static class Program private static MainForm _parentForm public static

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
static class Program
{
private static MainForm _parentForm;
public static MainForm ParentForm
{
get { return _parentForm; }
}
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.ThreadException += Application_ThreadException;
_parentForm = new MainForm();
MainFormPresenter presenter = new MainFormPresenter(_parentForm);
Application.Run(_parentForm);
}
private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
MessageBox.Show("There was an error running this application. Please try again. \nIf the problem persists, please contact the administrator", "Application Level Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
ErrorPresenter.LogError(e.Exception);
Application.Exit();
}
}