// Handle all the button clicks (Panel). private void CommonClickHandler(object sender, EventArgs e) { if (sender.GetType() != typeof(Panel)) // only accept panels.. { return; } Panel btn = (sender as Panel); if (btn.Equals(btnCloseBrowser)) // if the close button was clicked.. { Close(); // .. do close the form } else if (btn.Equals(btnRefresh)) // if the wind forward was clicked.. { browser.Reload(); } else if (btn.Equals(btnBack)) { browser.GoBack(); } else if (btn.Equals(btnForward)) { browser.GoForward(); } else if (btn.Equals(btnBrowserHome)) { browser.Navigate(startURL); } }
public void Navigating_NavigationError_Chrome() { int errorCount = 0, completeCount = 0; browser.DocumentCompleted += (sender, e) => ++ completeCount; browser.NavigationError += (sender, e) => ++ errorCount; browser.Navigate("chrome://global/content/bindings/general.xml"); //good url browser.NavigateFinishedNotifier.BlockUntilNavigationFinished(); Assert.True(errorCount == 0 && completeCount == 1); errorCount = completeCount = 0; browser.Navigate("chrome://global/content/aaaa"); //not found browser.NavigateFinishedNotifier.BlockUntilNavigationFinished(); Assert.True(errorCount == 1 && completeCount == 0); errorCount = completeCount = 0; Assert.True(browser.CanGoBack); browser.GoBack(); browser.NavigateFinishedNotifier.BlockUntilNavigationFinished(); Assert.True(errorCount == 0 && completeCount == 1); errorCount = completeCount = 0; Assert.True(browser.CanGoForward); browser.GoForward(); browser.NavigateFinishedNotifier.BlockUntilNavigationFinished(); Assert.True(errorCount == 1 && completeCount == 0); errorCount = completeCount = 0; browser.Navigate("chrome://global/bindings/general.xml"); //missing 'content' part browser.NavigateFinishedNotifier.BlockUntilNavigationFinished(); Assert.True(errorCount == 1 && completeCount == 0); errorCount = completeCount = 0; browser.Navigate("chrome://global/content/bindings/general.xml"); browser.Stop(); browser.NavigateFinishedNotifier.BlockUntilNavigationFinished(); Assert.True(errorCount == 1 && completeCount == 0); errorCount = completeCount = 0; browser.Navigate("chrome://global/content/bindings/general.xml"); browser.Navigating += (sender, e) => e.Cancel = true; browser.NavigateFinishedNotifier.BlockUntilNavigationFinished(); Assert.True(errorCount == 1 && completeCount == 0); errorCount = completeCount = 0; }
/// <summary> /// Invoke "go forward" in browser history /// </summary> public void Forward() { CheckDisposed(); try { m_browser.GoForward(); } catch { m_browser.Refresh(); } }
private void B_Backward_Click(object sender, RoutedEventArgs e) { browser.GoForward(); }