PageRenderTime 72ms CodeModel.GetById 64ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/BlogEngine/BlogEngine.NET/widgets/Month List/widget.ascx.cs

#
C# | 66 lines | 36 code | 12 blank | 18 comment | 4 complexity | 2b718e4c9b4db3646f5b79143ad1711b MD5 | raw file
 1// --------------------------------------------------------------------------------------------------------------------
 2// <summary>
 3//   The widget.
 4// </summary>
 5// --------------------------------------------------------------------------------------------------------------------
 6
 7namespace Widgets.MonthList
 8{
 9	using System.Collections.Specialized;
10	using App_Code.Controls;
11
12	/// <summary>
13	/// The widget.
14	/// </summary>
15	public partial class Widget : WidgetBase
16	{
17		#region Properties
18
19		/// <summary>
20		/// Gets a value indicating whether the Widget is editable.
21		/// </summary>
22		public override bool IsEditable
23		{
24			get { return true; }
25		}
26
27		/// <summary>
28		/// Gets the Widget name.
29		/// </summary>
30		public override string Name
31		{
32			get { return "Month List"; }
33		}
34
35		#endregion
36
37		#region Public Methods
38
39		/// <summary>
40		/// This method works as a substitute for Page_Load. You should use this method for
41		/// data binding etc. instead of Page_Load.
42		/// </summary>
43		public override void LoadWidget()
44		{
45			StringDictionary settings = GetSettings();
46
47			if (settings.ContainsKey("groupbyyear"))
48			{
49				bool aGroupByYear = true;
50
51				if (bool.TryParse(settings["groupbyyear"], out aGroupByYear))
52					ctlMonthList.GroupByYear = aGroupByYear;
53			}
54
55			if (settings.ContainsKey("recentdatesattop"))
56			{
57				bool aRecentDatesAtTop = false;
58
59				if (bool.TryParse(settings["recentdatesattop"], out aRecentDatesAtTop))
60					ctlMonthList.RecentDatesAtTop = aRecentDatesAtTop;
61			}
62		}
63
64		#endregion
65	}
66}