28

In my e-commerce application I need to plot my nearby stores in Bing map, And my another requirement is during the time of zooming and paning the map I need to update my stores based on the map centre. So for implementing this I primarily choose the traditional way of coding. The steps are given below.

  1. Initial launch I will send the api request for location and will plot the stores on Map.

  2. In Maps ViewChanged event I will send the subsequent requests for the nearby stores based on the maps current store. So during this implementation, I am getting around 400 stores in single api request. And I will plot this on map. But when I zoom or pan the map it sends several requests simultaneously and try to update the pushpins on UI , eventually it will block the UI and Map behaves horribly in my app.

During the Google search I found many suggestions regarding using Microsoft Rx framework to implement similar functionality. But didn’t get any proper code samples to achieve my goal. Can anyone please help me or guide me to solve my issue. Remember I need to plot on an average of 400 stores in map on a single request.

Regards,

Stez.

StezPet
  • 2,430
  • 2
  • 27
  • 49
  • 1
    This is a pretty big request! I suggest you look at the Hands On Lab (HOL) that Bart deSmet wrote a few years ago. I would imagine that the "Google Suggest" search text sample would be very similar code/concepts to what you need. – Lee Campbell Jun 18 '13 at 09:38
  • 1
    The hands on lab is linked from here: http://blogs.msdn.com/b/rxteam/archive/2010/07/15/rx-hands-on-labs-published.aspx. You can find solutions to it with Rx 2.1 here: https://github.com/dlhartveld/Rx-2.1-HOL-Solution – lindydonna Aug 23 '13 at 19:28

1 Answers1

2

It sounds like you're just saturating the connection and/or server with multiple requests as the events come while zooming. What you want to do is avoid making the API call directly from that event. Instead, you can just start a timer (or restart, if already running). That way, you can buffer those repeated events until the user stops zooming and then only submit one API request.

Of course, you'll have to play with the duration of that timer to find the balance between waiting for events to finish, and giving the user a responsive update :)

Joel Martinez
  • 46,929
  • 26
  • 130
  • 185