Example #1
0
        /// <summary>
        /// The add color to recent colors if missing.
        /// </summary>
        /// <param name="color">
        /// The color.
        /// </param>
        /// <returns>
        /// True if the color was added.
        /// </returns>
        private bool AddColorToRecentColorsIfMissing(Color color)
        {
            // Check if the color exists
            if (ThemeColors.Contains(color))
            {
                return(false);
            }

            if (StandardColors.Contains(color))
            {
                return(false);
            }

            if (RecentColors.Contains(color))
            {
                return(false);
            }

            if (RecentColors.Count >= this.MaxNumberOfRecentColors)
            {
                RecentColors.RemoveAt(RecentColors.Count - 1);
            }

            RecentColors.Insert(0, color);
            return(true);
        }
Example #2
0
        private void UpdateRecentColors(ColorItem colorItem)
        {
            if (!RecentColors.Contains(colorItem))
            {
                RecentColors.Add(colorItem);
            }

            if (RecentColors.Count > 10) //don't allow more than ten, maybe make a property that can be set by the user.
            {
                RecentColors.RemoveAt(0);
            }
        }
Example #3
0
        /// <summary>
        /// The add color to recent colors if missing.
        /// </summary>
        /// <param name="color">The color.</param>
        private void AddColorToRecentColorsIfMissing(Color color)
        {
            // Check if the color exists
            if (RecentColors.Contains(color))
            {
                var index = RecentColors.IndexOf(color);
                RecentColors.Move(index, 0);
                return;
            }

            if (RecentColors.Count >= this.MaxNumberOfRecentColors)
            {
                RecentColors.RemoveAt(RecentColors.Count - 1);
            }

            RecentColors.Insert(0, color);
        }