public static void Main(String[] args)
{
// Disallow multiple instances
if (FileUtils.IsACATRunning())
{
return;
}
Windows.TurnOffDPIAwareness();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
parseCommandLine(args);
var assembly = Assembly.GetExecutingAssembly();
// get appname and copyright information
object[] attributes = assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
var appName = (attributes.Length != 0)
? ((AssemblyTitleAttribute)attributes[0]).Title
: String.Empty;
var appVersion = string.Format( Resources.Version0, assembly.GetName().Version);
//attributes = assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
//var appCopyright = (attributes.Length != 0)
// ? ((AssemblyCopyrightAttribute)attributes[0]).Copyright
// : String.Empty;
var appCopyright = Resources.AssemblyCopyright.Replace("\\n", Environment.NewLine);
Log.Info("***** " + appName + ". " + appVersion + ". " + appCopyright + " *****");
CoreGlobals.AppGlobalPreferences =
GlobalPreferences.Load(FileUtils.GetPreferencesFileFullPath(GlobalPreferences.FileName));
//Set the active user/profile information
setUserName();
setProfileName();
//Create user and profile if they don't already exist
if (!createUserAndProfile())
{
return;
}
if (!loadUserPreferences())
{
return;
}
Log.SetupListeners();
if (!String.IsNullOrEmpty(_panelConfig))
{
Common.AppPreferences.PreferredPanelConfigNames = _panelConfig + ";" +
Common.AppPreferences.PreferredPanelConfigNames;
}
Splash splash = new Splash(FileUtils.GetImagePath("SplashScreenImage.png"), appName, appVersion, appCopyright, 1000);
splash.Show();
Context.PreInit();
Common.PreInit();
if (!Context.Init())
{
splash.Close();
splash = null;
TimedMessageBox.Show(Context.GetInitCompletionStatus());
if (Context.IsInitFatal())
{
return;
}
}
AuditLog.Audit(new AuditEvent("Application", "start"));
Context.ShowTalkWindowOnStartup = Common.AppPreferences.ShowTalkWindowOnStartup;
Context.AppAgentMgr.EnableContextualMenusForDialogs = Common.AppPreferences.EnableContextualMenusForDialogs;
Context.AppAgentMgr.EnableContextualMenusForMenus = Common.AppPreferences.EnableContextualMenusForMenus;
if (splash != null)
{
splash.Close();
}
if (!Context.PostInit())
{
MessageBox.Show(Context.GetInitCompletionStatus(), "Initialization Error");
return;
}
Common.Init();
try
{
Application.Run();
AuditLog.Audit(new AuditEvent("Application", "stop"));
Context.Dispose();
Common.Uninit();
//Utils.Dispose();
Log.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}