Beispiel #1
0
        private void UpdateSettings()
        {
            if (!_savesettings)
            {
                return;
            }

            if (!string.IsNullOrEmpty(Settings.Default.ExternalHighlight))
            {
                Settings.Default.ExternalHighlight = _tempSettings.ExternalHighlight;
                HighlightingManager.Manager.ClearSyntaxModeFileProvider();
                HighlightingUtils.MakeHighlightingFile();
                HighlightingManager.Manager.ReloadSyntaxModes();
            }

            foreach (SettingsProperty setting in _tempSettings.Properties)
            {
                Settings.Default[setting.Name] = _tempSettings[setting.Name];
            }

            HighlightingUtils.MakeHighlightingFile();
        }
Beispiel #2
0
        private static void Main(string[] args)
        {
            try
            {
                if (Settings.Default.FirstRun)
                {
                    Settings.Default.Upgrade();
                    Settings.Default.FirstRun = false;
                    Settings.Default.Save();
                }
            }
            catch (ConfigurationErrorsException ex)
            {
                DockingService.ShowError("Error upgrading settings", ex);
            }

            Application.EnableVisualStyles();

            DockPanel          panel              = new WabbitcodeDockPanel();
            StatusStrip        statusBar          = new WabbitcodeStatusBar();
            ToolStripContainer toolStripContainer = new WabbitcodeToolStripContainer(statusBar, panel);

            Task.Factory.StartNew(() => InitializeDependencies(panel, statusBar, toolStripContainer), TaskCreationOptions.PreferFairness);
            Task.Factory.StartNew(() =>
            {
                FileLocations.InitDirs();
                FileLocations.InitFiles();
                HighlightingUtils.MakeHighlightingFile();
            });

            Task.Factory.StartNew(() =>
            {
                if (!UpdateService.CheckForUpdate())
                {
                    return;
                }

                var result = MessageBox.Show("New version available. Download now?", "Update Available", MessageBoxButtons.YesNo, MessageBoxIcon.None);
                if (result != DialogResult.Yes)
                {
                    return;
                }

                UpdateService.StartUpdater();
                Application.Exit();
            });

            int     numErrors = 0;
            AppBase appBase   = new AppBase(toolStripContainer);

#if !DEBUG
            try
            {
#endif
            appBase.Run(args);
#if !DEBUG
        }
        catch (Exception ex)
        {
            numErrors++;
            DockingService.ShowError("Unhandled exception occurred. Please report this to the developers", ex);
        }
#endif

            if (numErrors == 0)
            {
                return;
            }

            do
            {
                try
                {
                    appBase.DoEvents();
                }
                catch (Exception ex)
                {
                    numErrors++;
                    DockingService.ShowError("Unhandled exception occurred. Please report this to the developers", ex);
                }
            } while (numErrors < 5);
        }