[Solved] What’s the difference between await (async) Task and await Task? [duplicate]

Case B is not async-await. If you have a thread, and this thread has to start a fairly lengthy process in which it has nothing to do but wait, usually because someone / something else performs the operation, then your thread could decide to do something else instead of waiting for the operation to finish. … Read more

[Solved] How to call an async method from another method

The best practice for async/await is to use async “all the way down” (unless you really and truly don’t care about Method1 waiting for Method2 to complete). It’s possible to mix Task.Wait (or similar constructs) with async code, but it’s a bad idea because it can lead to deadlocks. The best thing here would be, … Read more

[Solved] Task and return type [closed]

About the first part of the question: You return Task or Task if your method does a I/O call, or a long running CPU intensive calculation and you don’t want the caller thread to be blocked while this operation is being performed. You return void or a direct value in your method doesn’t fit the … Read more

[Solved] Awaited method call doesnt appear to complete [closed]

The problem is you have two separate tasks running that call ShowProgressText. Task.Run() is not something you normally use unless you are interfacing with code that does not use the C# async/await pattern. So perhaps LoadRapport could be like this: bool IsCompleted; string LogText; private async Task LoadRapport() { LogText = “Disable Replication”; IsCompleted = … Read more

[Solved] AWAIT multiple file downloads with DownloadDataAsync

First, you tagged your question with async-await without actually using it. There really is no reason anymore to use the old asynchronous paradigms. To wait asynchronously for all concurrent async operation to complete you should use Task.WhenAll which means that you need to keep all the tasks in some construct (i.e. dictionary) before actually extracting … Read more

[Solved] how to use async and await on a method that is time comsuming [closed]

To be able to await MyTimeConsumingTask it must be declared to return a Task. public async Task<SimeType> MyTimeConsumingTask() Since you said it does some network IO, you can rewrite it using async NW IO methods and then await it as var MyResult = await MyTimeConsumingTask(MyClassProperty); But in your case the simplest approach seems to be … Read more

[Solved] Add controls to a StackPanel in a BackgroundWorker or async Task called from another BackgroundWorker

You cannot create controls from any thread except for the UI thread. To run code on the UI thread you can use Dispatcher.BeginInvoke, you can find the dispatcher on any UI element (in the Dispatcher property) or using the statis Dispatcher.CurrentDispatcher property from the UI thread before starting the background process. solved Add controls to … Read more

[Solved] Async Wait issues with view updation in UWP

Since calling Bindings.Update() fixed your issue, your binding expressions should be correct, but somehow the property change notification fails. I am not going to guess what really went wrong here but to explain when you should be using Bindings.Update(), and when you should be using INPC + OneWay bindings. Bindings.Update() is only available for x:Bind, … Read more