public void GetReportCatalogInfoAsync(Action <IEnumerable <CatalogItemInfo> > callBack, Action <string> errorCallback) { _client.GetAsync <IEnumerable <CatalogItemInfo> >( _uri, result => Deployment.Current.Dispatcher.BeginInvoke(() => callBack(result)), (result, e) => Deployment.Current.Dispatcher.BeginInvoke(() => errorCallback(e.Message))); }
public static void SendAsync <TResult>(this JsonRestClientAsync client, HttpMethods method, string relativeOrAbsoluteUrl, Action <TResult> onSuccess, Action <TResult, Exception> onError, object request = null) { switch (method) { case HttpMethods.GET: client.GetAsync(relativeOrAbsoluteUrl, onSuccess, onError); break; case HttpMethods.PUT: client.PutAsync(relativeOrAbsoluteUrl, request, onSuccess, onError); break; case HttpMethods.DELETE: client.DeleteAsync(relativeOrAbsoluteUrl, onSuccess, onError); break; case HttpMethods.POST: client.PostAsync(relativeOrAbsoluteUrl, request, onSuccess, onError); break; default: throw new ArgumentOutOfRangeException("HttpMethod not in use"); } }