using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Weather
{
public class Info
{
public int error { get; set; }
public string status { get; set; }
public string date { get; set; }
public List<result> results { get; set; }
}
public class result
{
public string currentCity { get; set; }
public string pm25 { get; set; }
public IList<indexitem> index { get; set; }
public IList<weather_data_item> weather_data { get; set; }
}
public struct weather_data_item
{
public string date { get; set; }
public string dayPictureUrl { get; set; }
public string nightPictureUrl { get; set; }
public string weather { get; set; }
public string wind { get; set; }
public string temperature { get; set; }
}
public struct indexitem
{
public string title { get; set; }
public string zs { get; set; }
public string tipt { get; set; }
public string des { get; set; }
}
}
<Page
x:Class="Weather.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Weather"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<Grid.Background>
<ImageBrush ImageSource="ms-appx:///Assets/zhuo.jpeg"/>
</Grid.Background>
<ProgressRing x:Name="gif"></ProgressRing>
<Hub Header="Weather">
<HubSection>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding results[0].currentCity}" FontSize="60"></TextBlock>
<TextBlock Text="{Binding results[0].pm25}" FontSize="30"></TextBlock>
</StackPanel>
</DataTemplate>
</HubSection>
<HubSection>
<DataTemplate>
<ListView ItemsSource="{Binding results[0].weather_data}">
<ListView.ItemTemplate>
<DataTemplate>
<Border Width="360" BorderThickness="2" BorderBrush="Green">
<StackPanel>
<TextBlock Text="{Binding date}" FontSize="25"></TextBlock>
<TextBlock Text="{Binding weather}" FontSize="30"></TextBlock>
<StackPanel Orientation="Horizontal">
<Image Source="{Binding dayPictureUrl}" Stretch="Uniform" Width="60" Height="60"></Image>
</StackPanel>
<TextBlock Text="{Binding wind}" FontSize="25"></TextBlock>
<TextBlock Text="{Binding temperature}" FontSize="30"></TextBlock>
</StackPanel>
</Border>
</DataTemplate>
</ListView.ItemTem