question

StefanoM-9408 avatar image
0 Votes"
StefanoM-9408 asked ColeXia-MSFT commented

Wait for one piece of code to be read before reading the next

I have an AcitivtyIndicator that I would like to activate in a method that has other longer operations inside it. I would like the activityIndicator to be displayed and then the next code to be read afterwards

 private void AvviaRicerca_Clicked(object sender, EventArgs e)
 {
     AcitivtyIndicator.IsVisible = true;
     //othe code
 }

Now it is only displayed after it has done all the operations within that method

dotnet-xamarin
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ColeXia-MSFT avatar image
0 Votes"
ColeXia-MSFT answered ColeXia-MSFT commented

Hello,

Welcome to Microsoft Q&A!

Replace AcitivtyIndicator.IsVisible with AcitivtyIndicator.IsRunning .

I tried to use Task.Delay to simulate the long operations and AcitivtyIndicator works as expected .

private async void Button_Clicked(object sender, EventArgs e)
{
     indicator.IsRunning = true;
     await Task.Delay(3000);
     indicator.IsRunning = false;


If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

May I know if you have got any chance to check my answer? I am glad to help if you have any other questions.

0 Votes 0 ·