当前位置: 首页>>代码示例>>C#>>正文


C# WebBrowser.Navigate方法代码示例

本文整理汇总了C#中WebBrowser.Navigate方法的典型用法代码示例。如果您正苦于以下问题:C# WebBrowser.Navigate方法的具体用法?C# WebBrowser.Navigate怎么用?C# WebBrowser.Navigate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WebBrowser的用法示例。


在下文中一共展示了WebBrowser.Navigate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: createWebView

        internal async Task createWebView(Dictionary<string, object> options)
        {
            try
            {
            //    throw new NotImplementedException();
#if WINDOWS_WIN32_WPF
                _browserWindow.createWindow(options);
                WebBrowser webView = _browserWindow._window.webBrowser;
#elif WINDOWS_WIN32_WF
                     WebBrowser webView = new WebBrowser();       
                    _browserWindow.createWindow(options, webView);
#endif
                this.webView = webView;
                _browserWindow.webView = webView;

                string url;
                if (options.ContainsKey(NKEBrowserOptions.kPreloadURL))
                    url = (string)options[NKEBrowserOptions.kPreloadURL];
                else
                    url = NKEBrowserDefaults.kPreloadURL;

                webView.Navigate(new Uri(url));

#if WINDOWS_WIN32_WPF
                webView.Navigating += this.WebView_Navigating;
                webView.LoadCompleted += this.WebView_LoadCompleted;
#elif WINDOWS_WIN32_WF
                    webView.Navigating += this.WebView_Navigating;
                    webView.DocumentCompleted += this.WebView_DocumentCompleted;
#endif
                this.init_IPC();

                _browserWindow.context = await NKSMSWebBrowserContext.getScriptContext(_id, webView, options);

                this._type = NKEBrowserType.MSWebView.ToString();
                if (options.itemOrDefault<bool>("NKE.InstallElectro", true))
                    await Renderer.addElectro(_browserWindow.context, options);
                NKLogging.log(string.Format("+E{0} Renderer Ready", _id));

                _browserWindow.events.emit("NKE.DidFinishLoad", _id);
      
            }
            catch (Exception ex)
            {
                NKLogging.log("!Error creating browser webcontent: " + ex.Message);
                NKLogging.log(ex.StackTrace);
            }
            options = null;

        }
开发者ID:nodekit-io,项目名称:nodekit-windows,代码行数:50,代码来源:NKE_WebContents_win32.cs

示例2: Capture

    protected void Capture(object sender, EventArgs e)
    {
        string url = txtUrl.Text.Trim();

        Thread thread = new Thread(delegate()
        {
            using (WebBrowser browser = new WebBrowser())
            {
                browser.ScrollBarsEnabled = false;
                browser.AllowNavigation = false;
                browser.AllowWebBrowserDrop = false;
                browser.ScriptErrorsSuppressed = true;
                browser.Navigate("www.cnn.com");
                //browser.Navigate((url, null, <data>, "Content-Type: application/x-www-form-urlencoded");)
                browser.Width = 1024;
                browser.Height = 768;
                browser.ClientSize = new Size(1024,768);
                browser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(DownloadCompleted);
                while ((browser.IsBusy) |  (browser.ReadyState != WebBrowserReadyState.Complete))
                {
                    System.Windows.Forms.Application.DoEvents();
                }
                //Thread.Sleep(5000);
                //browser.Dispose();
            }
        });
        thread.SetApartmentState(ApartmentState.STA);
        thread.Start();
        thread.Join();
    }
开发者ID:hansparsons,项目名称:SharePage,代码行数:30,代码来源:MainPage.aspx.cs

示例3: GetAppLinkFromUrlInBackground

 public void GetAppLinkFromUrlInBackground(Uri uri)
 {
     appLinkCrawlerBrowser = new WebBrowser();
     appLinkCrawlerBrowser.IsScriptEnabled = true;
     appLinkCrawlerBrowser.ScriptNotify += AppLinkCrawlerBrowserOnScriptNotify;
     appLinkCrawlerBrowser.LoadCompleted += AppLinkCrawlerBrowserOnLoadCompleted;
     appLinkCrawlerBrowser.Navigate(uri);
 }
开发者ID:RishabhHarit,项目名称:facebook-winclient-sdk,代码行数:8,代码来源:WebViewAppLinkResolver.cs

