博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
C# QQ weather
阅读量:6071 次
发布时间:2019-06-20

本文共 4617 字,大约阅读时间需要 15 分钟。

///     /// 2011-06-16 塗聚文    ///     public partial class QQweather : System.Web.UI.Page    {        public string selectcity = "1";        ///         ///         ///         ///         ///         protected void Page_Load(object sender, EventArgs e)        {            ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(CheckValidationResult);            HttpWebRequest req = (HttpWebRequest)WebRequest.CreateDefault(new Uri("https://www.dusystem.com/QQweather.aspx"));            req.Method = "GET";            HttpWebResponse res = (HttpWebResponse)req.GetResponse();            selectcity = DropDownList1.SelectedValue.ToString();            if (!IsPostBack)            {                this.DropDownList1.DataSource = CreateDataSource();                DropDownList1.DataTextField = "WeatherTextField";                DropDownList1.DataValueField = "WeatherValueField";                // Bind the data to the control.                DropDownList1.DataBind();                // Set the default selected item, if desired.                DropDownList1.SelectedIndex = 0;                selectcity = @"1";            }        }        ///         ///         ///         ///         ///         protected void Button1_Click(object sender, EventArgs e)        {            ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(CheckValidationResult);            HttpWebRequest req = (HttpWebRequest)WebRequest.CreateDefault(new Uri("https://www.dusystem.com/QQweather.aspx"));            req.Method = "GET";            HttpWebResponse res = (HttpWebResponse)req.GetResponse();            selectcity = DropDownList1.SelectedValue.ToString();        }        ///         /// <%# selectcity%>        ///         /// 
ICollection CreateDataSource() { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("WeatherTextField", typeof(String))); dt.Columns.Add(new DataColumn("WeatherValueField", typeof(String))); dt.Rows.Add(CreateRow("香港", "1", dt)); dt.Rows.Add(CreateRow("澳門", "2", dt)); dt.Rows.Add(CreateRow("哈爾濱", "17", dt)); dt.Rows.Add(CreateRow("烏魯木齊", "28", dt)); dt.Rows.Add(CreateRow("西寧", "56", dt)); dt.Rows.Add(CreateRow("蘭州", "57", dt)); dt.Rows.Add(CreateRow("呼和浩特", "69", dt)); dt.Rows.Add(CreateRow("銀川", "78", dt)); dt.Rows.Add(CreateRow("石家莊", "82", dt)); dt.Rows.Add(CreateRow("太原", "84", dt)); dt.Rows.Add(CreateRow("長春 ", "103", dt)); dt.Rows.Add(CreateRow("瀋陽 ", "115", dt)); dt.Rows.Add(CreateRow("北京 ", "125", dt)); dt.Rows.Add(CreateRow("天津 ", "127", dt)); dt.Rows.Add(CreateRow("濟南 ", "140", dt)); dt.Rows.Add(CreateRow("拉薩 ", "150", dt)); dt.Rows.Add(CreateRow("成都 ", "166", dt)); dt.Rows.Add(CreateRow("昆明 ", "179", dt)); dt.Rows.Add(CreateRow("西安 ", "186", dt)); dt.Rows.Add(CreateRow("鄭州 ", "189", dt)); dt.Rows.Add(CreateRow("武漢 ", "211", dt)); dt.Rows.Add(CreateRow("重慶 ", "212", dt)); dt.Rows.Add(CreateRow("長沙 ", "218", dt)); dt.Rows.Add(CreateRow("貴陽 ", "227", dt)); dt.Rows.Add(CreateRow("桂林 ", "232", dt)); dt.Rows.Add(CreateRow("南京 ", "244", dt)); dt.Rows.Add(CreateRow("合肥 ", "248", dt)); dt.Rows.Add(CreateRow("上海 ", "252", dt)); dt.Rows.Add(CreateRow("杭州 ", "255", dt)); dt.Rows.Add(CreateRow("南昌 ", "264", dt)); dt.Rows.Add(CreateRow("福州 ", "276", dt)); dt.Rows.Add(CreateRow("臺北 ", "280", dt)); dt.Rows.Add(CreateRow("廈門 ", "287", dt)); dt.Rows.Add(CreateRow("廣州 ", "292", dt)); dt.Rows.Add(CreateRow("南寧 ", "295", dt)); dt.Rows.Add(CreateRow("深圳 ", "296", dt)); dt.Rows.Add(CreateRow("海口 ", "303", dt)); DataView dv = new DataView(dt); return dv; } /// /// /// /// /// /// ///
DataRow CreateRow(String Text, String Value, DataTable dt) { DataRow dr = dt.NewRow(); dr[0] = Text; dr[1] = Value; return dr; } public bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) { //直接确认,否则打不开 return true; }

转载地址:http://oqngx.baihongyu.com/

你可能感兴趣的文章
四部曲
查看>>
LINUX内核调试过程
查看>>
【HDOJ】3553 Just a String
查看>>
Java 集合深入理解(7):ArrayList
查看>>
2019年春季学期第四周作业
查看>>
linux环境配置
查看>>
ASP.NET MVC中从前台页面视图(View)传递数据到后台控制器(Controller)方式
查看>>
lintcode:next permutation下一个排列
查看>>
一个想法(续二):换个角度思考如何解决IT企业招聘难的问题!
查看>>
tomcat指定配置文件路径方法
查看>>
linux下查看各硬件型号
查看>>
对象合成复用之策略模式
查看>>
epoll的lt和et模式的实验
查看>>
Flux OOM实例
查看>>
Android的Framework分析---4硬件抽象HAL
查看>>
07-k8s-dns
查看>>
Android 中 ListView 分页加载数据
查看>>
Prawn Notes
查看>>
oracle启动报错:ORA-00845: MEMORY_TARGET not supported on this system
查看>>
Go方法
查看>>