ShowDialog() private method

private ShowDialog ( Classification &classification, Importance &importance, bool &infobox, bool &attention, bool &needsPhoto, string title ) : DialogResult
classification Classification
importance Importance
infobox bool
attention bool
needsPhoto bool
title string
return DialogResult
        internal bool ProcessTalkPage(Article theArticle, PluginSettingsControl pluginSettings, ref bool reqPhoto)
        {
            bool weAddedAReqPhotoParam = false;
            bool returnVal             = false;

            if (!_state.NextArticleShouldBeTalk)
            {
                IsThisABug("an article");
            }
            else if (!_state.IsNextPage(theArticle.FullArticleTitle))
            {
                IsThisABug(_state.NextTalkPageExpected);
            }
            else
            {
                _state.NextArticleShouldBeTalk = false;

                PluginManager.StatusText.Text = "Assessments plugin: please assess the article or click cancel";

                AssessmentForm frmDialog = new AssessmentForm();

                returnVal =
                    (frmDialog.ShowDialog(out _state.Classification, out _state.Importance, out _state.NeedsInfobox,
                                          out _state.NeedsAttention, out _state.NeedsPhoto, _state.NextTalkPageExpected) == DialogResult.OK);

                if (returnVal)
                {
                    PluginManager.StatusText.Text = "Processing " + theArticle.FullArticleTitle;

                    foreach (PluginBase p in PluginManager.ActivePlugins)
                    {
                        if (
                            p.ProcessTalkPage(theArticle, _state.Classification, _state.Importance, _state.NeedsInfobox,
                                              _state.NeedsAttention, true, ProcessTalkPageMode.ManualAssessment,
                                              reqPhoto || _state.NeedsPhoto) && (reqPhoto || _state.NeedsPhoto) && p.HasReqPhotoParam)
                        {
                            weAddedAReqPhotoParam = true;
                        }
                        if (theArticle.PluginManagerGetSkipResults == SkipResults.SkipBadTag)
                        {
                            MessageBox.Show("Bad tag(s). Fix manually.", "Bad tag", MessageBoxButtons.OK,
                                            MessageBoxIcon.Exclamation);
                            break; // TODO: might not be correct. Was : Exit For
                        }
                    }
                }
                else
                {
                    pluginSettings.PluginStats.SkippedMiscellaneousIncrement(false);
                    PluginManager.StatusText.Text = "Skipping this talk page";
                    LoadArticle();
                }
            }

            if (returnVal)
            {
                switch (_state.Classification)
                {
                case Classification.Code:
                case Classification.Unassessed:
                    theArticle.EditSummary = "Assessed article using " + Constants.WikiPlugin;
                    break;

                default:
                    theArticle.EditSummary = "Assessing as " + _state.Classification + " class, using " +
                                             Constants.WikiPlugin;
                    break;
                }

                reqPhoto = weAddedAReqPhotoParam;
            }
            else
            {
                reqPhoto = false;
            }

            return(returnVal);
        }
Ejemplo n.º 2
0
		internal bool ProcessTalkPage(Article TheArticle, PluginSettingsControl pluginSettings, ref bool ReqPhoto)
		{
			bool WeAddedAReqPhotoParam = false;
			bool returnVal = false;

			if (!State.NextArticleShouldBeTalk) {
				IsThisABug("an article");
			} else if (!State.IsNextPage(TheArticle.FullArticleTitle)) {
				IsThisABug(State.NextTalkPageExpected);
			} else {
				State.NextArticleShouldBeTalk = false;

				PluginManager.StatusText.Text = "Assessments plugin: please assess the article or click cancel";

				AssessmentForm frmDialog = new AssessmentForm();

				returnVal = (frmDialog.ShowDialog(ref State.Classification, ref State.Importance, ref State.NeedsInfobox, ref State.NeedsAttention, ref State.NeedsPhoto, State.NextTalkPageExpected) == DialogResult.OK);

				if (returnVal) {
					PluginManager.StatusText.Text = "Processing " + TheArticle.FullArticleTitle;

					foreach (PluginBase p in PluginManager.ActivePlugins) {
						if (p.ProcessTalkPage(TheArticle, State.Classification, State.Importance, State.NeedsInfobox, State.NeedsAttention, true, ProcessTalkPageMode.ManualAssessment, ReqPhoto || State.NeedsPhoto) && (ReqPhoto || State.NeedsPhoto) && p.HasReqPhotoParam)
							WeAddedAReqPhotoParam = true;
						if (TheArticle.PluginManagerGetSkipResults == SkipResults.SkipBadTag) {
							MessageBox.Show("Bad tag(s). Fix manually.", "Bad tag", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
							break; // TODO: might not be correct. Was : Exit For
						}
					}
				} else {
					pluginSettings.PluginStats.SkippedMiscellaneousIncrement(false);
					PluginManager.StatusText.Text = "Skipping this talk page";
					LoadArticle();
				}
			}

			if (returnVal) {
				switch (State.Classification) {
					case Classification.Code:
					case Classification.Unassessed:
                        TheArticle.EditSummary = "Assessed article using " + Constants.conWikiPlugin;
						break;
					default:
                        TheArticle.EditSummary = "Assessing as " + State.Classification.ToString() + " class, using " + Constants.conWikiPlugin;
						break;
				}

				ReqPhoto = WeAddedAReqPhotoParam;
			} else {
				ReqPhoto = false;
			}

			return returnVal;
		}