예제 #1
0
        public override void Apply()
        {
            bool changed = IsChanged();

            current.UseEQATECMonitor = rbAllow.Checked;
            if (changed)
            {
                if (TranslateOptions.Instance.UseEQATECMonitor)
                {
                    AnalyticsMonitor.Start();
                }
                else
                {
                    AnalyticsMonitor.Stop();
                }
            }
        }
예제 #2
0
        private static void Main(string[] args)
        {
            //if(MonoHelper.IsUnix)
            //	Environment.SetEnvironmentVariable ("MONO_BROWSER_ENGINE", "webkit");

            if (CommandLineHelper.IsCommandSwitchSet("gen_list"))
            {
                try
                {
                    WebUI.ResultsWebServer.UnhandledException += OnUnhandledExceptionEvent;
                    WebUI.ResultsWebServer.Start();

                    ServicesListHtmlGenerator.Generate();
                }
                catch (Exception e)
                {
                    Application.OnThreadException(e);
                }
                return;
            }

            try
            {
                Application.ExceptionsLog += GlobalEventsLogException;
                ResultsCache.UseCache      = true;
                GuessResultsCache.UseCache = true;

                UpdatesManager.Init();
                Application.ShowSplashForm(null);

                Application.OptionsForm = new OptionsForm();
                Application.BaseOptions = new TranslateOptions();
                Application.AboutForm   = new AboutForm();

                OptionsControlsManager.RegisterOptionControl(typeof(StartupOptionsControl), "General", 0, "Startup", 1);
                OptionsControlsManager.RegisterOptionControl(typeof(TrayOptionsControl), "General", 0, "Tray", 2);
                OptionsControlsManager.RegisterOptionControl(typeof(ResultWindowOptionControl), "General", 0, "Result view", 3);
                OptionsControlsManager.RegisterOptionControl(typeof(GuesserOptionsControl), "General", 0, "Language detection", 4);

                if (!MonoHelper.IsUnix)                //monobug - don't work with DataSource
                {
                    OptionsControlsManager.RegisterOptionControl(typeof(KeyboardLayoutControl), "General", 0, "Keyboard layouts", 5);
                }


                OptionsControlsManager.RegisterOptionControl(typeof(UpdatesOptionsControl), "General", 0, "Updates", 6);
                OptionsControlsManager.RegisterOptionControl(typeof(HotkeysOptionsControl), "General", 0, "Hotkeys", 7);

                OptionsControlsManager.RegisterOptionControl(typeof(InputFontOptionsControl), "Fonts", 1, "Input text", 0);
                OptionsControlsManager.RegisterOptionControl(typeof(ResultViewFontOptionsControl), "Fonts", 1, "Result view", 1);
                OptionsControlsManager.RegisterOptionControl(typeof(ToolbarsFontOptionsControl), "Fonts", 1, "Toolbars", 2);

                OptionsControlsManager.RegisterOptionControl(typeof(GeneralNetworkOptionsControl), "Network", 2, "Common", 0);

                OptionsControlsManager.RegisterOptionControl(typeof(CustomProfilesControl), "Profiles", 3, "List", 4);
                OptionsControlsManager.RegisterOptionControl(typeof(AnalyticsOptionsControl), "Usage information collecting", 4, "Usage information collecting", 4);

                Application.Initialize();

                if (TranslateOptions.Instance.SingleInstance && ProcessHelper.IsOtherInstanceAlreadyStarted())
                {
                    ProcessHelper.ActivateOtherInstance(ApplicationInfo.ProductName);
                    return;
                }

                UpdatesManager.CheckNewVersion();

                WebUI.ResultsWebServer.UnhandledException += OnUnhandledExceptionEvent;
                try
                {
                    WebUI.ResultsWebServer.Start();
                }
                catch (System.Reflection.TargetInvocationException e)
                {
                    if (e.InnerException != null && e.InnerException.GetType() == typeof(System.Security.VerificationException))
                    {
                        MessageBox.Show(LangPack.TranslateString("Running from network share not supported.\nTool can work only when started from local drive under appropriate user's rights."),
                                        Constants.AppName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    else
                    {
                        throw;
                    }
                }

                AnalyticsMonitor.Start();
                Application.Run(new TranslateMainForm());
                WebUI.ResultsWebServer.Stop();
            }
            catch (Exception e)
            {
                Application.OnThreadException(e);
            }
        }