Muhammad Touseef February 2016

UWP progress ring activity

I am trying to hide the progress ring as soon as the stuff on my page loads completely, but I don't know where and how to set its set active property to false.

Progress.IsActive;

where should I use this line of code?

Answers


Damir Arh February 2016

You haven't provided much information on how you are loading data on your page, but I assume you are doing it asynchronously.

If you're doing it all sequentially, you can deactivate the progress ring at the end:

public async void InitializeData()
{
    TextBox1.Text = await GetData1();
    TextBox2.Text = await GetData2();
    TextBox3.Text = await GetData3();
    // ...

    Progress.IsActive = false;
}

If you're loading the data in parallel, then you should collect or awaitable tasks in a single array and await them all:

public async void InitializeData()
{
    var loadingTasks = new Task[]
    {
        GetData1(),
        GetData2(),
        GetData3()
        // ...
    };

    await Task.WhenAll(loadingTasks);

    Progress.IsActive = false;
}

In this case you would assign the loaded data to controls inside the individual GetData methods.

Post Status

Asked in February 2016
Viewed 3,235 times
Voted 12
Answered 1 times

Search




Leave an answer