我想在 5 分钟后定期刷新我的 UWP-UI。我有一个方法“Page_Loaded”,其中来自类的所有信息都发送到 UI 元素。因此,如果我刷新此方法,UI 也会这样做,对吗?
代码是这样的:
private async void Page_Loaded(object sender, RoutedEventArgs e)
{
RootObject myWeather = await Openweathermap.GetWeather();
string icon = String.Format("http://openweathermap.org/img/wn/{0}@2x.png", myWeather.weather[0].icon);
ResultImage.Source = new BitmapImage(new Uri(icon, UriKind.Absolute));
TempTextBlock.Text = ((int)myWeather.main.temp).ToString() + "°";
DescriptionTextBlock.Text = myWeather.weather[0].description;
LocationTextBlock.Text = myWeather.name;
var articlesList = NewsAPI.GetNews().Result.articles;
lvNews.ItemsSource = articlesList;
Welcometxt.Text = MainPage.WelcomeText();
}
那么,如何在 5 分钟后刷新此方法,以便它获取新信息并将其发送到 UI?