none
How to cancel calls to Azure Mobile Services RRS feed

  • Question

  • I'm working on a WP8 app using AMS, and I'm wondering - for the various async AMS calls we make and await - how can we cancel these tasks if the user navigates away from the page (or the app) by using the Back or the Home buttons?

    I know how to intercept the relevant events in WP8, but once I know I need to take action to cancel calls, how can I actually do so?  I've looked into using CancellationTokens, but these tokens are not accepted as parameters to the AMS calls I've checked.

    Am I missing something?

    Tuesday, December 18, 2012 9:30 AM

Answers

  • Hi Joe,

    Since the request to Mobile Services is issued immediately, it's best to ignore the response if you don't need it. Note, that there is no way to cancel a request, so if you want to 'undo' any potential change you'll need to build this compensation into your code.

    Does that make sense?

    Thanks

    Josh


    http://twitter.com/joshtwist

    • Proposed as answer by Josh Twist (MSFT) Tuesday, December 18, 2012 5:35 PM
    • Marked as answer by Joe Luhman Saturday, December 22, 2012 5:15 PM
    Tuesday, December 18, 2012 5:34 PM

All replies

  • Hi Joe,

    Since the request to Mobile Services is issued immediately, it's best to ignore the response if you don't need it. Note, that there is no way to cancel a request, so if you want to 'undo' any potential change you'll need to build this compensation into your code.

    Does that make sense?

    Thanks

    Josh


    http://twitter.com/joshtwist

    • Proposed as answer by Josh Twist (MSFT) Tuesday, December 18, 2012 5:35 PM
    • Marked as answer by Joe Luhman Saturday, December 22, 2012 5:15 PM
    Tuesday, December 18, 2012 5:34 PM
  • Thanks for the feedback Josh, makes sense.  We had to adjust our app so it made it less likely that the user would navigate away from the page which initiated the AMS calls before they returned.
    Saturday, December 22, 2012 5:17 PM