示例4: InitializeWebView

 protected virtual void InitializeWebView(WebBrowser webview)
 {
     this.webview = webview;
     webview.Loaded += Browser_Loaded;
     webview.Navigating += Browser_Navigating;
     webview.NavigationFailed += Browser_NavigationFailed;
     webview.LoadCompleted += Browser_LoadCompleted;
     webview.ScriptNotify += Browser_ScriptNotify;
     webview.IsScriptEnabled = true;
     webview.Navigate(new Uri("/webview/webview.html", UriKind.RelativeOrAbsolute));
 }
开发者ID:jarkkom,项目名称:awfuldotnet,代码行数:11,代码来源:WebViewAwarePage.cs

示例5: OnNavigatedTo

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            string tag = "";

            if (NavigationContext.QueryString.TryGetValue("imageTag", out tag))
            {
                string url = App.ImagesUrl[Convert.ToInt32(tag)];
                WebBrowser webBrowser = new WebBrowser();
                webBrowser.Navigate(new Uri(url, UriKind.Absolute));
                webBrowser.Navigated += new EventHandler<NavigationEventArgs>(NavigateHandler);
                webBrowser.NavigationFailed += WebBrowser_NavigationFailed;
                webBrowser.Margin.Top.Equals(-12);
                webBrowser.IsScriptEnabled = true;
                browserGrid.Children.Add(webBrowser);
                imageName.Text = App.ImagesName[Convert.ToInt32(tag)];
            }
        }
开发者ID:EdytaSzkiladz,项目名称:MyLocalPharmacy,代码行数:19,代码来源:WebView.xaml.cs

示例6: logout

        private void logout()
        {
            var logoutUri = new Uri("http://note.youdao.com/?auto=1");
            var wb = new WebBrowser {IsScriptEnabled = true};
            wb.LoadCompleted += (sender, e) =>
            {
                try
                {
                    wb.InvokeScript("eval", "document.getElementById('dropdown-list').style.display = 'block';var links = document.getElementsByTagName('a');for (var i = 0; i < links.length; i++) { if (links[i].innerText == '注销') { links[i].click(); break; } }");
                }
                catch (Exception ex)
                {
                    LoggerFactory.GetLogger().Error("退出有道云笔记登录时失败", ex);
                }
                finally
                {
                    NavigationService.Navigate(new Uri("/Views/MainView.xaml?from=authorizePage", UriKind.Relative));
                }
            };

            wb.Navigate(logoutUri);
        }
开发者ID:ciker,项目名称:WPYoudaonNote,代码行数:22,代码来源:AuthorizeView.xaml.cs

示例7: Authorize

 /// <summary>
 /// Authorize the application with permissions.
 /// Calls onSuccess after correct response, onError otherwise(in callbackContext thread).
 /// </summary>
 /// <param name="browser">browser element will be used for OAuth2 authorisation.</param>
 /// <param name="callbackContext">PhoneApplicationPage in context of witch RequestCallback would be called. Used to make working with UI components from callbacks simplier.</param>
 /// <param name="onSuccess">this function will be called after success authorisation(in callbackContext thread)</param>
 /// <param name="onError">this function will be called after unsuccess authorisation(in callbackContext thread)</param>
 /// <param name="saveSession">if true, saves refresh ann access tokens to application islolated storage</param>
 public void Authorize(WebBrowser browser, PhoneApplicationPage callbackContext, Action onSuccess, Action<Exception> onError, bool saveSession = true)
 {
     this._authCallback.OnSuccess = onSuccess;
     this._authCallback.OnError = onError;
     this._authCallback.CallbackContext = callbackContext;
     this._authCallback.SaveSession = saveSession;
     Uri uri = new Uri(String.Format(UriTemplateAuth, this._appId, this._permissions, this._redirectUrl), UriKind.Absolute);
     browser.Navigated += NavigateHandler;
     browser.Navigate(uri);
 }
开发者ID:jorik041,项目名称:win_phone_sdk_and_example,代码行数:19,代码来源:Odnoklassniki.cs

示例8: Authenticate

 /// <summary>
 /// Method to use when you want your user to authenticate in order to get an AccessToken, 
 /// after calling this method you should use the GetAccesToken method to retrieve your user's accessToken and store it
 /// so you don't have to call this method everytime
 /// </summary>
 /// <param name="browser">Put the webBrowser control you want your user to use in order to log into Foursquare to get their accessToken</param>
 public static void Authenticate(WebBrowser browser)
 {
     browser.Navigated += browser_Navigated;
     browser.Navigate(new Uri("https://foursquare.com/oauth2/authorize" +
        "?client_id=" + AppDetails.clientID+
        "&redirect_uri=" + AppDetails.urlHomePage +
        "&response_type=token", UriKind.Absolute));
 }
