コード例 #1
0
 /// <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;
 }
コード例 #2
0
 public void DeleteTheme(string themeName)
 {
     if (Themes.ContainsKey(themeName))
     {
         Themes.Remove(themeName);
         IsModified = true;
     }
 }
コード例 #3
0
 public void AddNewTheme(string themeName, string templateThemeName, bool isDefault)
 {
     if (Themes.ContainsKey(themeName) == false)
     {
         Themes.Add(themeName, new Theme(themeName, templateThemeName, isDefault));
         IsModified = true;
     }
 }
コード例 #4
0
        /// <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);
        }
コード例 #5
0
 /// <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];