/// <summary>Determines the index of a specific item i</summary> public int IndexOf(IRssChannel value) { return (List.IndexOf(value)); }
/// <summary> /// RssFeedManager implements the operations to create <see cref="RssChannel"/> objects. /// This class is responsible to manage the cache and is build to work with <see cref="OpmlOutlineFavorite"/> outline. /// </summary> /// <param name="outline">The <see cref="OpmlOutlineFavorite"/> of the resource to receive the data.</param> /// <returns>The requested see cref="IRssChannel" instance</returns> public IRssChannel GetFeed(OpmlOutlineFavorite outline) { Uri uri = new Uri(outline.XmlUrl); IRssChannel rssChannel = null; //System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; try { // never fetched before if (outline.ExpireDate == DateTime.MinValue || outline.ExpireDate < DateTime.Now) { // fetch channel from web rssChannel = InternalGetFeed(uri); // save channel to cache rssChannel.Save(GetCachePathFromUri(uri)); // if (rssChannel.Ttl > 0) { outline.ExpireDate = DateTime.Now.AddMinutes(rssChannel.Ttl); } else { outline.ExpireDate = DateTime.Now.AddMinutes(3600); } // outline.State = CacheState.Cached; // // add/refresh loaded channel to internal non persistent cache list _rssChannelCacheList[outline] = rssChannel; } // check cache else { // cached and not out of date if (_rssChannelCacheList.Contains(outline)) { rssChannel = _rssChannelCacheList[outline] as IRssChannel; } // cached but out of date, refresh else { // fetch channel from web rssChannel = InternalGetFeed(new Uri(GetCachePathFromUri(uri))); outline.State = CacheState.Cached; // update cache list _rssChannelCacheList[outline] = rssChannel; } } } catch (System.Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); outline.State = CacheState.Error; throw e; } finally { //System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; } // outline.TimesVisited++; outline.LastVisited = DateTime.Now; UpdateHistory(outline); // return(rssChannel); }