Exemple #1
0
        private void SetProject(LangCodeEnum code, ProjectEnum project, string customProject)
        {
            SplashScreen.SetProgress(81);
            try
            {
                //set namespaces
                Variables.SetProject(code, project, customProject);

                TheSession = new Session();

                //set interwikiorder
                switch (Variables.LangCode)
                {
                    case LangCodeEnum.en:
                    case LangCodeEnum.pl:
                    case LangCodeEnum.simple:
                        Parser.InterWikiOrder = InterWikiOrderEnum.LocalLanguageAlpha;
                        break;

                    case LangCodeEnum.he:
                    case LangCodeEnum.hu:
                        Parser.InterWikiOrder = InterWikiOrderEnum.AlphabeticalEnFirst;
                        break;

                    default:
                        Parser.InterWikiOrder = InterWikiOrderEnum.Alphabetical;
                        break;
                }

                //user interface
                if (!Variables.IsWikipediaEN)
                {
                    humanNameDisambigTagToolStripMenuItem.Visible = birthdeathCatsToolStripMenuItem.Visible = false;
                    chkAutoTagger.Checked = false;
                }
                else if (!humanNameDisambigTagToolStripMenuItem.Visible)
                {
                    humanNameDisambigTagToolStripMenuItem.Visible = birthdeathCatsToolStripMenuItem.Visible = true;
                }

                UserTalkWarningsLoaded = false; // force reload

                if (!Variables.IsCustomProject && !Variables.IsWikia && !Variables.IsWikimediaMonolingualProject)
                    lblProject.Text = Variables.LangCodeEnumString() + "." + Variables.Project;
                else lblProject.Text = Variables.IsWikimediaMonolingualProject ? Variables.Project.ToString() : Variables.URL;

                ResetTypoStats();
            }
            catch (ArgumentNullException)
            {
                MessageBox.Show("The interwiki list didn't load correctly. Please check your internet connection, and then restart AWB");
            }
        }
Exemple #2
0
        public MainForm()
        {
            DiffScriptingAdapter = new JsAdapter(this);

            Updater.UpdateUpdaterFile();

            SplashScreen.Show(this);
            RightToLeft = System.Globalization.CultureInfo.CurrentCulture.TextInfo.IsRightToLeft
                ? RightToLeft.Yes : RightToLeft.No;

            SplashScreen.SetProgress(1);

            InitializeComponent();

            SplashScreen.SetProgress(5);
            try
            {
                btntsShowHide.Image = Resources.Showhide;
                btntsShowHideParameters.Image = Resources.Showhideparameters;
                btntsSave.Image = Resources.Save;

                btntsIgnore.Image = Resources.RightArrow;
                btntsStop.Image = Resources.Stop;
                btntsPreview.Image = Resources.preview;
                btntsChanges.Image = Resources.changes;
                btntsFalsePositive.Image = Resources.RollBack;
                btntsStart.Image = Resources.Run;
                btntsDelete.Image = Resources.Vista_trashcan_empty;

                SplashScreen.SetProgress(10);
                try
                {
                    Parser = new Parsers(Properties.Settings.Default.StubMaxWordCount,
                                         Properties.Settings.Default.AddHummanKeyToCats);
                }
                catch (Exception ex)
                {
                    Parser = new Parsers();
                    ErrorHandler.Handle(ex);
                }

                addToWatchList.SelectedIndex = 3;
                cmboCategorise.SelectedIndex = 0;
                cmboImages.SelectedIndex = 0;

                listMaker.UserInputTextBox.ContextMenuStrip = mnuMakeFromTextBox;
                listMaker.BusyStateChanged += SetProgressBar;
                listMaker.NoOfArticlesChanged += UpdateButtons;
                listMaker.StatusTextChanged += UpdateListStatus;
                listMaker.cmboSourceSelect.SelectedIndexChanged += ListMakerSourceSelectHandler;

                TheSession = new Session(this);
                CreateEditor();

                Profiles = new WikiFunctions.Profiles.AWBProfilesForm(TheSession);
                Profiles.LoggedIn += ProfileLoggedIn;

                SplashScreen.SetProgress(15);

                _pasteMoreItems = new[]
                {
                    PasteMore1, PasteMore2, PasteMore3, PasteMore4, PasteMore5, PasteMore6, PasteMore7, PasteMore8, PasteMore9, PasteMore10
                };

                // to avoid saving to app data
                saveXML.InitialDirectory = openXML.InitialDirectory =
                    Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            }
            catch (Exception ex)
            {
                ErrorHandler.Handle(ex);
            }
        }
Exemple #3
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            EditBoxTab.TabPages.Remove(tpTypos);

            StatusLabelText = "Initialising...";
            SplashScreen.SetProgress(20);
            Variables.MainForm = this;
            lblOnlyBots.BringToFront();
            Updater.UpdateAWB(SplashScreen.SetProgress); // progress 22-29 in UpdateAWB()
            SplashScreen.SetProgress(30);

            Program.MyTrace.LS = loggingSettings1;

            try
            {
                //check that we are not using an old OS. 98 seems to mangled some unicode
                if (Environment.OSVersion.Version.Major < 5)
                {
                    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;
                }

                webBrowserDiff.Navigate("about:blank");
                webBrowserDiff.ObjectForScripting = this;

                SplashScreen.SetProgress(35);
                if (Properties.Settings.Default.LogInOnStart)
                    CheckStatus(false);

                logControl.Initialise(listMaker);

                Location = Properties.Settings.Default.WindowLocation;

                Size = Properties.Settings.Default.WindowSize;

                WindowState = Properties.Settings.Default.WindowState;

                Debug();
                Release();

                Plugin.LoadPluginsStartup(this, SplashScreen); // progress 65-79 in LoadPlugins()

                LoadPrefs(); // progress 80-85 in LoadPrefs()

                TheSession = new Session();
                CreateEditor();

                SplashScreen.SetProgress(86);
                UpdateButtons(null, null);
                SplashScreen.SetProgress(88);
                LoadRecentSettingsList(); // progress 89-94 in LoadRecentSettingsList()
                SplashScreen.SetProgress(95);

                switch (Variables.User.CheckEnabled())
                {
                    case WikiStatusResult.OldVersion:
                        OldVersion();
                        break;
                    case WikiStatusResult.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);
                        break;
                }

                Profiles.Login(ProfileToLoad);
            }
            catch (Exception ex)
            {
                ErrorHandler.Handle(ex);
            }

            UsageStats.Initialise();

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

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