/// <summary> /// Sets the theme. /// </summary> /// <param name="parserId">The parser identifier.</param> /// <param name="theme">The theme.</param> public virtual void SetTheme(string parserId, Theme theme) { if (!Themes.ContainsKey(parserId)) { Themes.Add(parserId, theme); } Themes[parserId] = theme; }
public void DeleteTheme(string themeName) { if (Themes.ContainsKey(themeName)) { Themes.Remove(themeName); IsModified = true; } }
public void AddNewTheme(string themeName, string templateThemeName, bool isDefault) { if (Themes.ContainsKey(themeName) == false) { Themes.Add(themeName, new Theme(themeName, templateThemeName, isDefault)); IsModified = true; } }
/// <summary> /// Adds theme if not exists and gets its id (or finds id of existent one) /// </summary> /// <param name="themeCount"></param> /// <param name="themeName"></param> /// <returns></returns> private int AddThemeAndGetId(ref int themeCount, string themeName) { int themeId; if (!Themes.ContainsKey(themeName)) { var evaluation = QuoteAppConstants.ThemeEvaluations.ContainsKey(themeName) ? QuoteAppConstants.ThemeEvaluations[themeName] : EnEvaluation.Extension; var theme = new Theme { Id = themeCount, Name = themeName, Evaluation = evaluation, DayLineColor = QuoteAppConstants.DefaultDayLineColor, DayTextColor = QuoteAppConstants.DefaultDayTextColor, NightLineColor = QuoteAppConstants.DefaultNightLineColor, NightTextColor = QuoteAppConstants.DefaultNightTextColor }; theme.NumberOfQuotes++; Themes.Add(themeName, theme); themeId = themeCount; themeCount++; } else { var theme = Themes[themeName]; theme.NumberOfQuotes++; themeId = theme.Id; } return(themeId); }
/// <summary> /// Gets the specified parser identifier. /// </summary> /// <param name="parserId">The parser identifier.</param> /// <returns>Theme.</returns> public virtual Theme Get(string parserId) => !Themes.ContainsKey(parserId) ? Default : Themes[parserId];