void App_Startup(object sender, StartupEventArgs e) { AppDomain.CurrentDomain.AssemblyResolve += OnResolveAssembly; Translation = KaedeEngine.KaedeEngine.LoadLocale(Settings.Default.PreferredLocale); AkemiSwitcherUI window = new AkemiSwitcherUI(); uiRef = window; int sIndex = 0; foreach (LocalePreview l in Translation.AllLocales) { window.languageSelectionBox.Items.Add(l.LocalisedName); if (l.Id == Translation.Locale.Id) { window.languageSelectionBox.SelectedIndex = sIndex; } sIndex++; } window.btnSwitch.Background = this.FindResource("ButtonStateDisabled") as Brush; window.btnSwitch.IsEnabled = false; window.btnSwitch.Content = Translation.GetString("info_wait"); window.versionText.Content = string.Format("{0} v{1}", System.Reflection.Assembly.GetEntryAssembly().GetName().Name, System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString() ); window.Show(); switcher.OnSwitcherMessage += onSwitcherMessage; switcher.Prepare(); }
public void UpdateLanguageByIndex(int Index) { if (Translation != null && Translation.AllLocales[Index] != null) { Settings.Default.PreferredLocale = Translation.AllLocales[Index].Code; Settings.Default.Save(); Translation = KaedeEngine.KaedeEngine.LoadLocale(Translation.AllLocales[Index].Code); if (lastEv != null) { SwitcherMessageEvent t = lastEv; t.justText = true; onSwitcherMessage(null, t); } } }