简体   繁体   English

如何在Windows Phone 8.1中使用System.Windows.Forms?

[英]How to use System.Windows.Forms in Windows Phone 8.1?

I want create a very simple HTML parser application. 我想创建一个非常简单的HTML解析器应用程序。 I read lots of tutorial and lots of developer use this class: HtmlDocument. 我读了很多教程,许多开发人员都使用此类:HtmlDocument。 I want use this class in my app too but I am not able to add reference to System.Windows.Forms. 我也想在我的应用程序中使用此类,但是我无法添加对System.Windows.Forms的引用。

I try to add reference in Project > Reference but I can't find Windows.Forms. 我尝试在“项目”>“参考”中添加参考,但是找不到Windows.Forms。 How can I fix this problem and use HtmlDocument? 如何解决此问题并使用HtmlDocument?

I use Visual Studio 2013. 我使用Visual Studio 2013。

Thank you. 谢谢。

This is my very simple code: 这是我非常简单的代码:

namespace ParseHTML
{
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();

            this.NavigationCacheMode = NavigationCacheMode.Required;
            string url = "http://www.alvolante.it/";
            download(url);
        }

        private async void download(string url)
        {
            HttpClient client = new HttpClient();
            string risposta = await client.GetStringAsync(new Uri(url)); //download html della pagina web
            HtmlDocument hc = new HtmlDocument();  //error here, missing reference or assembly?


        }

You can't. 你不能 WinForms is not supported nor even implemented on Windows Phone (Windows Mobile 6.5.3 released in early 2010 is the last "Windows" phone OS to support WinForms by way of the Compact Framework). Windows Phone不支持甚至不支持WinForms(2010年初发布的Windows Mobile 6.5.3是最后一个通过Compact Framework支持WinForms的“ Windows”电话OS)。

To process HTML in applications, I suggest HtmlAgilityPack instead, which provides a fault-tolerant DOM manipulation library: http://htmlagilitypack.codeplex.com 为了处理应用程序中的HTML,我建议改用HtmlAgilityPack,它提供了一个容错的DOM操作库: http : //htmlagilitypack.codeplex.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM