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

📄 tabs.cs

📁 本系统是在asp版《在线文件管理器》的基础上设计制作
💻 CS
📖 第 1 页 / 共 2 页
字号:

            
            sb.Append("<div id=\"bread\">");
                            
            foreach(Tab parent in tc.Tabs)
            {
                //Is this parent enabled? Check Permissions
                if(parent.Enabled && IncludeLink(parent))
                {
                    SelectedState state = GetState(parent);
                    if(state == SelectedState.Not)
                    {
                        if(parent.IsRoot)
                            sb.AppendFormat("You are here: <a href=\"{0}\">{1}</a>  ",FormatLink(parent),parent.Text);
                    }
                    else if(state == SelectedState.Parent && !parent.IsRoot)
                        sb.AppendFormat("<a href=\"{0}\">{1}</a> ",FormatLink(parent), parent.Text);
                    else if(state == SelectedState.Child)
                    {
                        sb.AppendFormat("<a href=\"{0}\">{1}</a>  ",FormatLink(parent),parent.Text);
                        if(parent.HasChildren)
                        {
                            foreach(Tab child in parent.Children)
                            {
                                if(string.Compare(child.Name,this.SelectedTab,true,CultureInfo.InvariantCulture) == 0)
                                {
                                   sb.AppendFormat("<a href=\"{0}\">{1}</a>",FormatLink(child),child.Text);
                                }
                            }
                        }

                    }
                    else if(state == SelectedState.ChildChild)
                    {
                        foreach(Tab child in parent.Children)
                        {
                            if(child.HasChildren)
                            {
                                foreach(Tab cc in child.Children)
                                {
                                    if(string.Compare(cc.Name,this.SelectedTab,true,CultureInfo.InvariantCulture) == 0)
                                    {
                                        sb.AppendFormat("<a href=\"{0}\">{1}</a> >> ",FormatLink(parent),parent.Text);
                                        sb.AppendFormat("<a href=\"{0}\">{1}</a> >> ",FormatLink(child),child.Text);
                                        sb.AppendFormat("<a href=\"{0}\">{1}</a>",FormatLink(cc),cc.Text);
                                    }
                                }
                            }
                        }
                    }
                }
            }



            sb.Append("</div>");
            //return results
            return sb.ToString();
        }
        #endregion

        #region Render
        /// <summary>
        /// Renders the Html representing the Tab control
        /// </summary>
        /// <param name="writer"></param>
        protected override void Render(HtmlTextWriter writer)
        {
            #if DEBUG
                    writer.WriteLine("<!--Tab Control Start -->");
            #endif
            
            string output = ViewState["Tabs"] as String;
            if(output == null)
            {                
                output = CreateTabMarkUp();
                ViewState["Tabs"] = output;

            }
            writer.WriteLine(output);

            #if DEBUG
                    writer.WriteLine("<!--Tab Control End -->");
            #endif


        }
        #endregion

        #region SelectedState
        /// <summary>
        /// Internal enum used to track if a tab is selected
        /// </summary>
        protected enum SelectedState
        {
            Not,
            Parent,
            Child,
            ChildChild
        };
        #endregion

    }

    #region TabCollection
    /// <summary>
    /// TabCollection is a container for all of the tabs.
    /// </summary>
    [Serializable]
    public class TabCollection
    {
         private Tab[] _tabs;
         /// <summary>
         /// Property Tabs (Tab[])
         /// </summary>
        [XmlArray("Tabs")]
        public Tab[] Tabs
         {
             get {  return this._tabs; }
             set {  this._tabs = value; }
        }
    }
    #endregion

    #region Tab
    /// <summary>
    /// Tab is a container object which represents a singe tab
    /// </summary>
    [Serializable]
    public class Tab
    {
        #region Private Members
        private string _text;
        private string _href;
        private string _name;
        private string _queryString;
        private string _roles;
        private bool _enable = true;
        private Tab[] _children;
        private bool _isRoot = false;
		private string _filter = null;
        #endregion

        #region Public Properties
        /// <summary>
        /// Property Text (string)
        /// </summary>
        [XmlAttribute("text")]
        public string Text
        {
            get {  return this._text; }
            set {  this._text = value; }
        }

		[XmlAttribute("filter")]
		public string Filter
		{
			get
			{
				return _filter;
			}
			set
			{
				_filter= value;
			}
		}

        
        /// <summary>
        /// Property Href (string)
        /// </summary>
        [XmlAttribute("href")]
        public string Href
        {
            get {  return this._href; }
            set {  this._href = value; }
        }

        /// <summary>
        /// Property Name (string)
        /// </summary>
        [XmlAttribute("name")]
        public string Name
        {
            get {  return this._name; }
            set {  this._name = value; }
        }

        /// <summary>
        /// Property QueryString (string)
        /// </summary>
        [XmlAttribute("querystring")]
        public string QueryString
        {
            get {  return this._queryString; }
            set {  this._queryString = value; }
        }

        /// <summary>
        /// Property Roles (string)
        /// </summary>
        [XmlAttribute("roles")]
        public string Roles
        {
            get {  return this._roles; }
            set {  this._roles = value; }
        }


        /// <summary>
        /// Property Enable (bool)
        /// </summary>
        [XmlAttribute("enabled")]
        public bool Enabled
        {
            get {  return this._enable; }
            set {  this._enable = value; }
        }

        /// <summary>
        /// Property Enable (bool)
        /// </summary>
        [XmlAttribute("isRoot")]
        public bool IsRoot
        {
            get {  return this._isRoot; }
            set {  this._isRoot = value; }
        }

        /// <summary>
        /// Property Children (Tab[])
        /// </summary>
        [XmlArray("SubTabs")]
        public Tab[] Children
        {
            get {  return this._children; }
            set {  this._children = value; }
        }
        #endregion

        #region Has Helpers
        public bool HasChildren
        {
            get{return this.Children != null && this.Children.Length > 0;}
        }

        public bool HasQueryString
        {
            get{return !Globals.IsNullorEmpty(this.QueryString);}
        }

        public bool HasRoles
        {
            get{return !Globals.IsNullorEmpty(this.Roles);}
        }
        #endregion

    }
    #endregion
}

⌨️ 快捷键说明

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