示例#1
0
        /// <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);
        }
示例#2
0
        /// <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);
        }
示例#3
0
        /// <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();
            }
        }
示例#4
0
        /// <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);
        }
示例#5
0
 /// <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;
 }