Async support`

Apr 30, 2013 at 8:28 AM
Hi Markus. I have just started; and am enjoying using your framework. Thank you.

I am using MVC, and following your article on Documents in Code Magazine. Is there support in the framework for Aysync behaviour?

Apr 30, 2013 at 10:22 PM

Glad you like it!

Depends on what kind of async processing you want to do. For things like loading or saving data, or for calling a service async, we actually have an AsyncWorker object. What's cool about it is that you can give it two delegates (the one that runs on the background thread and then the one that runs on the foreground thread when the background thread is finished), and, optionally, you can pass in another object such as a view-model. In that case, the model automatically changes its state from "Ready" to "Loading" and such, and the reason that's cool is that most of our styles automatically pick that up and show loading animations.

The AsyncWorker object also does a few other things. For instance, you can use it to run a continuous task on an interval.

And of course, there is no reason you shouldn't use the default async features in VS2012.

May 1, 2013 at 4:21 AM

If you look at any of the sample code, you will find examples of the code that Markus mentioned. Here is an example from one of the CODE FW classes (it's much easier for me to work from a code example):
public void LoadData()
  AsyncWorker.Execute(() =>
      var response = new GetCustomerListResponse();
      ServiceClient.Call<ICustomerService>(service => response = service.GetCustomerList(new GetCustomerListRequest { }));
      return response;
  response =>
      if (response.Success)
          foreach (var customer in response.Customers)
              Customers.Add(new CustomerListDataViewModel
                  Id = customer.Id,
                  Name = customer.Name,
                  Address = customer.Address,
                  Phone = customer.Phone,
                  Contract = customer.Contract,
      else MessageBox.Show(response.FailureInformation);
Hope this helps
May 1, 2013 at 8:24 AM
Thanks for the heads up Markus and Fletcher. It looks exacly what I need to get me going. Not sure why searches for Async failed to turn anything up.