微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在不关闭和打开应用的情况下更新 xamarin 中的数据?

如何解决如何在不关闭和打开应用的情况下更新 xamarin 中的数据?

我有一种方法可以制作网格表并从网站获取 json 数据,但该网站的数据总是在变化。所以我需要关闭我的应用程序并重新打开它以进行数据刷新。如何在不关闭并重新打开我的应用程序的情况下执行此操作?如何刷新我的页面以更新数据?

public MainPage()
{
    InitializeComponent();
    GetTable();
}

public void GetTable()
{
    //It have my codes for create table and get datas from json
}

解决方法

尝试这样做..

public MainPage() {
  InitializeComponent();
  ValidateDatabase();
}




public async Task ValidateDatabase() {
  //It have my codes for create table and get datas from json

  await loadComponentsFromDatabase();
}


private async Task loadComponentsFromDatabase()

{
  // your operation to the database,and render it to the users

  // note that all components must render here and not in InitializeComponent.

  // so all your components must be visible= false until you are here and make 

  // visible = true

}

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