title: Returning a value from Dispatcher.RunAsync() to background thread
body: <p>I'm using Dispatcher.RunAsync() to show a MessageDialog from a background thread. But I'm having trouble figuring out how to get a result returned.</p>
  
  <p>My code:</p>
  
  <pre><code>            bool response = false;
  
          await dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
               async () =&gt;
               {
                   DebugWriteln("Showing confirmation dialog: '" + s + "'.");
                   MessageDialog dialog = new MessageDialog(s);
  
                   dialog.Commands.Add(new UICommand(GetLanguageString("Util_DialogButtonYes"), new UICommandInvokedHandler((command) =&gt; {
                       DebugWriteln("User clicked 'Yes' in confirmation dialog");
                       response = true;
                   })));
  
                   dialog.Commands.Add(new UICommand(GetLanguageString("Util_DialogButtonNo"), new UICommandInvokedHandler((command) =&gt;
                   {
                       DebugWriteln("User clicked 'No' in confirmatoin dialog");
                       response = false;
                   })));
                   dialog.CancelCommandIndex = 1;
                   await dialog.ShowAsync();
               });
          //response is always False
          DebugWriteln(response);
  </code></pre>
  
  <p>Is there anyway to do it like this?
  I thought about maybe returning the value from inside RunAsync() but function is void.</p>