Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I can make use of Microsoft Rx Framework to implement Bing Map effectively in WinRT / Windows 8

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.

like image 313
StezPet Avatar asked Jun 18 '13 08:06

StezPet


1 Answers

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 :)

like image 66
Joel Martinez Avatar answered Nov 13 '22 20:11

Joel Martinez