Initial commit
This commit is contained in:
49
BMS_D1000/Program.cs
Normal file
49
BMS_D1000/Program.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace BMS_D1000H
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[MTAThread]
|
||||
static void Main()
|
||||
{
|
||||
try
|
||||
{
|
||||
// AppDomain Unhandled Exception Handler for .NET Compact Framework
|
||||
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
|
||||
|
||||
Application.Run(new fmBMSMain());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandleFatalException(ex, "Main Exception");
|
||||
}
|
||||
}
|
||||
|
||||
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
Exception ex = e.ExceptionObject as Exception;
|
||||
HandleFatalException(ex, "Domain UnhandledException");
|
||||
}
|
||||
|
||||
private static void HandleFatalException(Exception ex, string source)
|
||||
{
|
||||
string msg = string.Format("[{0}] Error: {1}", source, ex != null ? ex.Message : "Unknown Error");
|
||||
System.Diagnostics.Debug.WriteLine(msg);
|
||||
try
|
||||
{
|
||||
MessageBox.Show(msg, "System Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore if MessageBox cannot be displayed
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user