雅虎天气API调用


雅虎天气API调用 http://blog.csdn.net/a497785609/article/details/16808123
资源截图
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text.Regularexpressions;
using System.Threading;
using System.Windows.Forms;
using System.xml.Linq;
using Whir.Software.WeatherForecast.Library;

namespace Whir.Software.WeatherForecast
{
    public partial class MainForm : Form
    {
        public static readonly string CityFilePath = Path.Combine(AppDomain.CurrentDomain.baseDirectory
                                                                  “Data\cities.txt“);

        private readonly DataTable _table = new DataTable();

        public MainForm()
        {
            InitializeComponent();
        }

        private void MainForm_Load(object sender EventArgs e)
        {
            LblStatus.Text = “鼠标左键双击左侧城市,以查看天气“;
            progressBar.Visible = false;

            _table.Columns.Add(“iso“);
            _table.Columns.Add(“name“);
            _table.Columns.Add(“woeId“);
            _table.Columns.Add(“longitude“);
            _table.Columns.Add(“latitude“);
            _table.Columns.Add(“country“);
            _table.Columns.Add(“province“);

            List list = FileHelper.ReadFileLines(CityFilePath);
            foreach (string s in list)
            {
                string city = s;
                Invoke(new MethodInvoker(() =>
                    {
                        var item = new ListViewItem();
                        item.SubItems[0].Text = city;
                        ListCities.Items.Add(item);
                    }));

                DataRow row = _table.NewRow();
                row[“name“] = city;
                _table.Rows.Add(row);
            }
        }

        public void SetButtonEnabled(Control container bool enabled)
        {
            foreach (object control in container.Controls)
            {
                if (((Control)control).Controls.Count > 0)
                {
                    SetButtonEnabled((Control)control enabled);
                }
                else
                {
                    if (control.GetType() == typeof(Button))
                    {
                        ((Button)control).Enabled = enabled;
                    }
                }
            }
        }

        public void SetButtonEnabled(bool enabled)
        {
            SetButtonEnabled(this enabled);
        }

        private void BtnGetCode_Click(object sender EventArgs e)
        {

            if (_table != null)
            {
                if (_table.Rows.Count > 0)
                {
                    var threadDelegate = new ThreadStart(delegate
                        {
                            Invoke(new MethodInvoker(() => SetButtonEnabled(false)));
                            DataTable tb = _table.Copy();
                            _table.Rows.Clear();

                         

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       4603  2013-11-18 19:43  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastinDebugDatacities.txt

     文件     200704  2013-11-18 19:23  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastinDebugICSharpCode.SharpZipLib.dll

     文件     379392  2013-11-18 19:23  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastinDebugICSharpCode.TextEditor.dll

     文件      57344  2013-11-18 19:23  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastinDebugNewtonsoft.Json.dll

     文件    1624064  2013-11-18 20:39  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastinDebugNPOI.dll

     文件     387072  2013-11-18 19:23  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastinDebugNPOI.OOxml.dll

     文件      79872  2013-11-18 19:23  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastinDebugNPOI.Openxml4Net.dll

     文件    1316864  2013-11-18 19:23  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastinDebugNPOI.OpenxmlFormats.dll

     文件     839680  2013-11-18 19:23  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastinDebugSystem.Data.SQLite.dll

     文件      23552  2013-11-19 09:29  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastinDebugWhir.Software.WeatherForecast.exe

     文件      16896  2013-11-19 09:13  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastinDebugWhir.Software.WeatherForecast.Library.dll

     文件      40448  2013-11-19 09:13  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastinDebugWhir.Software.WeatherForecast.Library.pdb

     文件      50688  2013-11-19 09:29  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastinDebugWhir.Software.WeatherForecast.pdb

     文件      11608  2013-11-19 09:29  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastinDebugWhir.Software.WeatherForecast.vshost.exe

     文件        490  2010-03-17 22:39  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastinDebugWhir.Software.WeatherForecast.vshost.exe.manifest

     文件      16506  2013-11-19 09:28  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastMainForm.cs

     文件      14992  2013-11-19 09:28  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastMainForm.Designer.cs

     文件       6190  2013-11-19 09:28  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastMainForm.resx

     文件        789  2013-11-18 19:07  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastobjx86DebugDesignTimeResolveAssemblyReferences.cache

     文件       9024  2013-11-19 09:29  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastobjx86DebugDesignTimeResolveAssemblyReferencesInput.cache

     文件      35153  2013-11-19 09:13  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastobjx86DebugResolveAssemblyReference.cache

     文件       5011  2013-11-19 09:29  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastobjx86DebugWhir.Software.WeatherForecast.csproj.FileListAbsolute.txt

     文件        850  2013-11-18 21:24  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastobjx86DebugWhir.Software.WeatherForecast.csproj.GenerateResource.Cache

     文件      40853  2013-11-18 20:51  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastobjx86DebugWhir.Software.WeatherForecast.csprojResolveAssemblyReference.cache

     文件      23552  2013-11-19 09:29  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastobjx86DebugWhir.Software.WeatherForecast.exe

     文件        180  2013-11-19 09:29  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastobjx86DebugWhir.Software.WeatherForecast.MainForm.resources

     文件      50688  2013-11-19 09:29  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastobjx86DebugWhir.Software.WeatherForecast.pdb

     文件        180  2013-11-19 09:29  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastobjx86DebugWhir.Software.WeatherForecast.Properties.Resources.resources

     文件        513  2013-11-18 19:23  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastProgram.cs

     文件       1408  2013-11-18 19:06  15.Whir.Software.WeatherForecastWhir.Software.WeatherForecastPropertiesAssemblyInfo.cs

............此处省略281个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)