PageRenderTime 40ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/BlogEngine/BlogEngine.NET/widgets/RecentComments/edit.ascx.cs

#
C# | 58 lines | 31 code | 10 blank | 17 comment | 1 complexity | 7b24aa6d1eae74a531f052a4b952ecd2 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, BSD-3-Clause
  1. // --------------------------------------------------------------------------------------------------------------------
  2. // <summary>
  3. // The edit.
  4. // </summary>
  5. // --------------------------------------------------------------------------------------------------------------------
  6. namespace Widgets.RecentComments
  7. {
  8. using System;
  9. using System.Web;
  10. using App_Code.Controls;
  11. using BlogEngine.Core;
  12. /// <summary>
  13. /// The edit.
  14. /// </summary>
  15. public partial class Edit : WidgetEditBase
  16. {
  17. #region Public Methods
  18. /// <summary>
  19. /// Saves this the basic widget settings such as the Title.
  20. /// </summary>
  21. public override void Save()
  22. {
  23. var settings = this.GetSettings();
  24. settings["numberofcomments"] = this.txtNumberOfPosts.Text;
  25. this.SaveSettings(settings);
  26. Blog.CurrentInstance.Cache.Remove("widget_recentcomments");
  27. }
  28. #endregion
  29. #region Methods
  30. /// <summary>
  31. /// Raises the <see cref="E:System.Web.UI.Control.PreRender"/> event.
  32. /// </summary>
  33. /// <param name="e">
  34. /// An <see cref="T:System.EventArgs"/> object that contains the event data.
  35. /// </param>
  36. protected override void OnPreRender(EventArgs e)
  37. {
  38. base.OnPreRender(e);
  39. if (this.Page.IsPostBack)
  40. {
  41. return;
  42. }
  43. var settings = this.GetSettings();
  44. this.txtNumberOfPosts.Text = settings.ContainsKey("numberofcomments") ? settings["numberofcomments"] : "10";
  45. }
  46. #endregion
  47. }
  48. }