Пример #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);
            }
        }
        public void FeedTest()
        {
            FeedParserEventArgs target = new FeedParserEventArgs(); // TODO: Initialize to an appropriate value
            Assert.IsNull(target.Feed);
            Assert.IsNull(target.Entry);

            target = new FeedParserEventArgs(new AtomFeed(new Uri("http://www.test.com/"), null), new AtomEntry());
            Assert.IsNotNull(target.Feed);
            Assert.IsNotNull(target.Entry);
        }
Пример #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();
     }
 }
 /// <summary>
 /// Event handler. Called when a new <code>AppsExtendedEntry</code> is parsed.
 /// </summary>
 /// <param name="sender">the object that's sending the event</param>
 /// <param name="e">FeedParserEventArguments, holds the feedentry</param>
 protected void OnParsedNewPropertyEntry(object sender, FeedParserEventArgs e)
 {
     if (e == null)
     {
         throw new ArgumentNullException("e");
     }
     if (e.CreatingEntry && !(e.Entry is AppsExtendedEntry))
     {
         e.Entry = new AppsExtendedEntry();
     }
 }
Пример #5
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);
        }
 protected void OnParsedNewEventEntry(object sender,
                                      FeedParserEventArgs e)
 {
     if (e == null)
     {
         throw new ArgumentNullException("e");
     }
     if (e.CreatingEntry == true)
     {
         e.Entry = new GBaseEntry();
     }
 }
Пример #7
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);
            }
        }
Пример #8
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);
            }
        }
Пример #9
0
        /////////////////////////////////////////////////////////////////////////////

        //////////////////////////////////////////////////////////////////////
        /// <summary>protected void OnParsingDone()</summary> 
        /// <returns> </returns>
        //////////////////////////////////////////////////////////////////////
        protected void OnParsingDone()
        {
            FeedParserEventArgs args = new FeedParserEventArgs(null, null);
            this.OnNewAtomEntry(args);
        }
Пример #10
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);

        }
Пример #11
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; 
        }
Пример #12
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 OnParsedNewEntry(object sender, FeedParserEventArgs e) {
     if (e == null) {
         throw new ArgumentNullException("e");
     }
     if (e.CreatingEntry) {
         Tracing.TraceMsg("\t top level event dispatcher - new Entry");
         e.Entry = new MyEntry();
     }
 }
Пример #13
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);
            }
        }
 public void FeedParserEventArgsConstructorTest1()
 {
     FeedParserEventArgs target = new FeedParserEventArgs();
     Assert.IsNotNull(target);
     Assert.IsNull(target.Feed);
     Assert.IsNull(target.Entry);
     Assert.IsFalse(target.DoneParsing);
     Assert.IsTrue(target.CreatingEntry);
 }
Пример #15
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);
        }
 /// <summary>
 /// Event handler. Called when a new Google Domain Settings entry is parsed.
 /// </summary>
 /// <param name="sender">the object that's sending the evet</param>
 /// <param name="e">FeedParserEventArguments, holds the feedentry</param>
 protected void OnParsedNewGoogleMailSettingsItemEntry(object sender, FeedParserEventArgs e)
 {
     if (e == null)
     {
         throw new ArgumentNullException("e");
     }
     if (e.CreatingEntry == true)
     {
         e.Entry = new AdminSettingsEntry();
     }
 }
Пример #17
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);
        }
Пример #18
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);
            }
        }
Пример #19
0
        /////////////////////////////////////////////////////////////////////////////

        //////////////////////////////////////////////////////////////////////
        /// <summary>protected void OnParsingDone()</summary>
        /// <returns> </returns>
        //////////////////////////////////////////////////////////////////////
        protected void OnParsingDone()
        {
            FeedParserEventArgs args = new FeedParserEventArgs(null, null);

            this.OnNewAtomEntry(args);
        }
 public void DiscardEntryTest()
 {
     FeedParserEventArgs target = new FeedParserEventArgs(); // TODO: Initialize to an appropriate value
     bool expected = false; // TODO: Initialize to an appropriate value
     bool actual;
     target.DiscardEntry = expected;
     actual = target.DiscardEntry;
     Assert.AreEqual(expected, actual);
 }
 public void EntryTest()
 {
     FeedParserEventArgs target = new FeedParserEventArgs(); // TODO: Initialize to an appropriate value
     AtomEntry expected = new AtomEntry();
     AtomEntry actual;
     target.Entry = expected;
     actual = target.Entry;
     Assert.AreEqual(expected, actual);
 }
Пример #22
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);
        }
Пример #23
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();
     }
 }
Пример #24
0
        //////////////////////////////////////////////////////////////////////
        /// <summary>Event chaining. We catch this from the AtomFeedParser
        /// we want to set this to our property, and do not add the entry to the collection
        /// </summary> 
        /// <param name="sender"> the object which send the event</param>
        /// <param name="e">FeedParserEventArguments, holds the feed entry</param> 
        /// <returns> </returns>
        //////////////////////////////////////////////////////////////////////
        internal 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 (e.CreatingEntry == false)
            {
                if (e.Entry != null)
                {
                    // add it to the collection
                    Tracing.TraceMsg("\t new EventEntry found"); 
                    this.Entry = e.Entry; 
                    e.DiscardEntry = true; 
                }
            }
        }
Пример #25
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 != true)
            {
                if (e.CreatingEntry == false)
                {
                    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..."); 
                    }
                }
            }

            if (e.DoneParsing == true)
            {
                this.BaseUriChanged(this.ImpliedBase);
            }

        }