コード例 #1
0
        private void TradosLPs_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            const int comboboxColumnIndex     = 1;
            DataGridViewComboBoxCell comboBox = (DataGridViewComboBoxCell)TradosLPs.Rows[e.RowIndex].Cells[comboboxColumnIndex];

            if (comboBox.Value != null)
            {
                string newLP = TradosLPs[e.ColumnIndex, e.RowIndex].Value as string;

                ETSApi.TradosToETSLP lpPairing = TradosLPs[e.ColumnIndex, e.RowIndex].Tag as ETSApi.TradosToETSLP;
                Options.LPPreferences[lpPairing.TradosCulture] = lpPairing.ETSLPs.First(lp => lp.LanguagePairId == newLP);
            }
        }
コード例 #2
0
        void TradosLPs_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
        {
            for (int i = 0; i < TradosLPs.Rows.Count; i++)
            {
                DataGridViewComboBoxCell comboCell = (DataGridViewComboBoxCell)TradosLPs.Rows[i].Cells["SDL ETS Language Pair"];
                ETSApi.TradosToETSLP     entry     = TradosLPs.Rows[i].DataBoundItem as ETSApi.TradosToETSLP;

                comboCell.Tag        = entry;
                comboCell.DataSource = entry.ETSLPs.Select(lp => lp.LanguagePairId).ToList();
                if (Options.LPPreferences.ContainsKey(entry.TradosCulture))
                {
                    comboCell.Value = Options.LPPreferences[entry.TradosCulture].LanguagePairId;
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Get dictionaries from the MT Edge server
        /// </summary>
        /// <param name="tradosToETSLP"></param>
        /// <param name="options"></param>
        public static void GetDictionaries(TradosToETSLP tradosToETSLP, TranslationOptions options)
        {
            var queryString = HttpUtility.ParseQueryString(string.Empty);

            foreach (var item in tradosToETSLP.ETSLPs)
            {
                queryString["sourceLanguageId"] = item.SourceLanguageId;
                queryString["targetLanguageId"] = item.TargetLanguageId;
                queryString["perPage"]          = "1000";        // set to 1000 to avoid the missing dictionaries
                var jsonResult = ContactETSServer(ETSGet, options, "dictionaries", queryString);

                var result = JsonConvert.DeserializeObject <DictionaryInfo>(jsonResult);
                tradosToETSLP.Dictionaries = new List <DictionaryModel>(result.Dictionaries);
                tradosToETSLP.Dictionaries.Insert(0, new DictionaryModel
                {
                    DictionaryId     = Constants.NoDictionary,
                    SourceLanguageId = string.Empty,
                    TargetLanguageId = string.Empty
                });
            }
        }
コード例 #4
0
 private void ConfigureDictionary(string currentDictionaryId, DataGridViewComboBoxCell dictionariesCombo, ETSApi.TradosToETSLP entry)
 {
     if (string.IsNullOrEmpty(currentDictionaryId))
     {
         Options.LPPreferences[entry.TradosCulture].DictionaryId = entry.Dictionaries[0].DictionaryId;
         dictionariesCombo.Value = entry.Dictionaries[0].DictionaryId;
     }
     else
     {
         dictionariesCombo.Value = currentDictionaryId;
         Options.LPPreferences[entry.TradosCulture].DictionaryId = currentDictionaryId;
     }
 }