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(); }
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)); } }
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(); }