Example #1
0
        /// <summary>
        /// Loads app global preferences
        /// </summary>
        public static void LoadGlobalSettings()
        {
            GlobalPreferences.PreferencesFilePath        = FileUtils.GetFullPathRelativeToApp("Settings.xml");
            GlobalPreferences.DefaultPreferencesFilePath = FileUtils.GetFullPathRelativeToApp("DefaultSettings.xml");

            CoreGlobals.AppGlobalPreferences = GlobalPreferences.Load();
        }
Example #2
0
        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();

            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());
            }
        }
Example #3
0
        public static void Main(String[] args)
        {
            //Disallow multiple instances
            if (FileUtils.IsACATRunning())
            {
                return;
            }

            Windows.TurnOffDPIAwareness();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            parseCommandLine(args);

            // get appname and copyright information
            var assembly = Assembly.GetExecutingAssembly();

            object[] attributes = assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
            var      appName    = (attributes.Length != 0) ? ((AssemblyTitleAttribute)attributes[0]).Title : String.Empty;

            var appVersion = string.Format(ACATTryout.Properties.Resources.Version0, assembly.GetName().Version);
            //attributes = assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
            //var appCopyright = (attributes.Length != 0) ? ((AssemblyCopyrightAttribute)attributes[0]).Copyright : String.Empty;
            var appCopyright = ACATTryout.Properties.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();

            Context.PreInit();
            Common.PreInit();

            try
            {
                if (!Context.Init(Context.StartupFlags.Minimal | Context.StartupFlags.TextToSpeech))
                {
                    MessageBox.Show("Context initialization error");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Context Init exception " + ex);
                return;
            }

            if (!Context.PostInit())
            {
                MessageBox.Show(Context.GetInitCompletionStatus(), "Initialization Error");
                return;
            }

            Common.Init();

            var formName = String.IsNullOrEmpty(_formName) ? "ACATTryoutForm" : _formName;
            var form     = PanelManager.Instance.CreatePanel(formName);

            if (form != null)
            {
                Context.AppPanelManager.Show(null, form as IPanel);
            }
            else
            {
                MessageBox.Show("Invalid form name " + form, "Error");
                return;
            }

            try
            {
                Application.Run();

                Context.Dispose();

                Common.Uninit();

                //Utils.Dispose();

                Log.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Example #4
0
        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();

            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());
            }
        }
Example #5
0
        public static void Main(String[] args)
        {
            //Disallow multiple instances
            if (FileUtils.CheckAppExistingInstance("ACATMutex"))
            {
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // get appname and copyright information
            var assembly = Assembly.GetExecutingAssembly();

            object[] attributes = assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
            var      appName    = (attributes.Length != 0) ? ((AssemblyTitleAttribute)attributes[0]).Title : String.Empty;

            var appVersion = "Version " + assembly.GetName().Version.ToString();

            attributes = assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
            var appCopyright = (attributes.Length != 0) ? ((AssemblyCopyrightAttribute)attributes[0]).Copyright : String.Empty;

            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();

            Context.PreInit();
            Common.PreInit();

            try
            {
                if (!Context.Init(Context.StartupFlags.Minimal))
                {
                    MessageBox.Show("Context initialization error");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Context Init exception " + ex);
                return;
            }

            Common.Init();

            var form = PanelManager.Instance.CreatePanel("ACATGettingStartedForm");

            if (form != null)
            {
                Context.AppPanelManager.Show(null, form as IPanel);
            }
            try
            {
                Application.Run();

                Context.Dispose();

                Common.Uninit();

                //Utils.Dispose();

                Log.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }