예제 #1
0
        internal static void show(int sanity_failures)
        {
            GameObject      go  = new GameObject("TweakScale.WarningBox");
            TimedMessageBox dlg = go.AddComponent <TimedMessageBox>();

            GUIStyle win  = createWinStyle();
            GUIStyle text = createTextStyle();

            dlg.Show(
                "TweakScale Warning",
                String.Format(MSG, sanity_failures),
                30, 1, -1,
                win, text
                );
            Log.detail("\"TweakScale Warning\" about sanity checks was displayed");
        }
예제 #2
0
        internal static void show(int overrule_count)
        {
            GameObject      go  = new GameObject("TweakScale.AdviseBox");
            TimedMessageBox dlg = go.AddComponent <TimedMessageBox>();

            GUIStyle win  = createWinStyle(Color.white);
            GUIStyle text = createTextStyle();

            dlg.Show(
                "TweakScale advises",
                String.Format(MSG, overrule_count),
                30, 0, -1,
                win, text
                );
            Log.detail("\"TweakScale advises\" about overrules checks was displayed");
        }
        internal static void Show(string currentVersion)
        {
            GameObject      go  = new GameObject("TweakScale.AdviseBox");
            TimedMessageBox dlg = go.AddComponent <TimedMessageBox>();

            GUIStyle win  = createWinStyle(Color.white);
            GUIStyle text = createTextStyle();

            dlg.Show(
                "TweakScale advises",
                string.Format(MSG, currentVersion),
                30, 0, 0,
                win, text
                );
            Log.force("\"TweakScale advises\" about KSP was displayed.");
        }
예제 #4
0
        /// <summary>
        /// Actually does the logging.
        /// </summary>
        /// <param name="logMessage"></param>
        private static void writeLogEntry(string logMessage = "Please run this program with the GUI to create settings file first", EventLogEntryType level = EventLogEntryType.Warning, DestinationType destination = DestinationType.EventLog)
        {
            appLog.Log    = "Application";
            appLog.Source = "KSL.Cars.App";
            try
            {
                switch (destination)
                {
                case DestinationType.EventLog:
                    appLog.WriteEntry(logMessage, level);
                    break;

                case DestinationType.MessageBox:

                    MessageBoxIcon temp;

                    switch (level)
                    {
                    case EventLogEntryType.Error:
                        temp = MessageBoxIcon.Error;
                        break;

                    case EventLogEntryType.Information:
                        temp = MessageBoxIcon.Information;
                        break;

                    //We don't really expect to have Failure and Success Audit event types,
                    //but they are listed here for completeness.
                    case EventLogEntryType.FailureAudit:
                    case EventLogEntryType.SuccessAudit:
                    case EventLogEntryType.Warning:
                    default:
                        temp = MessageBoxIcon.Warning;
                        break;
                    }

                    MessageBox.Show(logMessage, "", MessageBoxButtons.OK, temp);
                    break;
                }
            }
            catch (System.Security.SecurityException ex)
            {
                TimedMessageBox.Show("Please run this application as administrator once to allow logging to the event log:\n\n" + ex.Message, "Run as Admin", MessageBoxButtons.OK, MessageBoxIcon.Warning, 5000);
            }
        }
        internal static void show(int check_failures)
        {
            GameObject      go  = new GameObject("TweakScale.WarningBox");
            TimedMessageBox dlg = go.AddComponent <TimedMessageBox>();

            GUIStyle win  = createWinStyle(Color.yellow);
            GUIStyle text = createTextStyle();

            if (ModuleManagerListener.shouldShowWarnings)
            {
                dlg.Show(
                    "TweakScale Warning",
                    String.Format(MSG, check_failures),
                    30, 1, 1,
                    win, text
                    );
            }
            Log.force("\"TweakScale Warning\" about check failures was {0}", ModuleManagerListener.shouldShowWarnings ? "displayed" : "suppressed");
        }
예제 #6
0
        internal static void show(int overrule_count)
        {
            GameObject      go  = new GameObject("TweakScale.AdviseBox");
            TimedMessageBox dlg = go.AddComponent <TimedMessageBox>();

            GUIStyle win  = createWinStyle(Color.white);
            GUIStyle text = createTextStyle();

            if (ModuleManagerListener.shouldShowWarnings)
            {
                dlg.Show(
                    "TweakScale advises",
                    String.Format(MSG, overrule_count),
                    30, 0, -1,
                    win, text
                    );
            }
            Log.force("\"TweakScale advises\" about overrules checks was {0}", ModuleManagerListener.shouldShowWarnings ? "displayed" : "suppressed");
        }
예제 #7
0
파일: Program.cs 프로젝트: weberjavi/acat
        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());
            }
        }
예제 #8
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());
            }
        }
예제 #9
0
파일: Program.cs 프로젝트: zezo010/acat
        public static void Main(String[] args)
        {
            if (AppCommon.OtherInstancesRunning())
            {
                return;
            }

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

            FileUtils.LogAssemblyInfo();

            parseCommandLine(args);

            AppCommon.LoadGlobalSettings();

            AppCommon.SetUserName();
            AppCommon.SetProfileName();

            if (!AppCommon.CreateUserAndProfile())
            {
                return;
            }

            if (!AppCommon.LoadUserPreferences())
            {
                return;
            }

            Common.AppPreferences.AppId   = "ACATTalk";
            Common.AppPreferences.AppName = "ACAT Talk";

            if (!AppCommon.SetCulture())
            {
                return;
            }

            Log.SetupListeners();

            CommandDescriptors.Init();

            setSwitchMapCommands();

            Common.AppPreferences.PreferredPanelConfigNames = !String.IsNullOrEmpty(_panelConfig) ? _panelConfig : "TalkApplicationABC";

            Splash splash = new Splash(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(), R.GetString("InitializationError"));
                return;
            }

            Common.Init();

            Context.AppWindowPosition = Windows.WindowPosition.CenterScreen;

            try
            {
                var form = PanelManager.Instance.CreatePanel("TalkApplicationScanner");
                if (form != null)
                {
                    // Add ad-hoc agent that will handle the form
                    IApplicationAgent agent = Context.AppAgentMgr.GetAgentByName("Talk Application Agent");
                    if (agent == null)
                    {
                        MessageBox.Show("Could not find application agent for this application.");
                        return;
                    }

                    Context.AppAgentMgr.AddAgent(form.Handle, agent);

                    Context.AppPanelManager.ShowDialog(form as IPanel);
                }
                else
                {
                    MessageBox.Show(String.Format(R.GetString("InvalidFormName"), "TalkApplicationScanner"), R.GetString("Error"));
                    return;
                }

                AppCommon.ExitMessageShow();

                AuditLog.Audit(new AuditEvent("Application", "stop"));

                Context.Dispose();

                Common.Uninit();

                AppCommon.ExitMessageClose();

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

            AppCommon.OnExit();
        }
예제 #10
0
        public static void Main(String[] args)
        {
            if (AppCommon.OtherInstancesRunning())
            {
                return;
            }

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

            FileUtils.LogAssemblyInfo();

            parseCommandLine(args);

            AppCommon.LoadGlobalSettings();

            AppCommon.SetUserName(_userName);
            AppCommon.SetProfileName(_profile);

            if (!AppCommon.CreateUserAndProfile())
            {
                return;
            }

            if (!AppCommon.LoadUserPreferences())
            {
                return;
            }

            Common.AppPreferences.AppId   = "ACATApp";
            Common.AppPreferences.AppName = "ACAT App";

            CommandDescriptors.Init();

            Log.SetupListeners();

            if (!AppCommon.SetCulture())
            {
                return;
            }

            CommandDescriptors.Init();

            if (!String.IsNullOrEmpty(_panelConfig))
            {
                Common.AppPreferences.PreferredPanelConfigNames = _panelConfig;
            }

            Splash splash = new Splash(2000);

            splash.Show();

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

            if (!Context.Init())
            {
                splash.Close();
                splash = null;

                TimedMessageBox.Show(Context.GetInitCompletionStatus());
                if (Context.IsInitFatal())
                {
                    return;
                }
            }

            if (splash != null)
            {
                splash.Close();
            }

            AuditLog.Audit(new AuditEvent("Application", "start"));

            Context.ShowTalkWindowOnStartup = Common.AppPreferences.ShowTalkWindowOnStartup;
            Context.AppAgentMgr.EnableContextualMenusForDialogs = Common.AppPreferences.EnableContextualMenusForDialogs;
            Context.AppAgentMgr.EnableContextualMenusForMenus   = Common.AppPreferences.EnableContextualMenusForMenus;

            if (Context.ShowTalkWindowOnStartup)
            {
                Context.AppTalkWindowManager.ToggleTalkWindow();
                Context.ShowTalkWindowOnStartup = false;
            }

            if (!Context.PostInit())
            {
                MessageBox.Show(Context.GetInitCompletionStatus(), R.GetString("InitializationError"));
                return;
            }

            Common.Init();

            try
            {
                Application.Run();

                AppCommon.ExitMessageShow();

                AuditLog.Audit(new AuditEvent("Application", "stop"));

                Context.Dispose();

                Common.Uninit();

                AppCommon.ExitMessageClose();

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

            AppCommon.OnExit();
        }
예제 #11
0
        public static void Main(String[] args)
        {
            if (AppCommon.OtherInstancesRunning())
            {
                return;
            }

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

            FileUtils.LogAssemblyInfo();

            AppCommon.LoadGlobalSettings();

            AppCommon.SetUserName();
            AppCommon.SetProfileName();

            if (!AppCommon.CreateUserAndProfile())
            {
                return;
            }

            if (!AppCommon.LoadUserPreferences())
            {
                return;
            }

            Common.AppPreferences.AppId   = "ACATPhrase";
            Common.AppPreferences.AppName = "ACAT Phrases";

            if (!AppCommon.SetCulture())
            {
                return;
            }

            Log.SetupListeners();

            CommandDescriptors.Init();

            setSwitchMapCommands();

            if (!createPanelClassConfig())
            {
                return;
            }

            Common.AppPreferences.PreferredPanelConfigNames = _panelConfigClassName;

            Splash splash = new Splash(1000);

            splash.Show();

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

            Context.AppAgentMgr.EnableAppAgentContextSwitch = false;

            if (!Context.Init(Context.StartupFlags.Minimal |
                              Context.StartupFlags.TextToSpeech |
                              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(), R.GetString("InitializationError"));
                return;
            }

            Common.Init();

            Context.AppWindowPosition = Windows.WindowPosition.CenterScreen;

            try
            {
                var phraseSpeakScanner = Context.AppPanelManager.CreatePanel(_phraseSpeakScannerName);
                if (phraseSpeakScanner != null)
                {
                    var invoker = (phraseSpeakScanner as IExtension).GetInvoker();
                    invoker.SetValue("ShowSearchButton", false);
                    Context.AppPanelManager.ShowDialog(phraseSpeakScanner as IPanel);
                }

                AppCommon.ExitMessageShow();

                AuditLog.Audit(new AuditEvent("Application", "stop"));

                Context.Dispose();

                Common.Uninit();

                AppCommon.ExitMessageClose();

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

            AppCommon.OnExit();
        }