// 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 ShowConfiguration() { PluginSettingsControl settingsWindow = new PluginSettingsControl(); settingsWindow.MaxWidth = 520; settingsWindow.MaxHeight = 650; settingsWindow.MinWidth = 520; settingsWindow.MinHeight = 650; settingsWindow.ResizeMode = System.Windows.ResizeMode.CanResize; settingsWindow.Title = Main.PluginName; settingsWindow.SaveWindowPosition = true; settingsWindow.ShowDialog(); }
// 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; }
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); }
public void Initialise(IAutoWikiBrowser sender) { // Store AWB object reference: AWBForm = sender; // Initialise our settings object: _pluginSettings = new PluginSettingsControl(); // Set up our UI objects: AWBForm.BotModeCheckbox.EnabledChanged += AWBBotModeCheckboxEnabledChangedHandler; AWBForm.BotModeCheckbox.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); // 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(); }