PageRenderTime 50ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/BlogEngine/BlogEngine.NET/widgets/Category list/widget.ascx.cs

#
C# | 71 lines | 38 code | 10 blank | 23 comment | 1 complexity | 0afb0af53ac036dedeec81aa3e79e69f MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, BSD-3-Clause
  1. // --------------------------------------------------------------------------------------------------------------------
  2. // <summary>
  3. // The categories widget.
  4. // </summary>
  5. // --------------------------------------------------------------------------------------------------------------------
  6. namespace Widgets.CategoryList
  7. {
  8. using App_Code.Controls;
  9. /// <summary>
  10. /// The categories widget.
  11. /// </summary>
  12. public partial class Widget : WidgetBase
  13. {
  14. #region Properties
  15. /// <summary>
  16. /// Gets a value indicating whether or not the widget can be edited.
  17. /// <remarks>
  18. /// The only way a widget can be editable is by adding a edit.ascx file to the widget folder.
  19. /// </remarks>
  20. /// </summary>
  21. /// <value></value>
  22. public override bool IsEditable
  23. {
  24. get
  25. {
  26. return true;
  27. }
  28. }
  29. /// <summary>
  30. /// Gets the name. It must be exactly the same as the folder that contains the widget.
  31. /// </summary>
  32. /// <value></value>
  33. public override string Name
  34. {
  35. get
  36. {
  37. return "Category list";
  38. }
  39. }
  40. #endregion
  41. #region Public Methods
  42. /// <summary>
  43. /// This method works as a substitute for Page_Load. You should use this method for
  44. /// data binding etc. instead of Page_Load.
  45. /// </summary>
  46. public override void LoadWidget()
  47. {
  48. var settings = this.GetSettings();
  49. var showRssIcon = true;
  50. var showPostCount = true;
  51. if (settings.ContainsKey("showrssicon"))
  52. {
  53. bool.TryParse(settings["showrssicon"], out showRssIcon);
  54. bool.TryParse(settings["showpostcount"], out showPostCount);
  55. }
  56. this.uxCategoryList.ShowRssIcon = showRssIcon;
  57. this.uxCategoryList.ShowPostCount = showPostCount;
  58. }
  59. #endregion
  60. }
  61. }