1

If I run this code, will editButton wait to become enabled until my (asynchronous) getMachines() function has finished running? If not, how do I create this functionality?

 editButton.isEnabled = false;
 loadedMachines = await azureService.GetMachines();
 editButton.isEnabled = true;

2 Answers 2

2

Yes edit button will wait for upper functionality to finish first.

Sign up to request clarification or add additional context in comments.

Comments

1

Yes, await keyword will make your thread wait for the response.

Don't forget to add async keywork on your method and to return a Task<> in GetMachines()

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.