2014-09-18 31 views
0

我使用的是Windows桌面應用程序的代碼獲得組合框的,我需要選擇至極後會用新信息usign更新頁面中的值的JavaScriptWeb客戶端上存儲的通用應用

private WebBrowser withEventsField_wb; 
WebBrowser wb { 
    get { return withEventsField_wb; } 
    set { 
     if (withEventsField_wb != null) { 
      withEventsField_wb.Navigated -= navigated; 
     } 
     withEventsField_wb = value; 
     if (withEventsField_wb != null) { 
      withEventsField_wb.Navigated += navigated; 
     } 
    } 
} 
private void Form1_Load(object sender, EventArgs e) 
{ 
    wb = new WebBrowser(); 
    wb.Navigate("https://academicos.ubi.pt/online/horarios.aspx?p=a"); 
} 

private void navigated() 
{ 
    HtmlElementCollection allelements = wb.Document.All; 
    HtmlElement year = default(HtmlElement); 
    foreach (HtmlElement webpageelement in allelements) { 
     if (webpageelement.GetAttribute("id").Contains("ContentPlaceHolder1_ddlAnoLect") == true) { 
      year = webpageelement; 
      HtmlElementCollection yoptions = year.Children; 
      foreach (HtmlElement yopt in yoptions) { 
       ComboBox1.Items.Add(yopt.InnerText); 
      } 
     } 
    } 
} 

但現在我試圖在通用應用程序(Windows Phone/Windows)上做同樣的事情,但我無法做到這一點。我知道我必須使用HttpClient,但它不能像WebBrowser那樣工作,這個瀏覽器只能通過代碼來創建,以獲得所需的所有數據,而且對於每次需要重新刷新網站的數據步驟都不會正常刷新,而是使用JQuery加載新的信息。

任何幫助?

回答

相關問題