SECI  1
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events
Program.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.Windows.Forms;
4 using System.Diagnostics;
5 
6 namespace Sample_Environment_Control_Interface
7 {
8  static class Program
9  {
13  [STAThread]
14  static void Main()
15  {
16  Application.EnableVisualStyles();
17  Application.SetCompatibleTextRenderingDefault(false);
18 
19  //Allow only one instance
20  Process ThisProcess = Process.GetCurrentProcess();
21  Process[] AllProcesses = Process.GetProcessesByName(ThisProcess.ProcessName);
22  if (AllProcesses.Length == 1)
23  {
24  Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
25  Application.Run(new SECI_GUI());
26  }
27  }
28 
29  static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
30  {
31  Properties.Settings.Default.Crashed = true;
32  Properties.Settings.Default.Save();
33  MessageBox.Show("SECI has had to close. We apologise for the inconvenience.", "Fatal Error", MessageBoxButtons.OK);
34  Seci.SeciInterface.Error_LogError("Fatal Error", e.Exception);
35  Application.Exit();
36  }
37  }
38 }
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
Definition: Program.cs:29
static void Main()
The main entry point for the application.
Definition: Program.cs:14