public void OpenUrl(string url) { TextBoxUrl.Text = url; wbc_browsing.Navigate(url); TextBoxUrl.SelectAll(); TabWebBrowserControls.MakeActive(TAB_BROWSING); }
internal void ObjWebBrowser_Navigating(WebBrowserControl wbc, Uri uri) { lblHintHowToUse.Visibility = Visibility.Hidden; if (wbc == active_wbc) { TextBoxUrl.Text = uri.ToString(); TextBoxUrl.SelectAll(); if (null != Navigating) { Navigating(uri); } } }
void DoBrowse() { FeatureTrackingManager.Instance.UseFeature(Features.Web_Browse); string uri = TextBoxUrl.Text; // If they are holding down CTRL, add www.XYZ.com to XYZ if ((Keyboard.Modifiers & ModifierKeys.Control) > 0) { if (!uri.EndsWith(".com")) { uri = uri + ".com"; } if (!uri.StartsWith("www.") && !uri.StartsWith("http")) { uri = "www." + uri; } TextBoxUrl.Text = uri; } // If they are missing http:// or the like, then add it if (uri.Contains('.') && !Uri.IsWellFormedUriString(uri, UriKind.Absolute)) { string http_uri = "http://" + uri; if (Uri.IsWellFormedUriString(http_uri, UriKind.Absolute)) { uri = http_uri; TextBoxUrl.Text = http_uri; } } if (Uri.IsWellFormedUriString(uri, UriKind.Absolute)) { CurrentWebBrowserControl.Navigate(new Uri(uri)); } else { DoWebSearch(uri); } // Reselect all text so that it is easy to retype TextBoxUrl.SelectAll(); }