您目前尚未登陆,请选择【登陆】或【注册
首页->全站代码->MyWebPages51aspx汉化最终版>>App-Code/Controls/PageBaseClass.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:MyWebPages51aspx汉化最终版
当前文件:文件类型 MyWebPagesStarterKit/App_Code/Controls/PageBaseClass.cs打开代码结构图
普通视图
		            
1//=============================================================================================== 2// 3// (c) Copyright Microsoft Corporation. 4// This source is subject to the Microsoft Permissive License. 5// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx. 6// All other rights reserved. 7// 8//=============================================================================================== 9 10using System; 11using System.Web.UI; 12using System.IO; 13using System.Threading; 14using System.Globalization; 15using System.Web.UI.HtmlControls; 16 17namespace MyWebPagesStarterKit.Controls 18{ 19 public abstract class PageBaseClass : Page 20 { 21 protected WebSite _website; 22 23 public PageBaseClass(){} 24 25 protected override void OnPreInit(EventArgs e) 26 { 27 base.OnPreInit(e); 28 _website = WebSite.GetInstance(); 29 30 if((_website.Theme == string.Empty) || (!Directory.Exists(Server.MapPath(string.Format("~/App_Themes/{0}", _website.Theme))))){ 31 string appThemesPath = Server.MapPath("~/App_Themes"); 32 string[] themes = Directory.GetDirectories(appThemesPath); 33 if (themes.Length > 0) 34 { 35 //if theme TravelDiary, select as default, else choose first theme 36 bool blnTravelDiary = false; 37 foreach (string theme in themes) 38 { 39 if (Path.GetFileName(theme) == "TravelDiary") 40 blnTravelDiary = true; 41 } 42 _website.Theme = blnTravelDiary == true ? "TravelDiary" : Path.GetFileName(themes[0]); 43 } 44 else 45 { 46 _website.Theme = string.Empty; 47 } 48 _website.SaveData(); 49 } 50 Theme = _website.Theme; 51 } 52 53 protected override void InitializeCulture() 54 { 55 // Initialize Resource Manager - with no effect if it's already been initialized 56 string LocaleID = WebSite.GetInstance().LocaleID; 57 UICulture = LocaleID; 58 Culture = LocaleID; 59 Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(LocaleID); 60 Thread.CurrentThread.CurrentUICulture = new CultureInfo(LocaleID); 61 base.InitializeCulture(); 62 } 63 64 protected void Page_PreRender(object sender, EventArgs e) 65 { 66 if (_website.Theme == "Arabic") 67 { 68 HtmlGenericControl body = (HtmlGenericControl)Master.FindControl("body1"); 69 body.Attributes.Add("dir", "rtl"); 70 } 71 } 72 } 73} 74
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:MyWebPages51aspx汉化最终版
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号