簡體   English   中英

暫停應用程序Windows Phone 8.1

[英]Pausing application Windows Phone 8.1

我是新來的,我試圖為Windows Phone創建一個應用程序,僅用於測試。 我正在嘗試創建一個Splash Screen頁面,其中有2張圖像。 顯示圖像1,停下來幾秒鍾,然后顯示圖像2。

但是我不能在Windows Phone 8.1上使用System.Threading.Thread.Sleep(),因此在網上搜索時發現了Task.Delay。

我嘗試使用“ Task.Delay(TimeSpan.FromSeconds(5));” 但這沒用。 該軟件只是通過...

這是代碼:

BitmapImage Imgchange = new BitmapImage(new Uri(@"ms-appx:/Imagens/Intros/Intro01.png", UriKind.Absolute));
Background.Stretch = Stretch.Fill;
Background.Source = Imgchange;
Task.Delay(TimeSpan.FromSeconds(5));
// USED Task.Delay here, but this don't work
Imgchange = new BitmapImage(new Uri(@"ms-appx:/Imagens/Menus/Untitled-1.png", UriKind.Absolute));
Background.Source = Imgchange;

我還嘗試找到一些有關Task.Wait()的代碼,但是我一點都沒有運氣。

無論如何,對不起我的英語不好。

您應該使用關鍵字await Task.Delay

await Task.Delay(TimeSpan.FromSeconds(5));

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM