I have simple code which I want to be executed asynchrounously:
public async Task EncryptAsync()
{
for (int i = 0; i < 10; i++)
{
// shift bytes
// column multiplication
// and so on
}
}
That is the way I call above method:
private async void Encryption()
{
ShowBusyIndicator();
await encryptor.EncryptAsync();
HideBusyIndicator();
}
The point is, when I add await Task.Delay(1000); in this method, busi indicator is shown, but after 1 sec, application locks and waits SYNCHRONOUSLY for encryption complete. If I remove Task.Delay, application lock and unlocks after operation finished.
How to use properly await and asyc in my case? I want simply execute method encryptor.EncryptAsync() asynchronously.