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

📄 thememanager.cs

📁 community server 源码
💻 CS
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System.Collections;
using System.Collections.Specialized;
using System.IO;
using System.Web;
using System.Web.Caching;
using CommunityServer.Components;
using CommunityServer.Configuration;
using CommunityServer.Controls;
using CommunityServer.Galleries.Components;

namespace CommunityServer.Galleries.Controls
{
	/// <summary>
	/// Summary description for ThemeManager.
	/// </summary>
	public class ThemeManager : BaseThemeManager
	{
		private NameValueCollection SkinList = new NameValueCollection();
		private Hashtable ThemeList = new Hashtable();
        public static string CacheKey = "GalleryThemeManager";
        private ThemeManager()
		{
			
		}

		public static ThemeManager Instance()
		{
            ThemeManager tm = CSCache.Get(CacheKey) as ThemeManager;
			if(tm == null)
			{
				tm = new ThemeManager();
				CacheDependency dep = new CacheDependency(null, new string[]{CSConfiguration.CacheKey});
                CSCache.Insert(CacheKey, tm, dep);
			}

			return tm;
		}

        protected override ThemedApplicationKeyApplicationConfiguration Config
        {
            get { return GalleryConfiguration.Instance(); }
        }

        public static string SkinPath()
        {
            CSContext cntx = CSContext.Current;	
            if(cntx.IsWebRequest)
            {
                Gallery g = Galleries.GetGallery(cntx.ApplicationKey);
                string path = GalleryConfiguration.Instance().ThemeLocation + g.Theme + "/";
                if(path.EndsWith("/"))
                    path = path.Substring(0, path.Length - 1);
                return path.Replace("~", Globals.ApplicationPath);
            }
            else
                return string.Empty;
        }
       
	}
}

⌨️ 快捷键说明

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