📄 style.cs
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
// Copyright (c) Telligent Systems Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System.Web.UI;
using CommunityServer.Components;
using CommunityServer.Galleries.Components;
namespace CommunityServer.Galleries.Controls
{
/// <summary>
/// Summary description for Style.
/// </summary>
public class Style : Control
{
public Style()
{
GalleryConfig = GalleryConfiguration.Instance();
}
protected GalleryConfiguration GalleryConfig = null;
protected override void Render(HtmlTextWriter writer)
{
Gallery gallery = Galleries.GetGallery(CSContext.Current.ApplicationKey);
if(gallery != null)
{
writer.WriteLine(styleFormat,CSSPath(gallery.Theme, "style.css"), "screen");
if(GalleryConfig.EnableThemes && gallery.SecondaryCSS != null)
writer.WriteLine(styleFormat,CSSPath(gallery.Theme, gallery.SecondaryCSS), "screen");
if(GalleryConfig.EnableThemes && gallery.CSSOverride != null)
writer.WriteLine(styleFormat, GalleryUrls.Instance().CustomCSS(gallery.ApplicationKey), "screen");
}
}
protected string CSSPath(string theme, string fileName)
{
if(theme == null || !GalleryConfig.EnableThemes)
theme = GalleryConfig.DefaultTemplate;
string path = string.Format("{0}{1}/style/{2}", GalleryConfig.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 + -