PageRenderTime 211ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/BlogEngine/DotNetSlave.BusinessLogic/ServingEventArgs.cs

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