/// <summary> /// Initialises a new instance of the <see cref="AsyncRequest"/> class. /// </summary> /// <param name="service">The service that performs requests.</param> /// <param name="trackingUrl">The url used to make progress requests.</param> /// <param name="tracking">The tracking information from the initial request.</param> public AsyncRequest(ISDataService service, string trackingUrl, Tracking tracking) { Guard.ArgumentNotNull(service, "service"); Guard.ArgumentNotNull(trackingUrl, "trackingUrl"); Guard.ArgumentNotNull(tracking, "tracking"); _service = service; _trackingUrl = trackingUrl; _tracking = tracking; }
/// <summary> /// Makes a progress update request and refreshes the various progress properties. /// If the process has completed on the server then a <see cref="ISyndicationResource"/> /// result will be returned. Otherwise a null reference is returned. /// </summary> public ISyndicationResource Refresh() { var content = Service.Read(_trackingUrl); var tracking = content as Tracking; if (tracking != null) { _tracking = tracking; return null; } Service.Delete(_trackingUrl); return (ISyndicationResource) content; }