c# - Adding custom argument to rest callback action -
i've ran problem programming basic tool listing few 'items' (and respective price on ingame auction-house) video-game in wpf-window.
i price trend specific item (id) last 30 days rest-service delivers me this:
[{"timestamp":"1453892281000","buy":"3411","sell":"3791"},{...},...]
i'm requesting price trend around 100 items @ time (all async) , when handling responsedata class fields of response through restsharp. problem can't match responsedata item rest-response doesn't deliver me one. there way add id (integer) action/callback?
public static void getitempricehistory(int itemid, listingsview view) { var request = new restrequest("itempricetrend/" + itemid); action<list<restitempricehistory>> ariph = view.processitempricehistory; executeasync(request, ariph); } public static void executeasync<t>(restrequest request, action<t> callback) t : new() { var client = new restclient(); client.baseurl = baseurl; var asynchandle = client.executeasync<t>(request, aresp => { callback(aresp.data); }); }
i hope problem understandable if not, please , i'll try best provide different explanation :)
i found out how can it: adding second argument action:
action<list<restitempricehistory>, int> ariph = view.processitempricehistory;
and because of ofcourse @ callback:
callback(aresp.data, itemid);
seems simpel now, not sure why didn't try earlier :)
Comments
Post a Comment