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

📄 weblogthemedcontrol.cs

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

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

namespace CommunityServer.Blogs.Controls
{
	/// <summary>
	/// Summary description for WeblogThemedControl.
	/// </summary>
	public abstract class WeblogThemedControl : WeblogTemplatedWebControl
	{
		public WeblogThemedControl()
		{

		}

        private WeblogConfiguration weblogConfig = null;
		private ThemeConfig themeConfig = null;


		protected WeblogConfiguration WeblogConfig
		{
			get
			{
				if(weblogConfig == null)
					weblogConfig = WeblogConfiguration.Instance();

				return weblogConfig;
			}
		}

        protected override string ThemeName
        {
            get
            {
				if(WeblogConfig.EnableThemes)
					return CurrentWeblog.Theme;
				else
					return WeblogConfig.DefaultTheme;
            }
        }

		protected ThemeConfig ThemeConfig
		{
			get
			{
				if(themeConfig == null)
					themeConfig = ThemeManager.Instance().GetTheme(ThemeName);

				return themeConfig;
			}
		}

        /// <summary>
        /// All skins should be found in the skin directory and named after the control.
        /// </summary>
        protected override string ExternalSkinFileName
        {
            get
            {
                return string.Format("Skins/Skin-{0}.ascx",this.GetType().Name);
                //return CreateExternalSkinFileName(null);
            }
        }

        /// <summary>
        /// Overriding CreateChildControls allows us to replace control logic with our true hierarchal loading. (ie, A control can have a 
        /// parent other than default)
        /// </summary>
        protected override void CreateChildControls()
        {
            Controls.Clear();

            bool _skinLoaded = false;
            
            if(SkinTemplate != null ) 
            {
                SkinTemplate.InstantiateIn( this );
                _skinLoaded = true;
            }

            if(!_skinLoaded && this.Page != null)
            {
                string path = ThemeManager.Instance().SkinPath(this.ThemeName,ExternalSkinFileName);
                Control skin = this.Page.LoadControl( path );
                this.Controls.Add( skin );
                _skinLoaded = true;
            }

            if(_skinLoaded)
                AttachChildControls();

        }

        protected void SetPageTitle(string text)
        {
			if(Globals.IsNullorEmpty(text))
				CommunityServer.Controls.Title.Set(CurrentWeblog.Name,Context);
			else
				CommunityServer.Controls.Title.Set(string.Format("{0} : {1}", CurrentWeblog.Name,text), Context);
        }


	}
}

⌨️ 快捷键说明

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