Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
Program.cs
Go to the documentation of this file.
1 #region License
2 /* **********************************************************************************
3  * Copyright (c) Roman Ivantsov
4  * This source code is subject to terms and conditions of the MIT License
5  * for Irony. A copy of the license can be found in the License.txt file
6  * at the root of this distribution.
7  * By using this source code in any fashion, you are agreeing to be bound by the terms of the
8  * MIT License.
9  * You must not remove this notice from this software.
10  * **********************************************************************************/
11 #endregion
12 
13 using System;
14 using System.Collections.Generic;
15 using System.Windows.Forms;
16 using System.Diagnostics;
17 
18 namespace Irony.GrammarExplorer {
19  class Program {
20  /// <summary>
21  /// The main entry point for the application.
22  /// </summary>
23  [STAThread]
24  static void Main() {
25  Application.EnableVisualStyles();
26  Application.SetCompatibleTextRenderingDefault(false);
27  Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
28  AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
29  Application.Run(new fmGrammarExplorer());
30  }
31 
32  static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) {
33  fmShowException.ShowException(e.Exception);
34  Debug.Write("Exception!: ############################################## \n" + e.Exception.ToString());
35  }
36 
37  static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) {
38  Exception ex = e.ExceptionObject as Exception;
39  string message = (ex == null ? e.ExceptionObject.ToString() : ex.Message);
40  if (ex == null) {
41  Debug.Write("Exception!: ############################################## \n" + e.ExceptionObject.ToString());
42  MessageBox.Show(message, "Exception");
43  } else {
44  fmShowException.ShowException(ex);
45  }
46  }
47 
48  }
49 }