public static void NavigateToParking(System.Windows.Navigation.NavigationService NavgServ) { string selParking = IsolatedStorageSettings.ApplicationSettings[_SelParking].ToString(); switch (selParking) { case "1": NavgServ.Navigate(new Uri("/Parking_Pentagon.xaml", UriKind.Relative)); break; case "2": NavgServ.Navigate(new Uri("/Parking_Amanora.xaml", UriKind.Relative)); break; default: MessageBox.Show("App is not configured for selected Parking"); break; } }
public static void Authorization(System.Windows.Forms.WebBrowser webBrowser) { webBrowser.Navigate(String.Format("https://oauth.vk.com/authorize?client_id={0}&scope={1}&redirect_uri={2}&display=page&response_type=token", AppID, Scope, RedirectUri)); }
void ShowTemplate(System.Windows.Forms.WebBrowser browser, FrameworkTemplate template) { if( template == null ) { browser.DocumentText = "(no template)"; return; } // Write the template to a file so that the browser knows to show it as XML string filename = System.IO.Path.GetTempFileName(); File.Delete(filename); filename = System.IO.Path.ChangeExtension(filename, "xml"); // pretty print the XAML (for View Source) using( XmlTextWriter writer = new XmlTextWriter(filename, System.Text.Encoding.UTF8) ) { writer.Formatting = Formatting.Indented; XamlWriter.Save(template, writer); } // Show the template browser.Navigate(new Uri(@"file:///" + filename)); }
public HtmlDocument loadDocument(ref System.Windows.Forms.WebBrowser oBrowser, String sURL) { CountedWait oCWTimer = new CountedWait(ref oBrowser, 3000); while (true) { try { oBrowser.Navigate(sURL); if (oCWTimer.Wait(10)) { return oBrowser.Document; } else { //System.Console.WriteLine("Proxy timeout, switching to next one."); oWININET.RefreshIEProxySettings(); } } catch (UnauthorizedAccessException uex) { throw new UnauthorizedAccessException("..::" + this.GetType().Name + "::..loadDocument has thrown an exception.", uex); } catch (AccessViolationException ex) { throw new AccessViolationException("..::" + this.GetType().Name + "::..loadDocument has thrown an exception.", ex); } catch (Exception ex) { System.Console.WriteLine("..::" + this.GetType().Name + "::..loadDocument thrown an exception, reason: " + ex.Message + "\n" + ex.StackTrace + ", switching proxy"); oWININET.RefreshIEProxySettings(); } } }
/// <summary> /// Navigates the browser object to the Phone Screenshot page, setting appropiate headers for username/password /// </summary> /// <param name="browser">The WebBrowser object to navigate /// </param> /// <exception > Any exception on the HttpWebRequest </exception> public void navigateScreenShot(System.Windows.Forms.WebBrowser browser) { if (browser != null && checkConnection()) browser.Navigate(String.Format("http://{0}/CGI/Screenshot", _phoneIP), null, null, "Authorization: Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes(_user + ":" + _password)) + "\r\n"); }
/// <summary> /// Load rule Frame by Rule Id /// </summary> public IscraperBuilder.Controls.Rules.Rule.IRule LoadRuleFrame(string ruleId, System.Windows.Controls.Frame f, bool useCustomType, Type t) { IscraperBuilder.Controls.Rules.Rule.IRule h = getRuleById(ruleId, useCustomType, t); if (h != null) { f.Navigate(h); f.Visibility = System.Windows.Visibility.Visible; return h; } return null; }