Exemplo n.º 1
0
 public Task Invoke(IContext context, CommandParameters parameters)
 {
     _shell.InvokeLater(() =>
     {
         var tf = new TranslationForm();
         tf.Show(_shell);
     });
     return(Task.CompletedTask);
 }
Exemplo n.º 2
0
 /// <summary>Constructor.</summary>
 /// <param name="programTitle">The title of the program - to be displayed in the translation UI.</param>
 /// <param name="moduleName">Name of the module being translated - used to construct the filename for the translation file.</param>
 /// <param name="editable">Whether translation editing UI should be included.</param>
 /// <param name="settings">Translation window settings, such as window position/size.</param>
 /// <param name="icon">The icon to use on the translation window.</param>
 /// <param name="getCurrentLanguage">A callback that returns the currently active language whenever called.</param>
 public LanguageHelperWinForms(string programTitle, string moduleName, bool editable,
                               TranslationForm <TTranslation> .Settings settings, Icon icon, Func <Language> getCurrentLanguage)
     : base(programTitle, moduleName, editable, getCurrentLanguage)
 {
     if (settings == null)
     {
         throw new ArgumentNullException(nameof(settings));
     }
     if (icon == null)
     {
         throw new ArgumentNullException(nameof(icon));
     }
     _settings = settings;
     _icon     = icon;
 }
Exemplo n.º 3
0
 /// <summary>Override; see base.</summary>
 protected override void EditCurrentLanguage()
 {
     if (_getCurrentLanguage() == _defaultLanguage)
     {
         DlgMessage.Show("The currently selected language is the native language of this application and cannot be edited.", "Edit current language", DlgType.Info);
         return;
     }
     if (_translationForm == null)
     {
         try
         {
             _translationForm = new TranslationForm <TTranslation>(_settings, _icon, _programTitle, _moduleName, _getCurrentLanguage());
         }
         catch (Exception ex)
         {
             DlgMessage.Show("Translation could not be loaded: " + ex.Message, "Edit current language", DlgType.Info);
             return;
         }
         _translationForm.TranslationChanged += tr => { FireTranslationChanged(tr); };
         _translationForm.FormClosed         += delegate { _translationForm = null; };
     }
     _translationForm.Show();
 }
Exemplo n.º 4
0
        static void ChangeActiveLanguage(Language language)
        {
            activeLanguage.Language = language;

            var appSetting = new AppSetting
            {
                Name  = "Current Language",
                Value = language.Id.ToString()
            };

            appSetting.Update();

            var translationForm = new TranslationForm();
            var addLanguage     = new AddLanguage();

            foreach (Form form in Application.OpenForms)
            {
                if (dictionaries.ParentForms.ContainsKey(form.UniqueID()))
                {
                    Translate(form);
                }
            }
        }