⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 blogthreadsubscribelinkbutton.cs

📁 本系统是在asp版《在线文件管理器》的基础上设计制作
💻 CS
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System.Web.UI.WebControls;
using CommunityServer.Blogs.Components;
using CommunityServer.Components;
using CommunityServer.Controls;

namespace CommunityServer.Blogs.Controls
{
    /// <summary>
    /// Summary description for BlogThreadSubscribeLinkButton.
    /// </summary>
    public class BlogThreadSubscribeLinkButton : LinkButton
    {
        public BlogThreadSubscribeLinkButton():base()
        {
			
        }

		protected override void OnInit(System.EventArgs e)
		{
			base.OnInit (e);
			this.Click +=new System.EventHandler(BlogThreadSubscribeLinkButton_Click);
			CurrentUser = CSContext.Current.User;
		}

		


		protected override void OnPreRender(System.EventArgs e)
		{
			if(CurrentUser.IsAnonymous)
			{
				this.Controls.Clear();
				this.Visible = false;
			}
			
			base.OnPreRender (e);
		}

		protected User CurrentUser  = null;


        private WeblogPost _post;
        /// <summary>
        /// Property Post (WeblogPost)
        /// </summary>
        public WeblogPost Post
        {
            get {  return this._post; }
            set {  this._post = value; }
        }

		public override string Text
		{
			get
			{
				if(!CurrentUser.IsAnonymous)
				{
					if(Post.GetIsTracked(CurrentUser.UserID))
						return ResourceManager.GetString("Weblogs_UnTrack");
					else
						return ResourceManager.GetString("Weblogs_Track");
				}
				return string.Empty;
			}
			set
			{
				//base.Text = value;
			}
		}

        
//
//        protected override bool IsTracked(CSContext fcntx)
//        {
//            return Post.IsTracked;
//        }


//        protected override void Toggle(CSContext fcntx)
//        {
//            //TODO handle named posts
//
//            ThreadTracking.ReverseThreadTrackingOptions(fcntx.User.UserID, Post.PostID);
//            fcntx.Context.Response.Redirect( BlogUrls.Instance().Post(Post),true);
//		}

		private void BlogThreadSubscribeLinkButton_Click(object sender, System.EventArgs e)
		{
            int userID = CSContext.Current.User.UserID;
            ThreadTracking.ResetCache(Post.ThreadID,userID);
			ThreadTracking.ReverseThreadTrackingOptions(userID,Post.PostID);
			Context.Response.Redirect( BlogUrls.Instance().Post(Post),true);
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -