title: How can I use async in an mvvmcross view model?
body: <p>I have a long running process in an mvvmcross viewmodel and wish to make it async (<a href="http://msdn.microsoft.com/en-us/library/vstudio/hh191443.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/vstudio/hh191443.aspx</a>).</p>
  
  <p>The async keyword is currently supported in the beta channel for Xamarin.</p>
  
  <p>Below is an example of how I'm currently implementing async. The IsBusy flag ccould be bound to a UI element and display a loading message.</p>
  
  <p>Is this the correct way? </p>
  
  <pre><code>public class MyModel: MvxViewModel
  {
      private readonly IMyService _myService;
      private bool _isBusy;
  
      public bool IsBusy
      {
          get { return _isBusy; }
          set { _isBusy = value; RaisePropertyChanged(() =&gt; IsBusy); ; }
      }
  
      public ICommand MyCommand
      {
          get
          {
              return new MvxCommand(DoMyCommand);
          }
      }
  
      public MyModel(IMyService myService)
      {
          _myService = myService;
      }
  
      public async void DoMyCommand()
      {
          IsBusy = true;
          await Task.Factory.StartNew(() =&gt;
              {
                  _myService.LongRunningProcess();
              });
          IsBusy = false;
      }
  
  }
  </code></pre>