using System;
using System.Web.UI;
using AspNetForums.Components;
using benSoft.web.WebControls.PopupBox;

namespace AspNetForums
{
	/// <summary>
	/// popup 的摘要说明。
	/// </summary>
	public class popup : Page
	{
		protected PopupBox PopupBox1;

		private void Page_Load(object sender, EventArgs e)
		{
			ForumContext forumContext = ForumContext.Current;
			if (forumContext.User.PrivateMessagePopup)
			{
				int unreadMessages = PrivateMessages.GetUnreadMessagesCount(forumContext.User.UserID);
				if (unreadMessages > 0)
				{
					PopupBox1.Focus = false;
					if (forumContext.User.PrivateMessagePopupMusic)
					{
						PopupBox1.Sound = Globals.GetSkinPath() + "/sound/type.wav";
					}

					PopupBox1.Text = "<a href=# onclick=\"top.location='" + Globals.GetSiteUrls().UserPrivateMessages + "'\">" + string.Format(ResourceManager.GetString("PrivateMessages_UnreadMessages"), unreadMessages) + "</a>";
					PopupBox1.CreatePopup();
				}
			}
		}

		#region Web 窗体设计器生成的代码

		protected override void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}

		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.Load += new EventHandler(this.Page_Load);

		}

		#endregion
	}
}