AutoWikiBrowser.MainForm.MainForm_Load C# (CSharp) Method

MainForm_Load() private method

private MainForm_Load ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        private void MainForm_Load(object sender, EventArgs e)
        {
            EditBoxTab.TabPages.Remove(tpTypos);

            StatusLabelText = "Initialising...";
            SplashScreen.SetProgress(20);
            Variables.MainForm = this;
            lblOnlyBots.BringToFront();

            SplashScreen.SetProgress(22);

            try
            {
                // check that we are not using an old OS. 98 seems to mangled some unicode
                if (Environment.OSVersion.Version.Major < 5 && Globals.RunningOnWindows)
                {
                    MessageBox.Show(
                        "You appear to be using an older operating system, this software may have trouble with some unicode fonts on operating systems older than Windows 2000, the start button has been disabled.",
                        "Operating system", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    SetStartButton(false);
                    listMaker.MakeListEnabled = false;
                }

                webBrowser.Navigate("about:blank");
                webBrowser.ObjectForScripting = DiffScriptingAdapter;

                SplashScreen.SetProgress(25);

                logControl.Initialise(listMaker);
                articleActionLogControl1.Initialise(listMaker);

                Location = Properties.Settings.Default.WindowLocation;

                Size = Properties.Settings.Default.WindowSize;

                // T99305: No vertical scroll bar in diff window: don't restore AWB Minimized as we lose scrollbars
                WindowState = (Properties.Settings.Default.WindowState == FormWindowState.Minimized ? FormWindowState.Normal : Properties.Settings.Default.WindowState);

                Plugin.LoadPluginsStartup(this, SplashScreen); // progress 25-50 in LoadPlugins()
                LoadPrefs(); // progress 50-59 in LoadPrefs()

                Debug();
                Release();

                SplashScreen.SetProgress(60);
                UpdateButtons(null, null);
                SplashScreen.SetProgress(62);
                LoadRecentSettingsList(); // progress 63-66 in LoadRecentSettingsList()

                Updater.WaitForCompletion();

                ntfyTray.Visible = true;

                SplashScreen.SetProgress(80);

                bool optUpdate = ((Updater.Result & Updater.AWBEnabledStatus.OptionalUpdate) ==
                                  Updater.AWBEnabledStatus.OptionalUpdate),
                updaterUpdate = ((Updater.Result & Updater.AWBEnabledStatus.UpdaterUpdate) ==
                                 Updater.AWBEnabledStatus.UpdaterUpdate);

                if (optUpdate || updaterUpdate)
                {
                    bool runUpdater = false;

                    if (updaterUpdate)
                    {
                        MessageBox.Show("There is an Update to the AWB updater. Updating Now", "Updater update");
                        runUpdater = true;
                    }

                    if (!runUpdater &&
                        MessageBox.Show(
                            "This version has been superceeded by a new version. You may continue to use this version or update to the newest version.\r\n\r\nWould you like to automatically upgrade to the newest version?",
                            "Upgrade?", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        runUpdater = true;

                    if (runUpdater)
                    {
                        Updater.RunUpdater();
                        SplashScreen.Close();
                        CloseAWB();
                        return;
                    }
                }

                if ((Updater.Result & Updater.AWBEnabledStatus.Disabled) == Updater.AWBEnabledStatus.Disabled)
                {
                    OldVersion();
                    SplashScreen.Close();
                    return;
                }

                if ((Updater.Result & Updater.AWBEnabledStatus.Error) == Updater.AWBEnabledStatus.Error)
                {
                    lblUserName.BackColor = Color.Red;
                    MessageBox.Show(this,
                                    "Cannot load version check page from Wikipedia. Please verify that you're connected to Internet.",
                                    "Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                SplashScreen.SetProgress(90);

                Profiles.Login(_profileToLoad);

                SplashScreen.SetProgress(95);
            }
            catch (Exception ex)
            {
                ErrorHandler.HandleException(ex);
            }

            StatusLabelText = "";
            SplashScreen.SetProgress(100);
            SplashScreen.Close();

            #if DEBUG && INSTASTATS
            UsageStats.Do(false);
            #endif
        }
MainForm