internal void Init(AsyncApiEdit e, Label ETALabel, PluginSettingsControl.Stats Stats) { if (!TimerEnabled) { ResetVars(); mETALabel = ETALabel; TimerEnabled = true; mStats = Stats; mStats.SkipMisc += mStats_SkipMisc; Timer1_Tick(null, null); } }
internal void Init(AsyncApiEdit e, Label etaLabel, PluginSettingsControl.Stats stats) { if (!TimerEnabled) { ResetVars(); _etaLabel = etaLabel; TimerEnabled = true; _stats = stats; _stats.SkipMisc += StatsSkipMisc; Timer1_Tick(null, null); } }
// New: internal Assessments(PluginSettingsControl vPluginSettings) { PluginSettings = vPluginSettings; // Get a reference to the cleanup checkboxes: foreach (Control ctl in PluginManager.AWBForm.OptionsTab.Controls["groupBox6"].Controls) { if (ReferenceEquals(ctl.GetType(), typeof(CheckBox))) AWBCleanupCheckboxes.Add((CheckBox)ctl); } ToggleAWBCleanup(PluginSettings.Cleanup); PluginSettings.CleanupCheckBox.CheckedChanged += CleanupCheckBox_CheckedChanged; PluginManager.AWBForm.TheSession.StateChanged += EditorStatusChanged; PluginManager.AWBForm.SaveButton.Click += Save_Click; PluginManager.AWBForm.SkipButton.Click += Skip_Click; }
// This procedure is where the actual cleanup occurs internal void Dispose(bool disposing) { // Exit now if the object has already been disposed if (disposed) return; if (disposing) { // The object is being disposed, not finalized. // It is safe to access other objects (other than the mybase object) // only from inside this block PluginSettings.CleanupCheckBox.CheckedChanged -= CleanupCheckBox_CheckedChanged; PluginManager.AWBForm.TheSession.StateChanged -= EditorStatusChanged; PluginManager.AWBForm.SaveButton.Click -= Save_Click; PluginManager.AWBForm.SkipButton.Click -= Skip_Click; } // Perform cleanup that has to be executed in either case: AWBCleanupCheckboxes = null; PluginSettings = null; State = null; // Remember that this object has been disposed of: disposed = true; }
public void Initialise(IAutoWikiBrowser sender) { // Store AWB object reference: AWBForm = sender; // Initialise our settings object: PluginSettings = new PluginSettingsControl(); // Set up our UI objects: var _with2 = AWBForm.BotModeCheckbox; _with2.EnabledChanged += AWBBotModeCheckboxEnabledChangedHandler; _with2.CheckedChanged += AWBBotModeCheckboxCheckedChangeHandler; AWBForm.StatusStrip.Items.Insert(2, StatusText); StatusText.Margin = new Padding(50, 0, 50, 0); StatusText.BorderSides = ToolStripStatusLabelBorderSides.Left | ToolStripStatusLabelBorderSides.Right; StatusText.BorderStyle = Border3DStyle.Etched; AWBForm.HelpToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[]{ new ToolStripSeparator(), PluginSettings.MenuHelp, PluginSettings.MenuAbout }); // UI - addhandlers for Start/Stop/Diff/Preview/Save/Ignore buttons/form closing: AWBForm.Form.FormClosing += AWBClosingEventHandler; // Handle over events from AWB: AWBForm.StopButton.Click += StopButtonClickEventHandler; AWBForm.TheSession.StateChanged += EditorStatusChanged; AWBForm.TheSession.Aborted += EditorAborted; // Track Manual Assessment checkbox: PluginSettings.ManuallyAssessCheckBox.CheckedChanged += ManuallyAssessCheckBox_CheckChanged; // Tabs: KingbotkPluginTab.UseVisualStyleBackColor = true; KingbotkPluginTab.Controls.Add(PluginSettings); // Show/hide tabs menu: MenuShowSettingsTabs.CheckOnClick = true; MenuShowSettingsTabs.Checked = true; MenuShowSettingsTabs.Click += MenuShowHide_Click; AWBForm.ToolStripMenuGeneral.DropDownItems.Add(MenuShowSettingsTabs); // Add-Generic-Template menu: AddGenericTemplateMenuItem.Click += AddGenericTemplateMenuItem_Click; AWBForm.PluginsToolStripMenuItem.DropDownItems.Add(AddGenericTemplateMenuItem); // Create plugins: Plugins.Add("Albums", new WPAlbums()); Plugins.Add("Australia", new WPAustralia()); Plugins.Add("India", new WPIndia()); Plugins.Add("MilHist", new WPMilitaryHistory()); Plugins.Add("Songs", new WPSongs()); Plugins.Add("WPNovels", new WPNovels()); Plugins.Add("Biography", new WPBiography()); // hopefully if add WPBio last it will ensure that the template gets added to the *top* of pages // Initialise plugins: foreach (KeyValuePair<string, PluginBase> plugin in Plugins) { plugin.Value.Initialise(); } // Add our menu items last: AWBForm.PluginsToolStripMenuItem.DropDownItems.Add(PluginSettings.PluginToolStripMenuItem); // Reset statusbar text: DefaultStatusText(); }
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; }