themedropdownlist.cs

来自「本系统是在asp版《在线文件管理器》的基础上设计制作」· CS 代码 · 共 57 行

CS
57
字号
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using System.Web;
using System.IO;
using System.Web.UI.WebControls;
using CommunityServer.Components;
using CommunityServer.Configuration;

namespace CommunityServer.Controls {

    public class ThemeDropDownList : DropDownList {

        public ThemeDropDownList() {

            HttpContext context = CSContext.Current.Context;

            string[] dirs = Directory.GetDirectories( context.Request.PhysicalApplicationPath + CSConfiguration.GetConfig().FilesPath + "\\themes" );

            foreach (string s in dirs) {

                DirectoryInfo dirInfo = new DirectoryInfo(s);

				// check to ensure we skip any directories that start
				// with an underscore.
				//
				if (dirInfo.Name.Length > 0) {
					if (!dirInfo.Name.StartsWith("_" ) && string.Compare(dirInfo.Name, "blogs", true) != 0 && string.Compare(dirInfo.Name,"galleries",true) != 0) {

						// Add directories
						//
						Items.Add(new ListItem(dirInfo.Name, dirInfo.Name));
					}
				}
            }
        }

        public override string SelectedValue {
            get {
                return base.SelectedValue;
            }
            set {
                if (Items.FindByValue(value) == null)
                    Items.FindByValue("default").Selected = true;
                else
                    base.SelectedValue = value;
            }
        }


    }
}

⌨️ 快捷键说明

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