public void LookupISODialog_WithInitialQAACodeAndCustomName()
 {
     var dialog = new LookupISOCodeDialog();
     dialog.SelectedLanguage = new LanguageInfo() { Code = "qaa", DesiredName = "Vulcan" };
     Application.Run(dialog);
     MessageBox.Show("returned:" + dialog.SelectedLanguage.Code + " with desired name: " + dialog.SelectedLanguage.DesiredName);
 }
 public void LookupISODialog_WithInitialCodeOnly()
 {
     var dialog = new LookupISOCodeDialog();
     dialog.SelectedLanguage = new LanguageInfo() { Code = "etr"};
     Application.Run(dialog);
     MessageBox.Show("returned:" + dialog.SelectedLanguage.Code + " with desired name: " + dialog.SelectedLanguage.DesiredName);
 }
 private static WritingSystemDefinition ShowCreateNewWritingSystemDialog()
 {
     using (var dlg = new LookupISOCodeDialog()
     {
         ShowDesiredLanguageNameField = false
     })
     {
         dlg.ShowDialog();
         if (dlg.DialogResult != DialogResult.OK)
         {
             return(null);
         }
         var variant = String.Empty;
         if (dlg.SelectedLanguage.Code == WellKnownSubTags.Unlisted.Language)
         {
             variant = "x-" + "Unlisted";
         }
         return(new WritingSystemDefinition(dlg.SelectedLanguage.Code, string.Empty, string.Empty, variant, dlg.SelectedLanguage.Code, false));
     }
 }
 public void LookupISODialog()
 {
     var dialog = new LookupISOCodeDialog();
     Application.Run(dialog);
     MessageBox.Show("returned:" + dialog.SelectedLanguage.Code+" with desired name: "+dialog.SelectedLanguage.DesiredName);
 }
Esempio n. 5
0
		private void OnLookupISOCodeDialogClicked(object sender, EventArgs e)
		{
			using (var dialog = new LookupISOCodeDialog())
				dialog.ShowDialog();
		}
        private LanguageInfo ChangeLanguage(string iso639Code, string potentiallyCustomName=null)
        {
            using (var dlg = new LookupISOCodeDialog())
            {
                //at this point, we don't let them customize the national languages
                dlg.ShowDesiredLanguageNameField = potentiallyCustomName != null;

                dlg.SelectedLanguage = new LanguageInfo() { Code = iso639Code};
                if(!string.IsNullOrEmpty(potentiallyCustomName))
                {
                    dlg.SelectedLanguage.DesiredName = potentiallyCustomName;
                }

                if (DialogResult.OK != dlg.ShowDialog())
                {
                    return null;
                }
                return  dlg.SelectedLanguage;
            }
        }