AutoWikiBrowser.MainForm.CheckStatus C# (CSharp) Method

CheckStatus() public method

public CheckStatus ( bool login ) : bool
login bool
return bool
        public bool CheckStatus(bool login)
        {
            StatusLabelText = "Loading page to check if we are logged in.";

            bool status = false;
            string label = "Software disabled";

            switch (TheSession.Update())
            {
                case WikiStatusResult.Error:
                    MessageBox.Show("Check page failed to load.\r\n\r\nCheck your Internet is working and that the Wikipedia servers are online.", "User check problem", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    break;

                case WikiStatusResult.NotLoggedIn:
                    if (!login)
                    {
                        MessageBox.Show("You are not logged in. The profile screen will now load, enter your name and password, click \"Log in\", wait for it to complete, then start the process again.", "Not logged in", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Profiles.ShowDialog();
                    }
                    break;

                case WikiStatusResult.NotRegistered:
                    MessageBox.Show(TheSession.User.Name + " is not enabled to use this.", "Not enabled", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    Tools.OpenURLInBrowser(Variables.URLIndex + "?title=Project:AutoWikiBrowser/CheckPage");
                    break;

                case WikiStatusResult.OldVersion:
                    OldVersion();
                    break;

                case WikiStatusResult.NoRights:
                    NoWriteApiRight();
                    break;

                case WikiStatusResult.Registered:
                    status = true;
                    label = string.Format("Logged in, user and software enabled. Bot = {0}, Admin = {1}", TheSession.User.IsBot, TheSession.User.IsSysop);

                    //Get list of articles not to apply general fixes to.
                    Match noGenFix = WikiRegexes.NoGeneralFixes.Match(TheSession.CheckPageText);
                    if (noGenFix.Success)
                    {
                        foreach (Match link in WikiRegexes.UnPipedWikiLink.Matches(noGenFix.Value))
                            if (!NoParse.Contains(link.Groups[1].Value))
                                NoParse.Add(link.Groups[1].Value);
                    }

                    //Get list of articles not to apply RETF to.
                    Match noRETF = WikiRegexes.NoRETF.Match(TheSession.CheckPageText);
                    if (noRETF.Success)
                    {
                        foreach (Match link in WikiRegexes.UnPipedWikiLink.Matches(noRETF.Value))
                            if (!NoRetf.Contains(link.Groups[1].Value))
                                NoRetf.Add(link.Groups[1].Value);
                    }
                    break;

                default:
                    throw new Exception("Unknown WikiStatusResult value.");
            }

            // detect writing system
            RightToLeft = Variables.RTL ? RightToLeft.Yes : RightToLeft.No;

            StatusLabelText = label;
            UpdateStatusUI();
            UpdateButtons(null, null);

            return status;
        }
MainForm