开发者ID:JorgeCupi,项目名称:WinSquare,代码行数:14,代码来源:LogIn.cs

示例9: post_data

 public static void post_data(string url,string ms, string size, string files)
 {
     WebBrowser wb = new WebBrowser();
     wb.Navigate(string.Format("{0}/{1}/{2}/{3}", url, ms, size, files));
 }
开发者ID:ToyzStore,项目名称:-ACID-Cache-Cleaner,代码行数:5,代码来源:Post_Help.cs

示例10: GetVerifier

        private Task<IDictionary<string, string>> GetVerifier(WebBrowser browser, Uri uri)
        {
            var task =
                Observable
                    .FromEventPattern<NavigatingEventArgs>(
                        h => browser.Navigating += h,
                        h => browser.Navigating -= h)
                    .Where(e => Regex.IsMatch(e.EventArgs.Uri.ToString(), @"http://trainshare.ch"))
                    .Take(1)
                    .Do(e => e.EventArgs.Cancel = true)
                    .Select(e => e.EventArgs.Uri.ToString())
                    .Select(address => address.Substring(address.IndexOf('?') + 1))
                    .ToTask()
                    .ParseQueryString();

            browser.Navigate(uri);

            return task;
        }
开发者ID:trainshare,项目名称:TrainShareApp,代码行数:19,代码来源:TwitterClient.cs

