Click here to Skip to main content
15,886,026 members
Articles / Web Development / ASP.NET

Open Source Extensible Enterprise n-tier Application Framework with Multilayered Architecture

Rate me:
Please Sign up or sign in to vote.
4.67/5 (2 votes)
3 Dec 2010MIT3 min read 36.9K   770   41  
Xenta architecture overview
using System;
using System.ComponentModel;
using System.IO;
using System.Web.UI.WebControls;
using SiberTek.Xenta.Utils;
using SiberTek.Xenta.Web.Controls;

namespace SiberTek.Xenta.Web.Admin.Modules
{
    public partial class ThemeDropDownList : UserControlBase, IDropDownList<String>
    {
        #region Events
        public event EventHandler SelectedIndexChanged;
        #endregion
     
        #region Properties
        public bool AutoPostBack
        {
            get
            {
                return lstThemeList.AutoPostBack;
            }
            set
            {
                lstThemeList.AutoPostBack = value;
            }
        }

        public bool AllowEmptyItem
        {
            get
            {
                return Convert.ToBoolean(ViewState["AllowEmptyItem"]);
            }
            set
            {
                ViewState["AllowEmptyItem"] = value;
            }
        }

        [Browsable(false)]
        public string SelectedValue
        {
            get
            {
                return lstThemeList.SelectedValue;
            }
            set
            {
                lstThemeList.SelectedValue = value;
            }
        }

        public int ItemCount
        {
            get
            {
                return lstThemeList.Items.Count;
            }
        }

        public bool Enabled
        {
            set
            {
                lstThemeList.Enabled = value;
            }
        }
        #endregion

        #region Methods
        public override void BindData()
        {
            try
            {
                string themesDir = PathHelper.MapPath("App_Themes");
                
                if(AllowEmptyItem)
                {
                    lstThemeList.Items.Add(new ListItem("-", String.Empty));
                }

                if(Directory.Exists(themesDir))
                {
                    foreach(string dirpath in Directory.GetDirectories(themesDir))
                    {
                        string dirname = Path.GetFileName(dirpath);

                        lstThemeList.Items.Add(new ListItem(dirname, dirname));
                    }
                }
                lstThemeList.DataBind();
            }
            catch(Exception ex)
            {
                Page.ShowMessage(ex.Message);
            }
            base.BindData();
        }
        #endregion

        #region Handlers
        protected void LstThemeList_OnSelectedIndexChanged(object sender, EventArgs e)
        {
            FireSelectedIndexChangedEvent();
        }
        #endregion

        #region Utilities
        private void FireSelectedIndexChangedEvent()
        {
            if(SelectedIndexChanged != null)
            {
                SelectedIndexChanged(this, EventArgs.Empty);
            }
        }
        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
Russian Federation Russian Federation
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions