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