Exemple #1
0
        private void cmbLanguage_SelectionChangeCommitted(object sender, EventArgs e)
        {
            string strPath      = Path.GetDirectoryName(Application.ExecutablePath) + "\\Localization\\";
            string strFilterExp = String.Format("F_CulName = '{0}'", cmbLanguage.SelectedValue.ToString());

            DataRow[] drSel = dtLanguageTable.Select(strFilterExp);
            if (drSel.Length < 0)
            {
                return;
            }

            LocalizationRecourceManager.LoadLocalResource(strPath + drSel[0]["F_FileName"].ToString());

            Localization();
        }
Exemple #2
0
        private void LoadSystemSettings()
        {
            string strAppDir = Path.GetDirectoryName(Application.ExecutablePath);

            string strDiscCode         = ConfigurationManager.GetUserSettingString("DiscCode").Trim();
            string strPrtPath          = ConfigurationManager.GetUserSettingString("PrtPath").Trim();
            string strCurCul           = ConfigurationManager.GetUserSettingString("CultureName").Trim();
            string strConnectionString = ConfigurationManager.GetUserSettingString("ConnectionString").Trim();

            // Decrypt Password
            strConnectionString = PasswordProcessing(strConnectionString, true);

            if ("1" == ConfigurationManager.GetUserSettingString("DCEnable").Trim() ||
                (strDiscCode != null && strDiscCode.Length > 0))
            {
                this.cmbDiscList.Enabled = true;
            }
            else
            {
                this.cmbDiscList.Enabled = false;
            }

            // Get the Language File
            string strLangFilePath = strAppDir + "\\Localization\\";
            string strDefCul       = System.Globalization.CultureInfo.CurrentCulture.Name;
            string strDefLangFile  = null;
            string strCurLangFile  = null;

            DataRow drDef = dtLanguageTable.NewRow();

            drDef["F_Description"] = "Default";
            drDef["F_CulName"]     = "Default";
            dtLanguageTable.Rows.Add(drDef);

            string[] files = Directory.GetFiles(strLangFilePath, "*.xml");
            foreach (string file in files)
            {
                System.Xml.XmlReader xmlReader = System.Xml.XmlReader.Create(file);
                xmlReader.ReadToDescendant("Localization");

                DataRow dr = dtLanguageTable.NewRow();
                dr["F_Description"] = xmlReader["description"];
                dr["F_CulName"]     = xmlReader["cultureName"];
                dr["F_FileName"]    = Path.GetFileName(file);
                dtLanguageTable.Rows.Add(dr);

                if (xmlReader["cultureName"] == strDefCul)
                {
                    strDefLangFile = dr["F_FileName"].ToString();
                }

                if (xmlReader["cultureName"] == strCurCul)
                {
                    strCurLangFile = dr["F_FileName"].ToString();
                }
            }

            if (strDefLangFile == null)
            {
                if (dtLanguageTable.Rows.Count > 1)
                {
                    drDef["F_FileName"] = dtLanguageTable.Rows[1]["F_FileName"];
                }
                else
                {
                    drDef["F_FileName"] = "";
                }
            }

            if (strCurLangFile == null)
            {
                strCurCul      = "Default";
                strCurLangFile = drDef["F_FileName"].ToString();
            }

            cmbLanguage.DataSource    = dtLanguageTable;
            cmbLanguage.DisplayMember = "F_Description";
            cmbLanguage.ValueMember   = "F_CulName";
            cmbLanguage.SelectedValue = strCurCul;

            string strLangFile = strLangFilePath + strCurLangFile;

            if (!LocalizationRecourceManager.LoadLocalResource(strLangFile))
            {
                UIMessageDialog.ShowMessageDialog("Failed to Load Language Resource!", "OVR System Error", false, this.Style);
            }

            this.sqlConnection.ConnectionString = strConnectionString;
            this.lbServerName.Text = this.sqlConnection.DataSource;
            this.lbDbName.Text     = this.sqlConnection.Database;
            this.txRptPrtPath.Text = strPrtPath;

            UpdateDisciplineList(strDiscCode);

            Localization();
        }