在Windows Phone 8.1中显示和隐藏状态栏只是第一次工作

本文关键字:状态栏 隐藏 工作 第一次 显示 Phone Windows | 更新日期: 2023-09-27 18:37:14

我在将内容从互联网加载到应用程序时使用状态栏。我在 App.xaml 中有两个函数.cs用于隐藏和显示,但是当我调用一次 HideProgressAsync() 时,下次调用 ShowProgressAsync 时,状态栏不会显示。我做错了什么?缺少旗帜?

    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();
    }

在Windows Phone 8.1中显示和隐藏状态栏只是第一次工作

代码问题,在上面的代码中,我隐藏了整个状态栏。下面是正确的代码

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