public void Initialize() { #region Themes ThemeManager.RegisterMaterialThemes(); List <Theme> themes = Theme.Themes.Where(x => !x.IsStandard).ToList(); Themes = CollectionViewSource.GetDefaultView(themes); Themes.MoveCurrentTo(null); Themes.CurrentChanged += (s, e) => { Theme theme = Themes.CurrentItem as Theme; ApplicationThemeHelper.ApplicationThemeName = theme.Name; Settings.Default.ThemeName = theme.Name; }; Themes.MoveCurrentTo(themes.Find(x => x.Name == Settings.Default.ThemeName)); #endregion Themes #region Languages List <CultureInfo> languages = new List <CultureInfo> { new CultureInfo("en"), new CultureInfo("tr") }; Languages = CollectionViewSource.GetDefaultView(languages); Languages.CurrentChanged += (s, e) => { CultureInfo culture = Languages.CurrentItem as CultureInfo; ResourceProvider.ChangeCulture(culture); Settings.Default.Language = culture.Name; }; Properties.Resources.Culture = Thread.CurrentThread.CurrentCulture; Languages.MoveCurrentTo(languages.Find(x => x.Name == Settings.Default.Language)); #endregion Messenger.Default.Register(this, (CloseDocumentMessage message) => { Documents.ForceRemove(message.Document); }); Messenger.Default.Register(this, (MessageViewModel message) => { DialogService.ShowDialog(MessageButton.OK, message.Title, "MessageView", message); }); Settings.Default.PropertyChanged += (s, e) => { Settings.Default.Save(); }; }
private void _selectLanguage(Language language) { ResourceProvider.ChangeCulture(new CultureInfo(language.Culture)); }