📄 form1.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Net;
namespace LiveQnA2
{
/// <summary>
/// This sample application shows how to receive an RSS feed from Windows Live QnA on a Pocket PC.
/// In this sample we make synchronous calls to the Live QnA site. As a consequence, the application
/// will not be responsive during the period between the WebRequest and the WebResponse.
/// </summary>
/// <remarks>
/// More information about accessing Live QnA making use of URL encoding can be found here:
/// http://liveqna.spaces.live.com/blog/cns!2933A3E375F68349!390.entry
/// </remarks>
public partial class Form1 : Form
{
private DataSet ds;
public Form1()
{
InitializeComponent();
}
private void buttonQnAService_Click(object sender, EventArgs e)
{
Cursor.Current = Cursors.WaitCursor;
ds = new DataSet();
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://qna.live.com/Search.aspx?q=meta:Search.qstate(0)&format=rss");
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
XmlTextReader xmlRdr = new XmlTextReader(response.GetResponseStream());
textBox1.Text = response.ToString();
textBox1.Visible = true;
// Store the RSS feed in a DataSet for further usage.
ds.ReadXml(xmlRdr);
buttonQnAService.Enabled = false;
buttonShowXML.Enabled = true;
Cursor.Current = Cursors.Default;
}
private void buttonShowXML_Click(object sender, EventArgs e)
{
textBox1.Text = ds.GetXml();
textBox1.Visible = true;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -