Exemple #1
0
 private void OnLanguageChanged(TranslationBase oldTranslation)
 {
     if (LanguageChanged != null)
     {
         LanguageChanged(this, new TranslationChangedEventArgs(oldTranslation, CurrentTranslation));
     }
 }
Exemple #2
0
        public bool LoadTranslations(string sourceDirectory)
        {
            //Load each of the translation's DLL files
            if (!Directory.Exists(sourceDirectory))
            {
                return(false);
            }

            Translations.Clear();

            foreach (FileInfo file in new DirectoryInfo(sourceDirectory).GetFiles("*.dll"))
            {
                Assembly assembly = Assembly.LoadFile(file.FullName);

                if (assembly != null)
                {
                    Type[] pluginTypes = assembly.GetTypes();

                    foreach (Type t in pluginTypes)
                    {
                        if (typeof(TranslationBase).IsAssignableFrom(t))
                        {
                            if (!t.IsAbstract && t.IsPublic)
                            {
                                //Load this plugin
                                try
                                {
                                    TranslationBase newTranslation = (TranslationBase)assembly.CreateInstance(t.FullName);
                                    Translations.Add(newTranslation);
                                }
                                catch
                                {
                                }
                            }
                        }
                    }
                }
            }

            RefreshCurrentTranslation();

            return(true);
        }
Exemple #3
0
 internal TranslationChangedEventArgs(TranslationBase oldTranslation, TranslationBase newTranslation)
 {
     Previous = oldTranslation;
     Current  = newTranslation;
 }
 private void OnLanguageChanged(TranslationBase oldTranslation)
 {
     if (LanguageChanged != null)
     {
         LanguageChanged(this, new TranslationChangedEventArgs(oldTranslation, CurrentTranslation));
     }
 }
 internal TranslationChangedEventArgs(TranslationBase oldTranslation, TranslationBase newTranslation)
 {
     Previous = oldTranslation;
     Current = newTranslation;
 }