Esempio n. 1
0
        /// <summary>
        /// The initialize theme colors.
        /// </summary>
        private void InitializeThemeColors()
        {
            if (this.themeColors != null)
            {
                return;
            }

            List <PredefinedColor> list = PredefinedColor.AllThemeColors;

            this.themeColors = new Dictionary <Color, PredefinedColorItem>();
            int r = 0;
            int c = 0;

            foreach (PredefinedColor color in list)
            {
                var item = new PredefinedColorItem(color.Value, color.Name);
                item.SetValue(Grid.RowProperty, r);
                item.SetValue(Grid.ColumnProperty, c);

                // item.Style = themeColorsGrid.Resources["ThemeColorItemStyle"] as Style;
                this.themeColorsGrid.Items.Add(item);

                if (!this.themeColors.ContainsKey(color.Value))
                {
                    this.themeColors.Add(color.Value, item);
                }

                if (r < 5)
                {
                    r++;
                }
                else
                {
                    r = 0;
                    c++;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// The on done clicked.
        /// </summary>
        public void OnDoneClicked()
        {
            var ci = new PredefinedColorItem(this.Color, this.Color.ToString());

            if (this.RecentColorItems.Where(i => i.Color == ci.Color).Count() > 0)
            {
                this.recentColorsGrid.Items.RemoveAt(
                    this.recentColorsGrid.Items.IndexOf(this.RecentColorItems.First(i => i.Color == ci.Color)));
                this.RecentColorItems.Remove(this.RecentColorItems.First(i => i.Color == ci.Color));

                this.recentColorsGrid.Items.Insert(0, ci);
                this.RecentColorItems.Insert(0, ci);
            }
            else
            {
                this.RecentColorItems.Insert(0, ci);
                this.recentColorsGrid.Items.Insert(0, ci);
            }

            if (this.DoneClicked != null)
            {
                this.DoneClicked(this, new RoutedEventArgs());
            }
        }
Esempio n. 3
0
        /// <summary>
        /// The initialize theme colors.
        /// </summary>
        private void InitializeThemeColors()
        {
            if (this.themeColors != null)
            {
                return;
            }

            List<PredefinedColor> list = PredefinedColor.AllThemeColors;
            this.themeColors = new Dictionary<Color, PredefinedColorItem>();
            int r = 0;
            int c = 0;
            foreach (PredefinedColor color in list)
            {
                var item = new PredefinedColorItem(color.Value, color.Name);
                item.SetValue(Grid.RowProperty, r);
                item.SetValue(Grid.ColumnProperty, c);

                // item.Style = themeColorsGrid.Resources["ThemeColorItemStyle"] as Style;
                this.themeColorsGrid.Items.Add(item);

                if (!this.themeColors.ContainsKey(color.Value))
                {
                    this.themeColors.Add(color.Value, item);
                }

                if (r < 5)
                {
                    r++;
                }
                else
                {
                    r = 0;
                    c++;
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// The initialize predefined.
        /// </summary>
        private void InitializePredefined()
        {
            if (this.dictionaryColor != null)
            {
                return;
            }

            List<PredefinedColor> list = PredefinedColor.All;
            this.dictionaryColor = new Dictionary<Color, PredefinedColorItem>();
            foreach (PredefinedColor color in list)
            {
                var item = new PredefinedColorItem(color.Value, color.Name);
                this.comboBoxColor.Items.Add(item);

                if (!this.dictionaryColor.ContainsKey(color.Value))
                {
                    this.dictionaryColor.Add(color.Value, item);
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// The on done clicked.
        /// </summary>
        public void OnDoneClicked()
        {
            var ci = new PredefinedColorItem(this.Color, this.Color.ToString());
            if (this.RecentColorItems.Where(i => i.Color == ci.Color).Count() > 0)
            {
                this.recentColorsGrid.Items.RemoveAt(
                    this.recentColorsGrid.Items.IndexOf(this.RecentColorItems.First(i => i.Color == ci.Color)));
                this.RecentColorItems.Remove(this.RecentColorItems.First(i => i.Color == ci.Color));

                this.recentColorsGrid.Items.Insert(0, ci);
                this.RecentColorItems.Insert(0, ci);
            }
            else
            {
                this.RecentColorItems.Insert(0, ci);
                this.recentColorsGrid.Items.Insert(0, ci);
            }

            if (this.DoneClicked != null)
            {
                this.DoneClicked(this, new RoutedEventArgs());
            }
        }