예제 #1
0
        /// <summary>
        /// Restore Language
        /// Author: jabraok
        /// </summary>
        private void RestoreLang()
        {
            try
            {
                string oldLang = Service.Utility.ReadFile(Model.Constant.LANG_SELECTED_FILE);
                if (!string.IsNullOrEmpty(oldLang))
                {
                    Model.LangID selectedLang = (Model.LangID)Convert.ToInt32(oldLang);
                    switch (selectedLang)
                    {
                    case Model.LangID.Cam:
                        this.rdoCam.Checked = true;
                        break;

                    case Model.LangID.English:
                        this.rdoEnglish.Checked = true;
                        break;

                    default:
                        this.rdoVietnamese.Checked = true;
                        break;
                    }
                }
            }
            catch
            {
            }
        }
예제 #2
0
        /// <summary>
        ///  language radio button checked changed
        /// </summary>
        private void rdoCam_CheckedChanged(object sender, EventArgs e)
        {
            Model.LangID seletedLang = Model.LangID.Cam;
            if (this.rdoCam.Checked)
            {
                this.SetLanguage("ms-MY");
                this.rdoCam.Font        = new Font(this.rdoCam.Font, FontStyle.Bold);
                this.rdoEnglish.Font    = new Font(this.rdoEnglish.Font, FontStyle.Regular);
                this.rdoVietnamese.Font = new Font(this.rdoVietnamese.Font, FontStyle.Regular);
            }
            else if (this.rdoEnglish.Checked)
            {
                seletedLang = Model.LangID.English;
                this.SetLanguage("en-US");
                this.rdoEnglish.Font    = new Font(this.rdoEnglish.Font, FontStyle.Bold);
                this.rdoCam.Font        = new Font(this.rdoCam.Font, FontStyle.Regular);
                this.rdoVietnamese.Font = new Font(this.rdoVietnamese.Font, FontStyle.Regular);
            }
            else
            {
                seletedLang = Model.LangID.Vietnamese;
                this.SetLanguage("vi-VN");
                this.rdoVietnamese.Font = new Font(this.rdoVietnamese.Font, FontStyle.Bold);
                this.rdoCam.Font        = new Font(this.rdoCam.Font, FontStyle.Regular);
                this.rdoEnglish.Font    = new Font(this.rdoEnglish.Font, FontStyle.Regular);
            }

            //Save current value
            int    fromSelected = default(int);
            string fromSize     = default(string);
            int    toSelected   = default(int);
            string toSize       = default(string);
            bool   restoreData  = false;

            if (this.cmbSource.DataSource != default(object))
            {
                restoreData  = true;
                fromSelected = Convert.ToInt32(this.cmbSource.SelectedValue);
                fromSize     = this.cmbSize1.Text;
                toSelected   = Convert.ToInt32(this.cmbDestination.SelectedValue);
                toSize       = this.cmbSize2.Text;
            }

            this._notAct = true;
            this.InitCmbCharType(this.cmbSource);
            this._notAct = false;
            this.cmbSource_SelectedValueChanged(null, null);

            //Store current value
            if (restoreData)
            {
                this.cmbSource.SelectedValue      = fromSelected;
                this.cmbSize1.Text                = fromSize;
                this.cmbDestination.SelectedValue = toSelected;
                this.cmbSize2.Text                = toSize;
            }

            //Write seleced value to File
            Service.Utility.WriteToFile(((int)seletedLang).ToString(), Model.Constant.LANG_SELECTED_FILE);
        }