/DotNetNuke.Core/DotNetNuke.UI.Skins.Controls/ModuleMessage.cs

# · C# · 229 lines · 189 code · 28 blank · 12 comment · 5 complexity · db7686fdeb808b5feedb604c7f7b8c82 MD5 · raw file

  1. namespace DotNetNuke.UI.Skins.Controls
  2. {
  3. using DotNetNuke.Services.Exceptions;
  4. using DotNetNuke.UI.Skins;
  5. using Microsoft.VisualBasic.CompilerServices;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Diagnostics;
  9. using System.Runtime.CompilerServices;
  10. using System.Web.UI.WebControls;
  11. /// -----------------------------------------------------------------------------
  12. /// <summary></summary>
  13. /// <remarks></remarks>
  14. /// <history>
  15. /// [cniknet] 10/15/2004 Replaced public members with properties and removed
  16. /// brackets from property names
  17. /// </history>
  18. /// -----------------------------------------------------------------------------
  19. public class ModuleMessage : SkinObjectBase
  20. {
  21. private static List<WeakReference> __ENCList = new List<WeakReference>();
  22. private string _heading;
  23. private string _iconImage;
  24. private ModuleMessageType _iconType;
  25. //("imgIcon")]
  26. private Image _imgIcon;
  27. //("imgLogo")]
  28. private Image _imgLogo;
  29. //("lblHeading")]
  30. private Label _lblHeading;
  31. //("lblMessage")]
  32. private Label _lblMessage;
  33. private string _text;
  34. public ModuleMessage()
  35. {
  36. base.Init += new EventHandler(this.Page_Init);
  37. base.Load += new EventHandler(this.Page_Load);
  38. List<WeakReference> list = __ENCList;
  39. lock (list)
  40. {
  41. __ENCList.Add(new WeakReference(this));
  42. }
  43. }
  44. [DebuggerStepThrough]
  45. private void InitializeComponent()
  46. {
  47. }
  48. private void Page_Init(object sender, EventArgs e)
  49. {
  50. this.InitializeComponent();
  51. }
  52. private void Page_Load(object sender, EventArgs e)
  53. {
  54. try
  55. {
  56. string strMessage = "";
  57. if (this.IconImage != "")
  58. {
  59. strMessage = strMessage + this.Text;
  60. this.lblHeading.CssClass = "SubHead";
  61. this.lblMessage.CssClass = "Normal";
  62. this.imgIcon.ImageUrl = this.IconImage;
  63. this.imgIcon.Visible = true;
  64. }
  65. else
  66. {
  67. switch (this.IconType)
  68. {
  69. case ModuleMessageType.GreenSuccess:
  70. strMessage = strMessage + this.Text;
  71. this.lblHeading.CssClass = "SubHead";
  72. this.lblMessage.CssClass = "Normal";
  73. this.imgIcon.ImageUrl = "~/images/green-ok.gif";
  74. this.imgIcon.Visible = true;
  75. goto Label_018A;
  76. case ModuleMessageType.YellowWarning:
  77. strMessage = strMessage + this.Text;
  78. this.lblHeading.CssClass = "Normal";
  79. this.lblMessage.CssClass = "Normal";
  80. this.imgIcon.ImageUrl = "~/images/yellow-warning.gif";
  81. this.imgIcon.Visible = true;
  82. goto Label_018A;
  83. case ModuleMessageType.RedError:
  84. strMessage = strMessage + this.Text;
  85. this.lblHeading.CssClass = "NormalRed";
  86. this.lblMessage.CssClass = "Normal";
  87. this.imgIcon.ImageUrl = "~/images/red-error.gif";
  88. this.imgIcon.Visible = true;
  89. goto Label_018A;
  90. }
  91. }
  92. Label_018A:
  93. this.lblMessage.Text = strMessage;
  94. if (this.Heading != "")
  95. {
  96. this.lblHeading.Visible = true;
  97. this.lblHeading.Text = this.Heading + "<br/>";
  98. }
  99. }
  100. catch (Exception exception1)
  101. {
  102. Exception exc = exception1;
  103. DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, exc, false);
  104. }
  105. }
  106. public string Heading
  107. {
  108. get
  109. {
  110. return this._heading;
  111. }
  112. set
  113. {
  114. this._heading = value;
  115. }
  116. }
  117. public string IconImage
  118. {
  119. get
  120. {
  121. return this._iconImage;
  122. }
  123. set
  124. {
  125. this._iconImage = value;
  126. }
  127. }
  128. public ModuleMessageType IconType
  129. {
  130. get
  131. {
  132. return this._iconType;
  133. }
  134. set
  135. {
  136. this._iconType = value;
  137. }
  138. }
  139. protected virtual Image imgIcon
  140. {
  141. get
  142. {
  143. return this._imgIcon;
  144. }
  145. set
  146. {
  147. this._imgIcon = value;
  148. }
  149. }
  150. protected virtual Image imgLogo
  151. {
  152. get
  153. {
  154. return this._imgLogo;
  155. }
  156. set
  157. {
  158. this._imgLogo = value;
  159. }
  160. }
  161. protected virtual Label lblHeading
  162. {
  163. get
  164. {
  165. return this._lblHeading;
  166. }
  167. set
  168. {
  169. this._lblHeading = value;
  170. }
  171. }
  172. protected virtual Label lblMessage
  173. {
  174. get
  175. {
  176. return this._lblMessage;
  177. }
  178. set
  179. {
  180. this._lblMessage = value;
  181. }
  182. }
  183. public string Text
  184. {
  185. get
  186. {
  187. return this._text;
  188. }
  189. set
  190. {
  191. this._text = value;
  192. }
  193. }
  194. public enum ModuleMessageType
  195. {
  196. GreenSuccess,
  197. YellowWarning,
  198. RedError
  199. }
  200. }
  201. }