/// <summary> /// Deregister feed provider for stop request feeds /// </summary> /// <param name="provider">provider for deregister</param> public void DeRegister(IFeedProvider provider) { if (provider == null) { throw new ArgumentNullException("provider"); } if (this.FeedProviders.ContainsKey(provider) == false) { return; } FeedRequestObject reqObject = null; bool result = this.FeedProviders.TryGetValue(provider, out reqObject); if (result == true) { reqObject.StopRequest(); } //해당 파서에 대한 피딩 중단 //프로바이더 제거 provider.RequestFeedsDelegate = null; this.FeedProviders.Remove(provider); }
/// <summary> /// Get request object from provider /// </summary> /// <param name="provider">provider</param> /// <returns>request object</returns> private FeedRequestObject GetRequestObject(IFeedProvider provider) { provider.RequestFeedsDelegate = this.FeedRequestDelegateCallback; FeedRequestObject reqObject = new FeedRequestObject(provider); return(reqObject); }
/// <summary> /// Try send request to web again with refreshed request from provider /// </summary> /// <param name="provider"></param> private void FeedRequestDelegateCallback(IFeedProvider provider) { FeedRequestObject reqObject = null; bool isReqObjectExist = this.FeedProviders.TryGetValue(provider, out reqObject); if (isReqObjectExist == true && reqObject != null) { reqObject.BeginRequest(); } }
/// <summary> /// Begin asynchronous parsing /// </summary> /// <param name="provider">provider</param> /// <returns>true to register success</returns> public bool Register(IFeedProvider provider) { if (provider == null) { throw new ArgumentNullException("provider"); } if (this.FeedProviders.ContainsKey(provider) == true) { return(false); } FeedRequestObject requestObject = this.GetRequestObject(provider); this.FeedProviders.Add(provider, requestObject); return(true); }
/// <summary> /// Get request object from provider /// </summary> /// <param name="provider">provider</param> /// <returns>request object</returns> private FeedRequestObject GetRequestObject(IFeedProvider provider) { provider.RequestFeedsDelegate = this.FeedRequestDelegateCallback; FeedRequestObject reqObject = new FeedRequestObject(provider); return reqObject; }