private void OnLanguageChanged(TranslationBase oldTranslation) { if (LanguageChanged != null) { LanguageChanged(this, new TranslationChangedEventArgs(oldTranslation, CurrentTranslation)); } }
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); }
internal TranslationChangedEventArgs(TranslationBase oldTranslation, TranslationBase newTranslation) { Previous = oldTranslation; Current = newTranslation; }