App_Code/Controls/PageBaseClass.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

//===============================================================================================
//
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Permissive License.
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
//
//===============================================================================================

using System;
using System.Web.UI;
using System.IO;
using System.Threading;
using System.Globalization;
using System.Web.UI.HtmlControls;

namespace MyWebPagesStarterKit.Controls
{
    public abstract class PageBaseClass : Page
    {
        protected WebSite _website;

        public PageBaseClass(){}

        protected override void OnPreInit(EventArgs e)
        {
            base.OnPreInit(e);
            _website = WebSite.GetInstance();

            if((_website.Theme == string.Empty) || (!Directory.Exists(Server.MapPath(string.Format("~/App_Themes/{0}", _website.Theme))))){
                string appThemesPath = Server.MapPath("~/App_Themes");
                string[] themes = Directory.GetDirectories(appThemesPath);
                if (themes.Length > 0)
                {
                    //if theme TravelDiary, select as default, else choose first theme
                    bool blnTravelDiary = false;
                    foreach (string theme in themes)
                    {
                        if (Path.GetFileName(theme) == "TravelDiary")
                            blnTravelDiary = true;
                    }
                    _website.Theme = blnTravelDiary == true ? "TravelDiary" : Path.GetFileName(themes[0]);
                }
                else
                {
                    _website.Theme = string.Empty;
                }
                _website.SaveData();
            }
            Theme = _website.Theme;
        }

        protected override void InitializeCulture()
        {
            // Initialize Resource Manager - with no effect if it's already been initialized
            string LocaleID = WebSite.GetInstance().LocaleID;
            UICulture = LocaleID;
            Culture = LocaleID;
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(LocaleID);
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(LocaleID);
后面还有 13 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。