C# QQ weather

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/// <summary>
    /// 2011-06-16 塗聚文
    /// </summary>
    public partial class QQweather : System.Web.UI.Page
    {
 
        public string selectcity = "1";
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        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";
            }
 
 
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        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();
        }
        /// <summary>
        /// <%# selectcity%>
        /// </summary>
        /// <returns></returns>
        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;
 
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="Text"></param>
        /// <param name="Value"></param>
        /// <param name="dt"></param>
        /// <returns></returns>
        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;
        }
posted @   ®Geovin Du Dream Park™  阅读(287)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 零经验选手,Compose 一天开发一款小游戏!
· 一起来玩mcp_server_sqlite,让AI帮你做增删改查!!
< 2011年6月 >
29 30 31 1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 1 2
3 4 5 6 7 8 9
点击右上角即可分享
微信分享提示