public OneBusAwayWebservice() { stopsCache = new HttpCache("StopsForLocation", (int)TimeSpan.FromDays(15).TotalSeconds, 300); directionCache = new HttpCache("StopsForRoute", (int)TimeSpan.FromDays(15).TotalSeconds, 100); }
public GetStopsForLocationCompleted(string requestUrl, HttpCache stopsCache, StopsForLocation_Callback callback) : base(requestUrl) { this.callback = callback; this.stopsCache = stopsCache; }
public GetDirectionsForRouteCompleted(string requestUrl, string routeId, HttpCache directionCache, StopsForRoute_Callback callback) : base(requestUrl) { this.callback = callback; this.routeId = routeId; this.directionCache = directionCache; }
public CacheMetadata(HttpCache owner) { this.owner = owner; IsolatedStorageSettings cacheSettings = IsolatedStorageSettings.ApplicationSettings; if (cacheSettings.Contains(owner.Name)) { // upgrade scenario. user has an existing cache. // migrate it out of AppSettings to file fileUpdateTimes = cacheSettings[owner.Name] as Dictionary<string, DateTime>; WriteSettingsFile(); // and clean up AppSettings cacheSettings.Remove(owner.Name); cacheSettings.Save(); } else { fileUpdateTimes = ReadSettingsFile(); } }
/// <summary> /// Callback entry point for calls based on HttpCache /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void HttpCache_Completed(object sender, HttpCache.CacheDownloadStringCompletedEventArgs e) { Exception error = e.Error; XDocument xmlDoc = null; if (error == null) { try { string requestUrl = string.Empty; if (e.UserState is Uri) { requestUrl = ((Uri)e.UserState).ToString(); } xmlDoc = CheckResponseCode(e.Result, requestUrl); } catch (Exception ex) { error = ex; } } ParseResults(xmlDoc, error); }
public CacheCallback(HttpCache owner, DownloadStringAsync_Completed callback, Uri requestedAddress) { this.owner = owner; this.callback = callback; this.requestedAddress = requestedAddress; }