コード例 #1
0
ファイル: Agent.cs プロジェクト: righnatios/WebScraper.NET
        public virtual void doActions(List <WebAction> actions)
        {
            completedEventHandler         = new WebBrowserDocumentCompletedEventHandler(this.pageLoaded);
            WebBrowser.DocumentCompleted += completedEventHandler;
            Queue <WebAction> activeActions = new Queue <WebAction>(actions);

            while (0 < activeActions.Count)
            {
                activeAction = activeActions.Dequeue();
                if (activeAction.canDoAction(this))
                {
                    if (activeAction.shouldWaitAction(this))
                    {
                        trigger.Reset();
                        WaitHandle.WaitAny(waitHandles);
                    }
                    activeAction.doAction(this);
                    if (activeAction.isWaitForEvent())
                    {
                        trigger.Reset();
                        WaitHandle.WaitAny(waitHandles);
                    }
                }
            }
            completedActions();
        }
コード例 #2
0
ファイル: Agent.cs プロジェクト: js0007/WebScraper.NET
 public void doAction()
 {
     if (activeAction.isWaitForEvent())
     {
         ThreadPool.QueueUserWorkItem(new WaitCallback(scheduleAction), Tuple.Create(activeAction, this));
         //Wait
     }
     else
     {
         activeAction.doAction(this);
         ThreadPool.QueueUserWorkItem(new WaitCallback(scheduleNextAction), Tuple.Create(this));
     }
 }
コード例 #3
0
ファイル: Agent.cs プロジェクト: righnatios/WebScraper.NET
 public virtual void doActions(List<WebAction> actions)
 {
     completedEventHandler = new WebBrowserDocumentCompletedEventHandler(this.pageLoaded);
     WebBrowser.DocumentCompleted += completedEventHandler;
     Queue<WebAction> activeActions = new Queue<WebAction>(actions);
     while (0 < activeActions.Count)
     {
         activeAction = activeActions.Dequeue();
         if (activeAction.canDoAction(this))
         {
             if (activeAction.shouldWaitAction(this))
             {
                 trigger.Reset();
                 WaitHandle.WaitAny(waitHandles);
             }
             activeAction.doAction(this);
             if (activeAction.isWaitForEvent())
             {
                 trigger.Reset();
                 WaitHandle.WaitAny(waitHandles);
             }
         }
     }
     completedActions();
 }