当前位置: 首页>>代码示例>>C#>>正文


C# IAutoWikiBrowser类代码示例

本文整理汇总了C#中IAutoWikiBrowser的典型用法代码示例。如果您正苦于以下问题:C# IAutoWikiBrowser类的具体用法?C# IAutoWikiBrowser怎么用?C# IAutoWikiBrowser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IAutoWikiBrowser类属于命名空间,在下文中一共展示了IAutoWikiBrowser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ServerControl

        /// <summary>
        /// Constructor/initialisation, called from IAWBPlugin.Initialise
        /// </summary>
        /// <param name="AWBForm"></param>
        internal ServerControl(IAutoWikiBrowser sender)
        {
            InitializeComponent();

            // Store reference to AWB main form:
            AWBForm = sender;

            // Set up our UI objects:
            StatusText.Visible = false;
            StatusText.Margin = new Padding(10, 0, 10, 0);
            StatusText.BorderSides = ToolStripStatusLabelBorderSides.Left | ToolStripStatusLabelBorderSides.Right;
            StatusText.BorderStyle = Border3DStyle.Etched;
            //AWBForm.StatusStrip.ShowItemToolTips = true; // naughty hack in case somebody turns this off in the designer
            EnabledMenuItem.CheckOnClick = true;
            TabPageMenuItem.CheckOnClick = true;

            // Event handlers:
            AboutMenuItem.Click += AboutMenuItemClicked;
            EnabledMenuItem.CheckedChanged += PluginEnabled_CheckedChange;
            TabPageMenuItem.CheckedChanged += TabPageMenuItem_CheckedChange;
            ConfigMenuItem.Click += ShowSettings;
            HideButton.Click += HideButton_Click;
            SettingsButton.Click += ShowSettings;

            // Add our UI objects to the AWB main form:
            AWBForm.StatusStrip.Items.Insert(2, StatusText);
            EnabledMenuItem.DropDownItems.Add(ConfigMenuItem);
            EnabledMenuItem.DropDownItems.Add(TabPageMenuItem);
            AWBForm.PluginsToolStripMenuItem.DropDownItems.Add(EnabledMenuItem);
            AWBForm.HelpToolStripMenuItem.DropDownItems.Add(AboutMenuItem);
            AWBForm.HelpToolStripMenuItem.DropDownItems.Add(AboutMenuItem);
        }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:36,代码来源:ServerControl.cs

示例2: ProcessArticle

        public string ProcessArticle(IAutoWikiBrowser sender, IProcessArticleEventArgs eventargs)
        {
            //If menu item is not checked, then return
            if (!PluginEnabled || Settings.Images.Count == 0)
            {
                eventargs.Skip = false;
                return eventargs.ArticleText;
            }

            eventargs.EditSummary = "";
            string text = eventargs.ArticleText;

            foreach (KeyValuePair<string, string> p in Settings.Images)
            {
                bool noChange;

                if (p.Value.Length == 0)
                {
                    text = Parsers.RemoveImage(p.Key, text, Settings.Comment, "", out noChange);
                    if (!noChange) eventargs.EditSummary += ", removed " + Variables.Namespaces[6] + p.Key;
                }
                else
                {
                    text = Parsers.ReplaceImage(p.Key, p.Value, text, out noChange);
                    if (!noChange) eventargs.EditSummary += ", replaced: " + Variables.Namespaces[6]
                         + p.Key + FindandReplace.Arrow + Variables.Namespaces[6] + p.Value;
                }
                if (!noChange) text = Regex.Replace(text, "<includeonly>[\\s\\r\\n]*\\</includeonly>", "");
            }

            eventargs.Skip = (text == eventargs.ArticleText) && Settings.Skip;

            return text;
        }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:34,代码来源:IfdCore.cs

