Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I would just call <code>Navigate</code> again at the end of the <code>LoadCompleted</code> handler. Then, I guess, use a window-scoped variable to keep track of your target URLs.</p> <pre><code>List&lt;string&gt; _urls; int _i = 0; private void Window_Loaded(object sender, RoutedEventArgs e) { _urls = new List&lt;string&gt;() { url1, url2, url3 }; // URLs to navigate webBrowser1.LoadCompleted += webBrowser1_LoadCompleted; webBrowser1.Navigate(_urls[_i]); } void webBrowser1_LoadCompleted(object sender, NavigationEventArgs e) { // do stuff i++; var nextUrl = _urls[i]; webBrowser1.Navigate(nextUrl); } </code></pre> <p><strong>EDIT</strong></p> <p>Maybe something like this would be more suitable. After each cycle, you can set up the next URL as well as its handler.</p> <pre><code>class NavIteration { public string Url { get; set; } public delegate void HandleResult(object sender, NavigationEventArgs e); public HandleResult ResultHandler { get; set; } } NavIteration CurrentIteration; void setNextIteration() { CurrentIteration = null; CurrentIteration = new NavIteration() { Url = someurl, ResultHandler = (sender, e) =&gt; { // handle } }; } private void Window_Loaded(object sender, RoutedEventArgs e) { webBrowser1.LoadCompleted += webBrowser1_LoadCompleted; setNextIteration(); webBrowser1.Navigate(); } void webBrowser1_LoadCompleted(object sender, NavigationEventArgs e) { CurrentIteration.ResultHandler(sender, e); setNextIteration(); webBrowser1.Navigate(CurrentIteration.Url); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload