[WPF] Call Async Method
await 하려는 함수는 async 여야 함.(Task 반환해야 함.)
await 쓰는 함수는 async 여야 함.
private async Task SendOfflineException()
{
await SendOfflineExceptionsIfOnline();
}
private static async Task SendOfflineExceptionsIfOnline()
{
}
async 함수 호출.
Task.Run(SendOfflineExceptionsIfOnline);
Task 반환 없으면 await으로 대기 불가.
void 대신 Task 사용하면 await호출 가능.
What is the best patter to call async methods after app start? (Fire&Forget in Constructor?)
In my application I want to setup my ViewModels by queried data (from async methods) right after my application started. In my case I have a .NET Framework WPF application and after the start I wan...
stackoverflow.com
How to run and interact with an async Task from a WPF gui
I have a WPF GUI, where I want to press a button to start a long task without freezing the window for the duration of the task. While the task is running I would like to get reports on progress, an...
stackoverflow.com
[C#] async 메서드의 void 반환형 vs Task 반환형
C#에서 async 지정한 메서드는 반환형이 void일 수도, Task일 수도 있습니다. 둘 다 값을 반환하진 않습니다. void 이면 해당 메서드는 기다릴 수 없습니다. (await 불가) Task 이면 해당 메서드를 await으로
sftblw.tistory.com