Currently I am working in WPF application where i am dealing a scenario.
My application has search functionality and depending on the search criteria grid will be populated. To make application responsive we have implemented TPL.
Something like this
Task.Factory.StartNew(() =>
{
//Webservice Call
Dispatcher.Invoke(() =>
{
//Data from webservice assigned to Collection binded to Grid
});
}
);
I have one problem.
Let's say I have entered search criteria 'A' and hit search, within a second i changed my mind and updated the search criteria with 'B', i hit the search button , again i thought this wrong i have to search something else, i changed the criteria as 'C' and again click the Search. The problem is service response for A in 20 seconds,for B 25 seconds but for C its only 5 seconds.
As per my search i have to show latest search criteria and that would be C but my data is getting updated with B's record. i looked into web but did not able to get any help. Am i missing something. Any help will be appreciated.