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

📄 styleskin.cs

📁 微软的.NET论坛的源代码(COOL!!!)
💻 CS
字号:
using System;
using System.Web;
using System.Web.UI;
using AspNetForums.Components;

namespace AspNetForums.Controls {

    // *********************************************************************
    //  StyleSkin
    //
    /// <summary>
    /// Encapsulated rendering of style based on the selected skin.
    /// </summary>
    // ********************************************************************/ 
    public class StyleSkin : LiteralControl {
        string title = Globals.SiteName;
        bool displayTitle = true;

        // Controls the style applied to the site
        public StyleSkin() {

            User user = null;
            string styleName = Globals.SiteStyle;

            // Get the user if available we'll personalize the style
            if (HttpContext.Current.Request.IsAuthenticated) {
                user = Users.GetUserInfo(HttpContext.Current.User.Identity.Name, true);
                styleName = user.SiteStyle;
            }

            if (DisplayTitle) {

                if (user != null)
                    base.Text = "<title>" + Title + " (Logged in as: " + user.Username + ")</title>\n";
                else
                    base.Text = "<title>" + Title + "</title>\n";
            }

            // Add the style sheet
            base.Text += "    <link rel=\"stylesheet\" href=\"" + Globals.ApplicationVRoot + "/skins/" + styleName + "/style/default.css\" type=\"text/css\" />";

        }

        // Used to set the title of the page the control is rendered on
        public string Title {
            get { return title; }
            set { title = title + ": " + value; }
        }

        public bool DisplayTitle {
            get { return displayTitle; }
            set { displayTitle = value; }
        }
    }
}

⌨️ 快捷键说明

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