示例11: BuildSubURLTabs

    public void BuildSubURLTabs(object sender, EventArgs ev, URLTabPlugin.TabTypes tt)
    {
        if (sender != null)
        {

            /* Create a panel, find the parent form and maximize it */
            Panel p = (Panel)sender;
            TabPage c = (TabPage)p.Parent;
            Form f = c.FindForm();
            f.WindowState = FormWindowState.Maximized;
            TabControl tc = new TabControl();
            p.Controls.Add(tc);
            tc.Dock = DockStyle.Fill;

            /* Create a list of URLTabs */

            this.propertyString = "URLTabPlugin+" + c.Text.Replace(" ", "_");

            string result = objHost.GetSQL("SELECT Value FROM properties where Name LIKE '%" + this.propertyString + "%'");

            var UTP = Activator.CreateInstance<List<URLTabPlugin>>();

            if (result != "-9999")
            {

                using (var memoryStream = new MemoryStream(Encoding.Unicode.GetBytes(result)))
                {
                    var serializer = new DataContractJsonSerializer(UTP.GetType());
                    UTP = (List<URLTabPlugin>)serializer.ReadObject(memoryStream);
                }

                foreach (URLTabPlugin utp in UTP)
                {
                    if (utp.TabType == tt)
                    {

                        TabPage tp = new TabPage(utp.TabLabel);
                        tc.Controls.Add(tp);
                        tp.Dock = DockStyle.Fill;
                        tp.BringToFront();
                        WebBrowser wb = new WebBrowser();
                        wb.AllowNavigation = true;
                        wb.AllowWebBrowserDrop = false;
                        wb.ScriptErrorsSuppressed = true;
                        wb.ScrollBarsEnabled = true;
                        wb.IsWebBrowserContextMenuEnabled = true;
                        tp.Controls.Add(wb);
                        wb.Dock = DockStyle.Fill;
                        wb.BringToFront();
                        wb.Navigate(utp.TabUrl);
                        wb.Refresh();
                    }
                }
            }
            /* Build the config tab */
            TabPage tconfig = new TabPage("Config");
            tc.Controls.Add(tconfig);
            tconfig.Dock = DockStyle.Fill;

            /* Dynamic flow layout to hold the buttons */
            FlowLayoutPanel buttonFlowLayoutPanel = new FlowLayoutPanel();
            buttonFlowLayoutPanel.BringToFront();
            buttonFlowLayoutPanel.FlowDirection = FlowDirection.LeftToRight;
            buttonFlowLayoutPanel.Location = new System.Drawing.Point(8, 10);
            buttonFlowLayoutPanel.Size = new System.Drawing.Size(510, 32);
            tconfig.Controls.Add(buttonFlowLayoutPanel);
            Button btnSaveConfig = new Button();
            btnSaveConfig.Text = "Save Config";
            btnSaveConfig.Click += new EventHandler(btnSaveConfig_Click);
            Button btnAddTab = new Button();
            btnAddTab.Text = "Add Tab";
            btnAddTab.Click += new EventHandler(btnAddTab_Click);
            buttonFlowLayoutPanel.Controls.Add(btnSaveConfig);
            buttonFlowLayoutPanel.Controls.Add(btnAddTab);

            /* Dynamic Flow Layout to hold taburlconfigs */
            dynamicFlowLayoutPanel = new FlowLayoutPanel();
            dynamicFlowLayoutPanel.BringToFront();
            dynamicFlowLayoutPanel.FlowDirection = FlowDirection.TopDown;
            dynamicFlowLayoutPanel.Location = new System.Drawing.Point(0, 40);
            dynamicFlowLayoutPanel.Size = new System.Drawing.Size(510,600);
            dynamicFlowLayoutPanel.AutoScroll = true;
            dynamicFlowLayoutPanel.WrapContents = false;
            tconfig.Controls.Add(dynamicFlowLayoutPanel);

            string results = objHost.GetSQL("SELECT Value FROM properties where Name LIKE '%" + propertyString + "%'");
            if (results != "-9999")
            {
                List<string> TabsCompleted = new List<string>();

                /* Rewrite, this doesn't make sense. Deserialize it instead and loop through those results. */
                foreach (URLTabPlugin utp in UTP)
                {
                    URLTabPluginConfigTab utpct;

                    // If the tab isn't in the list yet, create it
                    if (TabsCompleted.IndexOf(utp.TabLabel) < 0)
                    {
                        TabsCompleted.Add(utp.TabLabel);
                        utpct = new URLTabPluginConfigTab();
//.........这里部分代码省略.........
开发者ID:ManagedITStack,项目名称:labtech_URLTabPlugin,代码行数:101,代码来源:Tabs.cs

示例12: Capture

    /*Parametrelerin Elde edilmesi*/
    /*Rapor*/

    
   
    
  
      protected void Capture(object sender, EventArgs e)
    {

        Thread thread = new Thread(delegate()
        {
            using (WebBrowser browser = new WebBrowser())
            {
                string url = "http://localhost:11127/EkranListesi/Tvlistreport.aspx";
                browser.ScrollBarsEnabled = false;
                browser.Navigate(url);

                browser.Width = 1024;
                browser.Height = 768;
                browser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(DocumentCompleted);
                while (browser.ReadyState != WebBrowserReadyState.Complete)
                {
                    System.Windows.Forms.Application.DoEvents();
                }
            }
        });
        thread.SetApartmentState(ApartmentState.STA);
        thread.Start();
        thread.Join();
    }
开发者ID:fgulsoy24,项目名称:Tu-Sinav-Derslik-Sistemi,代码行数:31,代码来源:Tvlistreport.aspx.cs

示例13: Main

	static void Main ()
	{
		WebBrowser wb = new WebBrowser ();
		wb.Navigate ("http://www.mono-project.com");
		wb.Dispose ();
	}
开发者ID:mono,项目名称:gert,代码行数:6,代码来源:test.cs

示例14: LoadState

        private void LoadState()
        {
            try
            {
                AppState.Current = PersistableFile<AppState>.Load(Constants.AppStateFileName).Data;
                if (AppState.Current.Date < DateTime.Today)
                {
                    AppState.Current = null;
                    SettingsManager.CurrentDate = DateTime.Today;
                }

                var fb = new FacebookManager(SettingsManager.FacebookToken);
                var wb = new WebBrowser();
                FacebookOAuthResult result = null;
                wb.Navigated += (sender, e) =>
                {
                    result = FacebookManager.GetToken(e.Uri);
                    if (result == null)
                        SettingsManager.FacebookToken = null;
                    else
                        SettingsManager.FacebookToken = result.AccessToken;
                };
                wb.Navigate(FacebookManager.GetFacebookLoginUrl());
            }
            catch (Exception)
            {
                AppState.Current = null;
            }
        }
开发者ID:alexcons,项目名称:MyMovies,代码行数:29,代码来源:App.xaml.cs

示例15: from_pinnaclesports_2

    public BsonDocument from_pinnaclesports_2(ref WebBrowser browser, BsonDocument doc_result)
    {
        string html = BrowserHelper.get_html(ref browser);
        StringBuilder sb = new StringBuilder();
        string result = "";

        string url = "";
        try
        {
            //================================================================
            if (doc_result["url2"].AsBsonArray.Count == 0)
            {
                url = doc_result["url1"].AsBsonArray[0].ToString();
                doc_result["url2"].AsBsonArray.Add(url);
                browser.Navigate(url);
                doc_result["loop"].AsBsonArray.Add("2");

                doc_result["data"] = "Start Read First URL ->" + url;
                doc_result["url"] = browser.Document.Url.ToString();
                return doc_result;
            }
            //---------------------------------------------------------------
            HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
            doc.LoadHtml(html);
            HtmlNodeCollection nodes_all = doc.DocumentNode.SelectNodes(@"//*");
            ArrayList list_lg = new ArrayList();
            ArrayList list_times = new ArrayList();
            ArrayList list_teams = new ArrayList();
            ArrayList list_odds = new ArrayList();
            foreach (HtmlNode node in nodes_all)
            {

                if (node.Name == "table" && node.Attributes.Contains("class") && node.Attributes["class"].Value == "linesTbl")
                {
                    if (doc.DocumentNode.SelectSingleNode(node.XPath + "/tbody[1]/tr[2]/td[1]").InnerText.ToLower().Contains("half")) continue;
                    string lg_name = "";
                    string tr_path = node.XPath + "/tbody[1]/tr";
                    HtmlNodeCollection nodes_tr = doc.DocumentNode.SelectNodes(tr_path);
                    foreach (HtmlNode node_tr in nodes_tr)
                    {
                        switch (node_tr.Attributes["class"].Value.ToString())
                        {
                            case "linesHeader":
                                string lg_temp = doc.DocumentNode.SelectSingleNode(node_tr.XPath + "/td[1]/h4[1]").InnerText;
                                string[] lg_list = lg_temp.Split('-');
                                lg_name = lg_list[0] + "-" + lg_list[1];
                                break;
                            case "linesAlt1":
                                if (string.IsNullOrEmpty(doc.DocumentNode.SelectSingleNode(node_tr.XPath + "/td[6]").InnerText.Replace("&nbsp;", "").Trim())) continue;
                                if (doc.DocumentNode.SelectSingleNode(node_tr.XPath + "/td[6]").InnerText.Contains("Offline")) continue;

                                list_lg.Add(lg_name);
                                list_times.Add(doc.DocumentNode.SelectSingleNode(node_tr.XPath + "/td[1]").InnerText);
                                list_teams.Add(doc.DocumentNode.SelectSingleNode(node_tr.XPath + "/td[3]").InnerText);
                                list_odds.Add(doc.DocumentNode.SelectSingleNode(node_tr.XPath + "/td[6]").InnerText.Replace("&nbsp;", "").Trim());
                                break;
                            case "linesAlt2":
                                if (string.IsNullOrEmpty(doc.DocumentNode.SelectSingleNode(node_tr.XPath + "/td[6]").InnerText.Replace("&nbsp;", "").Trim())) continue;
                                if (doc.DocumentNode.SelectSingleNode(node_tr.XPath + "/td[6]").InnerText.Contains("Offline")) continue;

                                list_lg.Add(lg_name);
                                list_times.Add(doc.DocumentNode.SelectSingleNode(node_tr.XPath + "/td[1]").InnerText);
                                list_teams.Add(doc.DocumentNode.SelectSingleNode(node_tr.XPath + "/td[3]").InnerText);
                                list_odds.Add(doc.DocumentNode.SelectSingleNode(node_tr.XPath + "/td[6]").InnerText.Replace("&nbsp;", "").Trim());
                                break;
                            default:
                                break;
                        }

                    }
                }
            }
            for (int i = 0; i < list_lg.Count; i++)
            {
                if ((i + 2) < list_lg.Count)
                {
                    string f_lg = list_lg[i].ToString();
                    string f_time = list_times[i].ToString() + " " + list_times[i + 1].ToString();
                    string f_host = list_teams[i].ToString();
                    string f_client = list_teams[i + 1].ToString();
                    string f_win = list_odds[i].ToString();
                    string f_draw = list_odds[i + 2].ToString();
                    string f_lose = list_odds[i + 1].ToString();
                    Match100Helper.insert_data("pinnaclesports", f_lg, f_time, f_host, f_client, f_win, f_draw, f_lose, "-7", "1");
                    sb.AppendLine(f_lg.PR(50) + f_time.PR(20) + f_host.PR(30) + f_client.PR(30) + f_win.PR(20) + f_draw.PR(20) + f_lose.PR(20));
                }
                i = i + 2;
            }

        }
        catch (Exception error)
        {

            sb.AppendLine(error.Message + Environment.NewLine + error.StackTrace);
            Log.error("from_pinnaclesports_2", error);
        }

        //--------------------------------------------------------------
        if (doc_result["url1"].AsBsonArray.Count == doc_result["url2"].AsBsonArray.Count)
        {
//.........这里部分代码省略.........
开发者ID:topomondher,项目名称:web_helper,代码行数:101,代码来源:Match100Method.cs


注:本文中的WebBrowser.Navigate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。