private void PreferencesUpdated(object sender, UpdatedPreferencesEventArgs e) { if (e.NewTheme != null) { var currentThemeStyles = Styles.Where(x => (x as StyleInclude).Source.AbsolutePath.StartsWith("/Styles/Themes")).ToArray(); Styles.RemoveAll(currentThemeStyles); Styles.AddRange(ThemeManager.GetThemeStyles(e.NewTheme)); } }
public void Save() { try { var preferences = new UpdatedPreferencesEventArgs(notesDirectory != _preferencesService.Preferences.NotesDirectory); if (preferences.NotesDirectoryChanged && moveNotes) { _notesService.MoveAll(notesDirectory); } _preferencesService.Preferences.NotesDirectory = notesDirectory; _preferencesService.Preferences.AutoSaveInterval = _autoSaveIntervalValues[selectedAutoSaveIntervalIndex]; _preferencesService.Preferences.Theme = availableThemes[selectedThemeIndex]; if (selectedThemeIndex != _initialThemeIndex) { preferences.NewTheme = _preferencesService.Preferences.Theme; } if (selectedFontIndex != _initialFontIndex) { var fontFamily = availableFonts[selectedFontIndex]; _preferencesService.Preferences.NotesFontFamily = fontFamily; preferences.NewFontFamily = fontFamily; _notesService.SetFontForAll(fontFamily); } if (selectedFontSizeIndex != _initialFontSizeIndex) { var fontSize = int.Parse(availableFontSizes[selectedFontSizeIndex]); _preferencesService.Preferences.NotesFontSize = fontSize; preferences.NewFontSize = fontSize; _notesService.SetFontSizeForAll(fontSize); } _preferencesService.UpdatePreferences(preferences); } catch (MoveNotesException ex) { alert.Show(ex.Message); } }