[英]Load a function after the layout is being added and shown completely
我正在嘗試在Windows Phone 8.1中顯示加載頁面
我想在看到布局后調用函數this.GetAllRings
。 我曾嘗試在加載中添加內容,但仍然無法正常工作。 除非整個查詢完成,否則我會看到黑屏。 我怎樣才能解決這個問題
以下是我的代碼
public MainPage()
{
this.InitializeComponent();
this.app = App.Current as App;
this.Loaded += MainPage_Loaded;
this.NavigationCacheMode = NavigationCacheMode.Disabled;
}
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
this.GetAllRings();
}
在MainPage_Loaded方法中,您的請求可能會阻止UI線程。 您應該嘗試以下方法:
await Task.Run(() => this.GetAllRings());
這應該做。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.