示例3: LoadNewPlugin

        public static void LoadNewPlugin(IAutoWikiBrowser awb)
        {
            OpenFileDialog pluginOpen = new OpenFileDialog();
            if (string.IsNullOrEmpty(LastPluginLoadedLocation))
                LoadLastPluginLoadedLocation();

            pluginOpen.InitialDirectory = string.IsNullOrEmpty(LastPluginLoadedLocation) ? Application.StartupPath : LastPluginLoadedLocation;
            
            pluginOpen.DefaultExt = "dll";
            pluginOpen.Filter = "DLL files|*.dll";
            pluginOpen.CheckFileExists = pluginOpen.Multiselect = /*pluginOpen.AutoUpgradeEnabled =*/ true;

            pluginOpen.ShowDialog();
            
            if (!string.IsNullOrEmpty(pluginOpen.FileName))
            {
                string newPath = Path.GetDirectoryName(pluginOpen.FileName);
                if (LastPluginLoadedLocation != newPath)
                {
                    LastPluginLoadedLocation = newPath;
                    SaveLastPluginLoadedLocation();
                }
            }

            Plugin.LoadPlugins(awb, pluginOpen.FileNames, true);
        }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:26,代码来源:PluginManager.cs

示例4: ProcessArticle

        public string ProcessArticle(IAutoWikiBrowser sender, IProcessArticleEventArgs eventargs)
        {
            //If menu item is not checked, then return
            if (!PluginEnabled)
            {
                eventargs.Skip = false;
                return eventargs.ArticleText;
            }

            // Warn if plugin is running, but no fronds have been enabled. A common newbie situation.
            if (Settings.EnabledFilenames.Count == 0)
            {
                DialogResult result = MessageBox.Show(
                    "It looks like you forget to select some fronds to use. You might like to choose some (\"Okay\"), or disable the plugin for now (\"Cancel\").",
                    "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);
                if (result == DialogResult.OK)
                {
                    ConfigMenuItem.PerformClick();
                }
                else
                {
                    EnabledMenuItem.Checked = Settings.Enabled = PluginEnabled = false;
                }
                return eventargs.ArticleText;
            }

            string text = eventargs.ArticleText;
            foreach (Frond f in Replacements)
            {
                text = f.Preform(text);
            }
            return text;
        }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:33,代码来源:Fronds.cs

示例5: ArgumentNullException

        void IAWBPlugin.Initialise(IAutoWikiBrowser sender)
        {
            if (sender == null)
                throw new ArgumentNullException("sender");

            // Delegate UI-setup to our user control object:
            ServerUserControl = new ServerControl(sender);

            // Set up the TabPage and attach the user control to it:
            ServerPluginTabPage.UseVisualStyleBackColor = true;
            ServerPluginTabPage.Controls.Add(ServerUserControl);
        }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:12,代码来源:ServerCore.cs

示例6: Initialise

        public void Initialise(IAutoWikiBrowser sender)
        {
            if (sender == null)
                throw new ArgumentNullException("sender");
            AWB = sender;

            // Menuitem should be checked when Fronds plugin is active and unchecked when not, and default to not!
            EnabledMenuItem.CheckOnClick = true;
            PluginEnabled = Settings.Enabled;

            ConfigMenuItem.Click += ShowSettings;
            EnabledMenuItem.CheckedChanged += PluginEnabledCheckedChange;
            AboutMenuItem.Click += AboutMenuItemClicked;
            PluginAboutMenuItem.Click += AboutMenuItemClicked;

            EnabledMenuItem.DropDownItems.AddRange(new[] {ConfigMenuItem, PluginAboutMenuItem});
            AWB.PluginsToolStripMenuItem.DropDownItems.Add(EnabledMenuItem);
            AWB.HelpToolStripMenuItem.DropDownItems.Add(AboutMenuItem);

            string newVersion = Tools.GetHTML(BaseURL + "version.txt").Replace(".", "");
            if (Int16.Parse(newVersion) > Int16.Parse(CurrentVersion.Replace(".", "")))
            {
                DialogResult result = MessageBox.Show(
                    "A newer version of Fronds is available. Downloading it is advisable, as it may contain important bugfixes.\r\n\r\nLoad update page now?",
                    "New version", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (result == DialogResult.Yes)
                {
                    Tools.OpenURLInBrowser("http://en.wikipedia.org/wiki/WP:FRONDS/U");
                }
            }

            XmlDocument xd = new XmlDocument();
            xd.LoadXml(Tools.GetHTML(BaseURL + "index.xml"));

            if (xd["fronds"] == null)
                return;

            foreach (XmlNode xn in xd["fronds"].GetElementsByTagName("frond"))
            {
                if (xn.ChildNodes.Count != 2)
                    continue;

                PossibleFilenames.Add(xn.ChildNodes[0].InnerText);
                PossibleFronds.Add(xn.ChildNodes[1].InnerText + " (" + xn.ChildNodes[0].InnerText + ")");
            }

            //TODO:We should probably load enabled Fronds when the plugin is enabled... (Probably in LoadSettings)
        }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:48,代码来源:Fronds.cs

示例7: Initialise

        public void Initialise(IAutoWikiBrowser sender)
        {
            AWB = sender;
            AWB.LogControl.LogAdded += LogControl_LogAdded;
            AWB.AddMainFormClosingEventHandler(UploadFinishedArticlesToServer);
            AWB.AddArticleRedirectedEventHandler(ArticleRedirected);

            PluginMenuItem.DropDownItems.Add(PluginUploadMenuItem);
            PluginMenuItem.DropDownItems.Add(PluginReAddArticlesMenuItem);
            PluginUploadMenuItem.Click += pluginUploadMenuItem_Click;

            PluginReAddArticlesMenuItem.Click += pluginReAddArticlesMenuItem_Click;
            sender.PluginsToolStripMenuItem.DropDownItems.Add(PluginMenuItem);

            AboutMenuItem.Click += aboutMenuItem_Click;
            sender.HelpToolStripMenuItem.DropDownItems.Add(AboutMenuItem);
        }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:17,代码来源:TypoScanAWBPlugin.cs

示例8: Initialise

        public void Initialise(IAutoWikiBrowser sender)
        {
            AWB = sender;
            AWB.LogControl.LogAdded += new WikiFunctions.Logging.LogControl.LogAddedToControl(LogControl_LogAdded);
            AWB.AddMainFormClosingEventHandler(new FormClosingEventHandler(UploadFinishedArticlesToServer));
            AWB.AddArticleRedirectedEventHandler(new ArticleRedirected(ArticleRedirected));

            pluginMenuItem.DropDownItems.Add(pluginUploadMenuItem);
            pluginMenuItem.DropDownItems.Add(pluginReAddArticlesMenuItem);
            pluginUploadMenuItem.Click += new EventHandler(pluginUploadMenuItem_Click);

            pluginReAddArticlesMenuItem.Click += new EventHandler(pluginReAddArticlesMenuItem_Click);
            sender.PluginsToolStripMenuItem.DropDownItems.Add(pluginMenuItem);

            aboutMenuItem.Click += new EventHandler(aboutMenuItem_Click);
            sender.HelpToolStripMenuItem.DropDownItems.Add(aboutMenuItem);
        }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:17,代码来源:TypoScanAWBPlugin.cs

示例9: Initialise

        public void Initialise(IAutoWikiBrowser sender)
        {
            if (sender == null)
                throw new ArgumentNullException("sender");

            AWB = sender;

            // Menuitem should be checked when IFD plugin is active and unchecked when not, and default to not!
            pluginenabledMenuItem.CheckOnClick = true;
            PluginEnabled = Settings.Enabled;

            pluginconfigMenuItem.Click += ShowSettings;
            pluginenabledMenuItem.CheckedChanged += PluginEnabledCheckedChange;
            aboutMenuItem.Click += AboutMenuItemClicked;
            pluginenabledMenuItem.DropDownItems.Add(pluginconfigMenuItem);

            sender.PluginsToolStripMenuItem.DropDownItems.Add(pluginenabledMenuItem);
            sender.HelpToolStripMenuItem.DropDownItems.Add(aboutMenuItem);
        }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:19,代码来源:IfdCore.cs

示例10: Initialise

        public void Initialise(IAutoWikiBrowser sender)
        {
            if (sender == null)
                throw new ArgumentNullException("sender");
            AWB = sender;

            // Menuitem should be checked when Fronds plugin is active and unchecked when not, and default to not!
            EnabledMenuItem.CheckOnClick = true;
            PluginEnabled = Settings.Enabled;

            ConfigMenuItem.Click += ShowSettings;
            EnabledMenuItem.CheckedChanged += PluginEnabledCheckedChange;
            AboutMenuItem.Click += AboutMenuItemClicked;
            PluginAboutMenuItem.Click += AboutMenuItemClicked;

            EnabledMenuItem.DropDownItems.AddRange(new[] {ConfigMenuItem, PluginAboutMenuItem});
            AWB.PluginsToolStripMenuItem.DropDownItems.Add(EnabledMenuItem);
            AWB.HelpToolStripMenuItem.DropDownItems.Add(AboutMenuItem);
        }
开发者ID:svick,项目名称:AWB,代码行数:19,代码来源:Fronds.cs

示例11: LoadPlugins

            internal static void LoadPlugins(IAutoWikiBrowser awb, string[] Plugins, bool afterStartup)
            {
                try
                {
                    foreach (string Plugin in Plugins)
                    {
                        if (Plugin.EndsWith("DotNetWikiBot.dll") || Plugin.EndsWith("Diff.dll"))
                            continue;

                        Assembly asm = null;
                        try
                        {
                            asm = Assembly.LoadFile(Plugin);
                        }
                        catch { }

                        if (asm != null)
                        {
                            Type[] types = asm.GetTypes();

                            foreach (Type t in types)
                            {
                                if (t.GetInterface("IAWBPlugin") != null)
                                {
                                    IAWBPlugin plugin = (IAWBPlugin)Activator.CreateInstance(t);
                                    Items.Add(plugin.Name, plugin);
                                    if (plugin.Name == "Kingbotk Plugin" && t.Assembly.GetName().Version.Major < 2)
                                        MessageBox.Show("You are using an out of date version of the Kingbotk Plugin. Please upgrade.",
                                            "Kingbotk Plugin", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                                    InitialisePlugin(plugin, awb);

                                    if (afterStartup) UsageStats.AddedPlugin(plugin);
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Problem loading plugins");
                }
            }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:43,代码来源:PluginManager.cs

示例12: AWBLogListenerUploadFailed

 private void AWBLogListenerUploadFailed(Exception ex, string sender, AWBLogListener logListener,
     IAutoWikiBrowser AWB)
 {
     logListener.WriteLine("Error: " + ex.Message, sender);
     ((IMyTraceListener)logListener).SkippedArticle(sender, "Error");
     //AWB.AddLogItem(false, logListener);
 }
开发者ID:svick,项目名称:AWB,代码行数:7,代码来源:LogUploader.cs

示例13: DoAWBLogListener

 private static bool DoAWBLogListener(bool doIt, IAutoWikiBrowser awb)
 {
     return (doIt && awb != null);
 }
开发者ID:svick,项目名称:AWB,代码行数:4,代码来源:LogUploader.cs

示例14: ProcessArticle

 public string ProcessArticle(IAutoWikiBrowser sender, ProcessArticleEventArgs eventargs)
 {
     return eventargs.ArticleText;
 }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:4,代码来源:TypoScanAWBPlugin.cs

示例15: Initialise

		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();
		}
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:69,代码来源:PluginManager.cs


注:本文中的IAutoWikiBrowser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。