using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using System.IO;
using DictionaryConfiguration;
using Telerik.WebControls;


namespace DictionaryConfigurator
{
    public partial class _Default : System.Web.UI.Page
    {
        private Dictionaries _dictionaries = new Dictionaries(HttpContext.Current);

        protected void rcbDictionaries_SelectedIndexChanged(object o, Telerik.WebControls.RadComboBoxSelectedIndexChangedEventArgs e)
        {
            SetLanguage();
        }

        protected void RadTabStrip1_TabClick(object sender, TabStripEventArgs e)
        {
            SetLanguage();
        }

        private void SetLanguage()
        {
            RadSpell1.DictionaryLanguage = Path.GetFileNameWithoutExtension(rcbDictionaries.Text);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                rcbDictionaries.DataSource = _dictionaries.DictionaryNames();
                rcbDictionaries.DataBind();
            }
        }
    }
}
