예제 #1
0
 private void UpdateOutputLanguageCombobox(LanguageDictionary inputLanguage)
 {
     if (inputLanguage != null && previousInputLanguage != inputLanguage)
     {
         // update output language combobox
         List <Language> outputLanguages = inputLanguage?.Translations?.OrderBy(v => v.Name).ToList() ?? new List <Language>();
         OutputLanguageCollection.Clear();
         OutputLanguageCollection.AddRange(outputLanguages);
         this.outputLanguageComboBox.SelectedValue =
             OutputLanguageCollection.FirstOrDefault(v => v.Name.Equals(outputLanguageName, StringComparison.OrdinalIgnoreCase)) ??
             OutputLanguageCollection.FirstOrDefault();
     }
     previousInputLanguage = inputLanguage;
 }
        private void InputLanguageChanged()
        {
            if (InputLanguage != null)
            {
                // update output language combobox
                string outputLangCode = customOutputLanguage?.Code ?? OutputLanguage?.Code;
                OutputLanguageCollection.Clear();
                OutputLanguageCollection.AddRange(InputLanguageCollection.Where(x => x.Code != InputLanguage.Code));

                OutputLanguage       = OutputLanguageCollection.FirstOrDefault(l => l.Code.Equals(outputLangCode ?? DefaultLanguage.Code, StringComparison.OrdinalIgnoreCase)) ?? OutputLanguageCollection.FirstOrDefault();
                customOutputLanguage = null;

                // Pivot Image
                this.detectedLanguageTextBox.Text = $"Detected Language: {InputLanguage.Name}";
            }
        }