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


C# BackgroundRequest.Execute方法代码示例

本文整理汇总了C#中WikiFunctions.Background.BackgroundRequest.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# BackgroundRequest.Execute方法的具体用法?C# BackgroundRequest.Execute怎么用?C# BackgroundRequest.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WikiFunctions.Background.BackgroundRequest的用法示例。


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

示例1: Update

 /// <summary>
 /// Checks to see if AWBUpdater.exe.new exists, if it does, replace it.
 /// If not, see if the version of AWB Updater is older than the version on the checkpage, and run AWBUpdater if so
 /// </summary>
 public static void Update()
 {
     request = new BackgroundRequest();
     request.Execute(UpdateFunc);
 }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:9,代码来源:Updater.cs

示例2: RegExTypoFix

        /// <summary>
        /// Default constructor, typos being loaded on separate thread is optional
        /// </summary>
        /// <param name="loadThreaded">Whether to load typos on a new thread</param>
        /// <param name="provider">Typos provider to use</param>
        public RegExTypoFix(bool loadThreaded, ITyposProvider provider)
        {
            Source = provider;
            if (!loadThreaded)
            {
                MakeRegexes();
                return;
            }

            TypoThread = new BackgroundRequest(Complete);
            TypoThread.Execute(MakeRegexes);
        }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:17,代码来源:RegExTypoFix.cs

示例3: CheckForUpdates

        /// <summary>
        /// Background request to check enabled state of AWB
        /// </summary>
        public static void CheckForUpdates()
        {
            if (_request != null) return;

            _request = new BackgroundRequest();
            _request.Execute(UpdateFunc);
        }
开发者ID:svn2github,项目名称:awb,代码行数:10,代码来源:Updater.cs

示例4: PageLoaded


//.........这里部分代码省略.........

            bool articleIsRedirect = PageInfo.WasRedirected(page);

            // check for redirects when 'follow redirects' is off
            if (chkSkipIfRedirect.Checked && Tools.IsRedirect(page.Text))
            {
                SkipPage("Page is a redirect");
                return;
            }

            //check for redirect
            if (followRedirectsToolStripMenuItem.Checked && articleIsRedirect && !PageReload)
            {
                if ((page.TitleChangedStatus & PageTitleStatus.RedirectLoop) == PageTitleStatus.RedirectLoop)
                {
                    //ignore recursive redirects
                    SkipRedirect("Recursive redirect");
                    return;
                }

                //No double redirects, API should've resolved it

                if (filterOutNonMainSpaceToolStripMenuItem.Checked
                    && (Namespace.Determine(page.Title) != Namespace.Article))
                {
                    SkipRedirect("Page redirects to non-mainspace");
                    return;
                }

                if (ArticleWasRedirected != null)
                    ArticleWasRedirected(page.OriginalTitle, page.Title);

                listMaker.ReplaceArticle(new Article(page.OriginalTitle), TheArticle);
            }

            /* check for normalized page: since we canonicalize title before API read is requested,
             this shouldn't normally be the case: will be the case for female user page normalization
             example https://de.wikipedia.org/w/api.php?action=query&prop=info|revisions&intoken=edit&titles=Benutzer%20Diskussion:MarianneBirkholz&rvprop=timestamp|user|comment|content
             see the <normalized> block */
            if (page.TitleChangedStatus == PageTitleStatus.Normalised)
            {
                listMaker.ReplaceArticle(new Article(page.OriginalTitle), TheArticle);
            }

            ErrorHandler.CurrentRevision = page.RevisionID;

            if (PageReload)
            {
                PageReload = false;
                GetDiff();
                return;
            }

            if (SkipChecks(!chkSkipAfterProcessing.Checked)) // pre-processing of article
                return;

            //check not in use
            if (TheArticle.IsInUse)
            {
                if (chkSkipIfInuse.Checked)
                {
                    SkipPage("Page contains {{inuse}}");
                    return;
                }
                if (!BotMode && !preParseModeToolStripMenuItem.Checked)
                {
                    MessageBox.Show("This page has the \"Inuse\" tag, consider skipping it");
                }
            }


            /* skip pages containing any Unicode character in Private Use Area as RichTextBox seems to break these
             * not exactly wrong as PUA characters won't be found in standard text, but not exactly right to break them either
             * Reference: [[Unicode#Character General Category]] PUA is U+E000 to U+F8FF */
            Match uPUA = UnicodePUA.Match(page.Text);
            if (uPUA.Success)
            {
                if (!_userWarnedAboutUnicodePUA && !preParseModeToolStripMenuItem.Checked && !BotMode)
                {
                    // provide text around PUA character so user can find it
                    string uPUAText = page.Text.Substring(uPUA.Index-Math.Min(25, uPUA.Index), Math.Min(25, uPUA.Index) + Math.Min(25, page.Text.Length-uPUA.Index));
                        MessageBox.Show("This page has character(s) in the Unicode Private Use Area so unfortunately can't be edited with AWB. The page will now be skipped. Surrounding text of first PUA character is: " + uPUAText);
                    _userWarnedAboutUnicodePUA = true;
                }

                SkipPage("Page has character in Unicode Private Use Area");
                return;
            }

            // run process page in a background thread
            // use .Complete event to do rest of processing (skip checks, alerts etc.) once thread finished
            if (automaticallyDoAnythingToolStripMenuItem.Checked)
            {
                RunProcessPageBackground = new BackgroundRequest(RunProcessPageBackgroundComplete);
                RunProcessPageBackground.Execute(ProcessPageBackground);
                RunProcessPageBackground.Complete += AutomaticallyDoAnythingComplete;
                return;
            }
            CompleteProcessPage();
        }
开发者ID:svn2github,项目名称:awb,代码行数:101,代码来源:Main.cs

示例5: ReparseEditBox

        // run process page step of reparse edit box in a background thread
        // use .Complete event to do rest of processing (alerts etc.) once thread finished
        private void ReparseEditBox()
        {
            if (TheArticle == null)
                return;

            if((RunProcessPageBackground != null && (RunProcessPageBackground.ThreadStatus() == System.Threading.ThreadState.Running 
            || RunProcessPageBackground.ThreadStatus() == System.Threading.ThreadState.Background)) ||
            (RunReparseEditBoxBackground != null && (RunReparseEditBoxBackground.ThreadStatus() == System.Threading.ThreadState.Running 
            || RunReparseEditBoxBackground.ThreadStatus() == System.Threading.ThreadState.Background)))
            {
                StatusLabelText = "Background process running";
            	return;
            }

            StatusLabelText = "Processing page";
            StartProgressBar();

            // refresh text from text box to pick up user changes
            TheArticle.AWBChangeArticleText("Reparse", txtEdit.Text, false);

            RunReparseEditBoxBackground = new BackgroundRequest(ReparseEditBoxBackgroundComplete);
            RunReparseEditBoxBackground.Execute(ReparseEditBoxBackground);
            RunReparseEditBoxBackground.Complete += ReparseEditBoxComplete;
            return;
        }
开发者ID:svn2github,项目名称:awb,代码行数:27,代码来源:Main.cs

示例6: Update

 /// <summary>
 /// Checks to see if AWBUpdater.exe.new exists, if it does, replace it.
 /// If not, see if the version of AWB Updater is older than the version on the checkpage, and run AWBUpdater if so
 /// </summary>
 public static void Update()
 {
     request = new BackgroundRequest();
     request.Execute(new ExecuteFunctionDelegate(UpdateFunc));
 }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:9,代码来源:Updater.cs


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