Exemple #1
0
 /// <summary>protected virtual OnNewAtomEntry( FeedParserEventArgs args)</summary>
 /// <param name="args"> FeedParserEventArgs, includes the new entry</param>
 /// <returns> </returns>
 protected virtual void OnNewAtomEntry(FeedParserEventArgs args)
 {
     if (this.NewAtomEntry != null)
     {
         this.NewAtomEntry(this, args);
     }
 }
Exemple #2
0
        /// <summary>overloaded to make it easier to fire the event</summary>
        protected AtomEntry OnCreateNewEntry()
        {
            FeedParserEventArgs args = new FeedParserEventArgs();

            this.OnNewAtomEntry(args);
            if (args.Entry == null)
            {
                return(new AtomEntry());
            }
            return(args.Entry);
        }
Exemple #3
0
 /// <summary>
 /// Eventhandling. Called when a new entry is parsed.
 /// </summary>
 /// <param name="sender"> the object which send the event</param>
 /// <param name="e">FeedParserEventArguments, holds the feedentry</param>
 /// <returns> </returns>
 protected void OnParsedNewAbstractEntry(object sender, FeedParserEventArgs e)
 {
     if (e == null)
     {
         throw new ArgumentNullException("e");
     }
     if (e.CreatingEntry)
     {
         e.Entry = CreateFeedEntry();
     }
 }
Exemple #4
0
        /// <summary>eventchaining. We catch this by the baseFeedParsers, which
        /// would not do anything with the gathered data. We pass the event up
        /// to the user</summary>
        /// <param name="sender"> the object which send the event</param>
        /// <param name="e">FeedParserEventArguments, holds the feedentry</param>
        /// <returns> </returns>
        protected void OnParsedNewEntry(object sender, FeedParserEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }

            if (this.NewAtomEntry != null)
            {
                // just forward it upstream, if hooked
                Tracing.TraceMsg("\t calling event dispatcher");
                this.NewAtomEntry(this, e);
            }
        }
Exemple #5
0
        /////////////////////////////////////////////////////////////////////////////


        //////////////////////////////////////////////////////////////////////
        /// <summary>Event chaining. We catch this by the baseFeedParsers, which
        /// would not do anything with the gathered data. We pass the event up
        /// to the user; if the user doesn't discard it, we add the entry to our
        /// collection</summary>
        /// <param name="sender"> the object which send the event</param>
        /// <param name="e">FeedParserEventArguments, holds the feed entry</param>
        /// <returns> </returns>
        //////////////////////////////////////////////////////////////////////
        protected void OnParsedNewEntry(object sender, FeedParserEventArgs e)
        {
            // by default, if our event chain is not hooked, add it to the collection
            Tracing.TraceCall("received new item notification");
            Tracing.Assert(e != null, "e should not be null");
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }
            if (this.NewAtomEntry != null)
            {
                Tracing.TraceMsg("\t calling event dispatcher");
                this.NewAtomEntry(this, e);
            }
            // now check the return
            if (!e.DiscardEntry)
            {
                if (!e.CreatingEntry)
                {
                    if (e.Entry != null)
                    {
                        // add it to the collection
                        Tracing.TraceMsg("\t new AtomEntry found, adding to collection");
                        e.Entry.Service = this.Service;
                        this.Entries.Add(e.Entry);
                    }
                    else if (e.Feed != null)
                    {
                        // parsed a feed, set ourselves to it...
                        Tracing.TraceMsg("\t Feed parsed found, parsing is done...");
                    }
                }
                else
                {
                    IVersionAware v = e.Entry as IVersionAware;
                    if (v != null)
                    {
                        v.ProtocolMajor = this.ProtocolMajor;
                        v.ProtocolMinor = this.ProtocolMinor;
                    }
                }
            }

            if (e.DoneParsing)
            {
                this.BaseUriChanged(this.ImpliedBase);
            }
        }
Exemple #6
0
        /// <summary>overloaded to make eventfiring easier</summary>
        /// <param name="feed"> the new feed to fire</param>
        protected void OnNewAtomEntry(AtomFeed feed)
        {
            FeedParserEventArgs args = new FeedParserEventArgs(feed, null);

            this.OnNewAtomEntry(args);
        }
Exemple #7
0
        /// <summary>protected void OnParsingDone()</summary>
        /// <returns> </returns>
        protected void OnParsingDone()
        {
            FeedParserEventArgs args = new FeedParserEventArgs(null, null);

            this.OnNewAtomEntry(args);
        }
Exemple #8
0
        /// <summary>overloaded to make it easier to fire the event</summary>
        /// <param name="newEntry">the new AtomEntry to fire </param>
        protected void OnNewAtomEntry(AtomEntry newEntry)
        {
            FeedParserEventArgs args = new FeedParserEventArgs(null, newEntry);

            this.OnNewAtomEntry(args);
        }