87 lines
3.0 KiB
C#
87 lines
3.0 KiB
C#
using System;
|
|
using System.Windows.Forms;
|
|
using System.Threading;
|
|
using SafeMobileLib;
|
|
using SafeMobileLib.Helpers;
|
|
|
|
namespace SetupProj
|
|
{
|
|
static class Program
|
|
{
|
|
public static String COMPANY = "SafeMobile";
|
|
/// <summary>
|
|
/// The main entry point for the application.
|
|
/// </summary>
|
|
static String filename = "";
|
|
[STAThread()]
|
|
static void Main(string[] args)
|
|
{
|
|
|
|
Console.Title = "SetupProjConsole";
|
|
|
|
#if DEBUG
|
|
MainForm.radioType = RADIOTYPE.MOTO;
|
|
#elif HARRIS
|
|
MainForm.radioType = RADIOTYPE.HARRIS;
|
|
#elif ATLAS
|
|
MainForm.radioType = RADIOTYPE.ATLAS;
|
|
#elif HYTERA
|
|
MainForm.radioType = RADIOTYPE.HYT;
|
|
#elif MOTOROLA
|
|
MainForm.radioType = RADIOTYPE.MOTO;
|
|
#elif SIMOCO
|
|
MainForm.radioType = RADIOTYPE.SIMOCO;
|
|
COMPANY = "Simoco";
|
|
#elif LINX
|
|
MainForm.radioType = RADIOTYPE.LINX;
|
|
#elif LINXB
|
|
MainForm.radioType = RADIOTYPE.LINXB;
|
|
#elif EXCERA
|
|
MainForm.radioType = RADIOTYPE.EXCERA;
|
|
#elif LISF
|
|
MainForm.radioType = RADIOTYPE.LISF;
|
|
#endif
|
|
|
|
|
|
// parse the command line args
|
|
CommandLineHelper clh = new CommandLineHelper(args, Console.Title);
|
|
|
|
// update the configuration type if additonal was passed as a command line arg
|
|
if (clh.ConfigurationType != RADIOTYPE.UNKNOWN)
|
|
MainForm.radioType = clh.ConfigurationType;
|
|
|
|
|
|
Application.EnableVisualStyles();
|
|
Application.SetCompatibleTextRenderingDefault(false);
|
|
|
|
if (!AppDomain.CurrentDomain.FriendlyName.EndsWith("vshost.exe"))
|
|
{
|
|
Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
|
|
|
|
// Set the unhandled exception mode to force all Windows Forms errors
|
|
// to go through our handler.
|
|
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
|
|
|
|
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
|
|
}
|
|
|
|
|
|
Application.Run(new EULA()/*new MainForm()*/);
|
|
}
|
|
|
|
static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
|
|
{
|
|
//MessageBox.Show(e.Exception.Message, "ThreadException Dispatch.Please restart the application.");
|
|
Utils.WriteLine("Application_ThreadException: " + e.Exception.ToString(), ConsoleColor.Red);
|
|
// here you can log the exception ...
|
|
}
|
|
|
|
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
|
{
|
|
//MessageBox.Show((e.ExceptionObject as Exception).Message, "Unhandled UI Exception Dispatch.Please restart the application.");
|
|
Utils.WriteLine("CurrentDomain_UnhandledException: " + e.ToString(), ConsoleColor.Red);
|
|
// here you can log the exception ...
|
|
}
|
|
}
|
|
}
|