PageRenderTime 47ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
C# | 58 lines | 33 code | 10 blank | 15 comment | 1 complexity | e11ca41901f4937f46e76d4be5d3be9e MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, BSD-3-Clause
  1. // --------------------------------------------------------------------------------------------------------------------
  2. // <summary>
  3. // The widgets categories edit.
  4. // </summary>
  5. // --------------------------------------------------------------------------------------------------------------------
  6. namespace Widgets.CategoryList
  7. {
  8. using System;
  9. using App_Code.Controls;
  10. /// <summary>
  11. /// The widgets categories edit.
  12. /// </summary>
  13. public partial class WidgetsCategoriesEdit : WidgetEditBase
  14. {
  15. #region Public Methods
  16. /// <summary>
  17. /// Saves this the basic widget settings such as the Title.
  18. /// </summary>
  19. public override void Save()
  20. {
  21. var settings = this.GetSettings();
  22. settings["showrssicon"] = this.cbShowRssIcon.Checked.ToString();
  23. settings["showpostcount"] = this.cbShowPostCount.Checked.ToString();
  24. this.SaveSettings(settings);
  25. }
  26. #endregion
  27. #region Methods
  28. /// <summary>
  29. /// Raises the <see cref="E:System.Web.UI.Control.Init"/> event.
  30. /// </summary>
  31. /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
  32. protected override void OnInit(EventArgs e)
  33. {
  34. var settings = this.GetSettings();
  35. var showRssIcon = true;
  36. var showPostCount = true;
  37. if (settings.ContainsKey("showrssicon"))
  38. {
  39. bool.TryParse(settings["showrssicon"], out showRssIcon);
  40. bool.TryParse(settings["showpostcount"], out showPostCount);
  41. }
  42. this.cbShowRssIcon.Checked = showRssIcon;
  43. this.cbShowPostCount.Checked = showPostCount;
  44. base.OnInit(e);
  45. }
  46. #endregion
  47. }
  48. }