public static int Main() { Console.WriteLine("Starting NeuroRighter at (" + DateTime.Now.ToShortDateString() + " at " + DateTime.Now.ToShortTimeString() + ")"); Type reflectedClass = typeof(NeuroRighter); using (Process p = Process.GetCurrentProcess()) p.PriorityClass = ProcessPriorityClass.RealTime; Thread thrd = Thread.CurrentThread; // Set application data path Properties.Settings.Default.neurorighterAppDataPath = Path.Combine(Environment.GetFolderPath( Environment.SpecialFolder.ApplicationData), "NeuroRighter"); // persist window path Properties.Settings.Default.persistWindowPath = Path.Combine(Properties.Settings.Default.neurorighterAppDataPath, "WindowState.xml"); thrd.Priority = ThreadPriority.AboveNormal; try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new NeuroRighter()); } //Using reflection, you invoke a method that generates an exception. //You want to obtain the real exception object and its information in order to diagnose and fix the problem. //The real exception and its information can be obtained through the InnerException property of //the TargetInvocationException exception that is thrown by MethodInfo.Invoke. -J.N. catch (Exception startEx) { MessageBox.Show("Error starting NeuroRighter: " + startEx, "NeuroRighter Start-Up Error"); Debug.ExecptDBG startErrorHandler = new Debug.ExecptDBG(); startErrorHandler.DisplayInnerException(startEx, reflectedClass); return(-1); } return(0); }
public static int Main() { Console.WriteLine("Starting NeuroRighter at (" + DateTime.Now.ToShortDateString() + " at " + DateTime.Now.ToShortTimeString() + ")"); Type reflectedClass = typeof(NeuroRighter); using (Process p = Process.GetCurrentProcess()) p.PriorityClass = ProcessPriorityClass.RealTime; Thread thrd = Thread.CurrentThread; // Set application data path Properties.Settings.Default.neurorighterAppDataPath = Path.Combine(Environment.GetFolderPath( Environment.SpecialFolder.ApplicationData) , "NeuroRighter"); // persist window path Properties.Settings.Default.persistWindowPath = Path.Combine(Properties.Settings.Default.neurorighterAppDataPath, "WindowState.xml"); thrd.Priority = ThreadPriority.AboveNormal; try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new NeuroRighter()); } //Using reflection, you invoke a method that generates an exception. //You want to obtain the real exception object and its information in order to diagnose and fix the problem. //The real exception and its information can be obtained through the InnerException property of //the TargetInvocationException exception that is thrown by MethodInfo.Invoke. -J.N. catch (Exception startEx) { MessageBox.Show("Error starting NeuroRighter: " + startEx, "NeuroRighter Start-Up Error"); Debug.ExecptDBG startErrorHandler = new Debug.ExecptDBG(); startErrorHandler.DisplayInnerException(startEx, reflectedClass); return -1; } return 0; }