📄 style.cs
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
// Copyright (c) Telligent Systems Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using System.Web.UI;
using CommunityServer.Blogs.Components;
using CommunityServer.Components;
namespace CommunityServer.Blogs.Controls
{
/// <summary>
/// Renders 1 to 3 style sheets depeneding on user preferences
/// </summary>
public class Style : Control
{
public Style()
{
WeblogConfig = WeblogConfiguration.Instance();
}
protected WeblogConfiguration WeblogConfig = null;
protected override void Render(HtmlTextWriter writer)
{
Weblog weblog = Weblogs.GetWeblog(CSContext.Current.ApplicationKey,true,true);
if(weblog != null)
{
writer.WriteLine(styleFormat,CSSPath(weblog.Theme,"style.css"),"screen");
if(WeblogConfig.EnableThemes && weblog.SecondaryCSS != null)
writer.WriteLine(styleFormat,CSSPath(weblog.Theme, weblog.SecondaryCSS),"screen");
if(WeblogConfig.EnableThemes && weblog.CSSOverride != null)
writer.WriteLine(styleFormat, BlogUrls.Instance().CustomCSS(weblog.ApplicationKey),"screen");
}
}
protected string CSSPath(string theme, string fileName)
{
if(theme == null || !WeblogConfig.EnableThemes)
theme = WeblogConfig.DefaultTheme;
string path = string.Format("{0}{1}/style/{2}",WeblogConfig.ThemeLocation,theme,fileName);
return this.ResolveUrl(path);
}
static string styleFormat = "<link rel=\"stylesheet\" href=\"{0}\" type=\"text/css\" media=\"{1}\" />";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -