public static void Main(String[] args) { // Disallow multiple instances if (FileUtils.CheckAppExistingInstance("ACATMutex")) { return; } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); 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 = "Version " + assembly.GetName().Version; attributes = assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); var appCopyright = (attributes.Length != 0) ? ((AssemblyCopyrightAttribute)attributes[0]).Copyright : String.Empty; Log.Info("***** " + appName + ". " + appVersion + ". " + appCopyright + " *****"); parseCommandLine(args); 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(); // Display splash screen and initialize Splash splash = new Splash(FileUtils.GetImagePath("SplashScreenImage.png"), appName, appVersion, appCopyright, 5000); 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; Context.PostInit(); if (splash != null) { splash.Close(); } 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()); } }
public static void Main(String[] args) { // Disallow multiple instances if (FileUtils.IsACATRunning()) { return; } Windows.TurnOffDPIAwareness(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); 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 = "Version " + assembly.GetName().Version; attributes = assembly.GetCustomAttributes(typeof (AssemblyCopyrightAttribute), false); var appCopyright = (attributes.Length != 0) ? ((AssemblyCopyrightAttribute) attributes[0]).Copyright : String.Empty; Log.Info("***** " + appName + ". " + appVersion + ". " + appCopyright + " *****"); parseCommandLine(args); 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(); Splash splash = new Splash(FileUtils.GetImagePath("SplashScreenImage.png"), appName, appVersion, appCopyright, 1000); splash.Show(); Context.PreInit(); Common.PreInit(); Context.AppAgentMgr.EnableAppAgentContextSwitch = false; if (!Context.Init(Context.StartupFlags.Minimal | Context.StartupFlags.TextToSpeech | Context.StartupFlags.WordPrediction | Context.StartupFlags.AgentManager | Context.StartupFlags.WindowsActivityMonitor | Context.StartupFlags.Abbreviations)) { splash.Close(); splash = null; TimedMessageBox.Show(Context.GetInitCompletionStatus()); if (Context.IsInitFatal()) { return; } } AuditLog.Audit(new AuditEvent("Application", "start")); Context.ShowTalkWindowOnStartup = false; Context.AppAgentMgr.EnableContextualMenusForDialogs = false; Context.AppAgentMgr.EnableContextualMenusForMenus = false; Context.AppAgentMgr.DefaultAgentForContextSwitchDisable = Context.AppAgentMgr.NullAgent; if (splash != null) { splash.Close(); } if (!Context.PostInit()) { MessageBox.Show(Context.GetInitCompletionStatus(), "Initialization Error"); return; } Common.Init(); Context.AppWindowPosition = Windows.WindowPosition.CenterScreen; var formName = String.IsNullOrEmpty(_formName) ? "TalkApplicationScanner" : _formName; var form = PanelManager.Instance.CreatePanel(formName); if (form != null) { // Add ad-hoc agent that will handle the form IApplicationAgent agent = new TalkAppAgent(); Context.AppAgentMgr.AddAgent(form.Handle, agent); Context.AppPanelManager.Show(form as IPanel); } else { MessageBox.Show("Invalid form name " + form, "Error"); return; } try { Application.Run(); AuditLog.Audit(new AuditEvent("Application", "stop")); Context.Dispose(); Common.Uninit(); //Utils.Dispose(); Log.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }