Bloom.NavigationIsolator.Navigate C# (CSharp) Method

Navigate() public method

Navigate the specified browser to the specified url as soon as it is safe to do so (that is, immediately or when all other navigations we know about that were started sooner have completed). Must be called on UI thread.
public Navigate ( Gecko.GeckoWebBrowser browser, string url ) : void
browser Gecko.GeckoWebBrowser
url string
return void
        public void Navigate(GeckoWebBrowser browser, string url)
        {
            if (browser.InvokeRequired)
                throw new Exception("Navigation should only be done on the main UI thread");
            Navigate(new IsolatedBrowser(browser), url);
        }

Same methods

NavigationIsolator::Navigate ( IIsolatedBrowser browser, string url ) : void

Usage Example

        public void Isolation_AfterLongDelay_GivesUpAndMovesOn()
        {
            var browser = new BrowserStub();
            string target = "http://any old web address";
            var isolator = new NavigationIsolator();
            isolator.Navigate(browser, target);
            Assert.That(browser.NavigateTarget, Is.EqualTo(target));

            var browser2 = new BrowserStub();
            string target2 = "http://some other web address";
            isolator.Navigate(browser2, target2);
            var browser3 = new BrowserStub();
            string target3 = "http://yet another web address";
            isolator.Navigate(browser3, target3);
            Assert.That(browser.NavigateTarget, Is.EqualTo(target), "Second navigation should not have proceeded at once");
            var start = DateTime.Now;
            while (DateTime.Now - start < new TimeSpan(0, 0, 0, 2, 300))
                Application.DoEvents(); // allow timer to tick.
            Assert.That(() => browser2.NavigateTarget, Is.EqualTo(target2), "Second navigation should have proceeded eventually");

            browser2.NormalTermination(); // the second request.
            Assert.That(() => browser3.NavigateTarget, Is.EqualTo(target3), "Third navigation should have proceeded when second finished");

            browser3.NormalTermination(); // hopefully from the third.
            Assert.That(browser3.EventHandlerCount, Is.EqualTo(0), "event handlers should be removed once last navigation completed");
        }
All Usage Examples Of Bloom.NavigationIsolator::Navigate