2015-01-13 51 views
0

從互聯網加載內容到應用程序時,我正在使用狀態欄。我在App.xaml.cs中有兩個函數用於隱藏和顯示,但是當我調用HideProgressAsync()一次時,下次我調用ShowProgressAsync時,狀態欄不顯示。我究竟做錯了什麼?缺少旗幟?在Windows Phone 8.1中顯示和隱藏狀態欄只是第一次工作

public async Task ShowProgressAsync(string message) 
    { 
     var statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();    
     statusBar.ProgressIndicator.Text = message; 
     await statusBar.ProgressIndicator.ShowAsync(); 
    } 

    public async Task HideProgressAsync() 
    { 
     var statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView(); 
     await statusBar.HideAsync(); 
    } 

回答

4

代碼問題,在上面的代碼中隱藏了整個statusBar。以下是正確的代碼

public async Task HideProgressAsync() 
{ 
    var statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView(); 
    await statusBar.ProgressIndicator.HideAsync(); 
}