PageRenderTime 22ms CodeModel.GetById 13ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/BlogEngine/DotNetSlave.BusinessLogic/ServingEventArgs.cs

#
C# | 159 lines | 45 code | 24 blank | 90 comment | 0 complexity | fe8045e79c948707c21cf674b48e3649 MD5 | raw file
  1namespace BlogEngine.Core
  2{
  3    using System;
  4
  5    /// <summary>
  6    /// The location where the serving takes place
  7    /// </summary>
  8    public enum ServingLocation
  9    {
 10        /// <summary>
 11        ///     Is used to indicate that a location hasn't been chosen.
 12        /// </summary>
 13        None,
 14
 15        /// <summary>
 16        ///     Is used when a single post is served from post.aspx.
 17        /// </summary>
 18        SinglePost,
 19
 20        /// <summary>
 21        ///     Is used when multiple posts are served using postlist.ascx.
 22        /// </summary>
 23        PostList,
 24
 25        /// <summary>
 26        ///     Is used when a single page is displayed on page.aspx.
 27        /// </summary>
 28        SinglePage,
 29
 30        /// <summary>
 31        ///     Is used when content is served from a feed (RSS or ATOM).
 32        /// </summary>
 33        Feed,
 34
 35        /// <summary>
 36        ///     Is used when content is being sent by e-mail.
 37        /// </summary>
 38        Email,
 39
 40        /// <summary>
 41        ///     Is used when content is served on a custom location.
 42        /// </summary>
 43        Other
 44    }
 45
 46    /// <summary>
 47    /// The criteria by which the content is being served (by tag, category, author, etc)
 48    /// </summary>
 49    public enum ServingContentBy
 50    {
 51        /// <summary>
 52        ///     The criteria by which content is being served is unspecified.
 53        /// </summary>
 54        Unspecified,
 55
 56        /// <summary>
 57        ///     All content is being served.
 58        /// </summary>
 59        AllContent,
 60
 61        /// <summary>
 62        ///     Content is being served by tag.
 63        /// </summary>
 64        Tag,
 65
 66        /// <summary>
 67        ///     Content is being served by category.
 68        /// </summary>
 69        Category,
 70
 71        /// <summary>
 72        ///     Content is being served by author.
 73        /// </summary>
 74        Author,
 75
 76        /// <summary>
 77        ///     Content is being served by date range.
 78        /// </summary>
 79        DateRange,
 80
 81        /// <summary>
 82        ///     Content is being served by APML filtering.
 83        /// </summary>
 84        Apml
 85    }
 86
 87    /// <summary>
 88    /// Used when a post is served to the output stream.
 89    /// </summary>
 90    public class ServingEventArgs : EventArgs
 91    {
 92        #region Constructors and Destructors
 93
 94        /// <summary>
 95        /// Initializes a new instance of the <see cref="ServingEventArgs"/> class. 
 96        ///     Creates a new instance of the class and applies the specified body and serving location.
 97        /// </summary>
 98        /// <param name="body">
 99        /// The body string.
100        /// </param>
101        /// <param name="location">
102        /// The location.
103        /// </param>
104        public ServingEventArgs(string body, ServingLocation location)
105            : this(body, location, ServingContentBy.Unspecified)
106        {
107        }
108
109        /// <summary>
110        /// Initializes a new instance of the <see cref="ServingEventArgs"/> class. 
111        ///     Creates a new instance of the class and applies the specified body, serving location and serving content by.
112        /// </summary>
113        /// <param name="body">
114        /// The body string.
115        /// </param>
116        /// <param name="location">
117        /// The location.
118        /// </param>
119        /// <param name="contentBy">
120        /// The content By.
121        /// </param>
122        public ServingEventArgs(string body, ServingLocation location, ServingContentBy contentBy)
123        {
124            this.Body = body;
125            this.Location = location;
126            this.ContentBy = contentBy;
127        }
128
129        #endregion
130
131        #region Properties
132
133        /// <summary>
134        ///     Gets or sets the body of the post. If you change the Body, 
135        ///     then that change will be shown on the web page.
136        /// </summary>
137        public string Body { get; set; }
138
139        /// <summary>
140        ///     Gets or sets a value indicating whether to cancel the serving of the content.
141        ///     <remarks>
142        ///         If the serving is cancelled then the item will not be displayed.
143        ///     </remarks>
144        /// </summary>
145        public bool Cancel { get; set; }
146
147        /// <summary>
148        ///     Gets or sets the criteria by which the content is being served (by tag, category, author, etc).
149        /// </summary>
150        public ServingContentBy ContentBy { get; set; }
151
152        /// <summary>
153        ///     Gets or sets the location where the serving takes place.
154        /// </summary>
155        public ServingLocation Location { get; set; }
156
157        #endregion
158    }
159}