예제 #1
0
        /// <summary>
        /// The initialize theme colors.
        /// </summary>
        private void InitializeThemeColors()
        {
            if (_themeColors != null)
            {
                return;
            }

            List <PredefinedColor> list = PredefinedColor.AllThemeColors;

            _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;
                _themeColorsGrid.Items.Add(item);

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

                if (r < 5)
                {
                    r++;
                }
                else
                {
                    r = 0;
                    c++;
                }
            }
        }
예제 #2
0
        /// <summary>
        /// The on done clicked.
        /// </summary>
        public void OnDoneClicked()
        {
            var selectedColor         = Color;
            var recentColorItems      = RecentColorItems;
            var recentColorsGridItems = _recentColorsGrid.Items;

            var mostRecentColorItem = recentColorItems.FirstOrDefault(i => i.Color == selectedColor);

            if (mostRecentColorItem != null)
            {
                recentColorsGridItems.Remove(mostRecentColorItem);
                recentColorItems.Remove(mostRecentColorItem);
            }
            else
            {
                mostRecentColorItem = new PredefinedColorItem(selectedColor, selectedColor.ToString());
            }

            recentColorItems.Insert(0, mostRecentColorItem);
            recentColorsGridItems.Insert(0, mostRecentColorItem);

            DoneClicked?.Invoke(this, new RoutedEventArgs());
        }
예제 #3
0
        /// <summary>
        /// The on done clicked.
        /// </summary>
        public void OnDoneClicked()
        {
            var selectedColor         = Color;
            var recentColorItems      = RecentColorItems;
            var recentColorsGridItems = _recentColorsListBox.Items;

            var mostRecentColorItem = recentColorItems.FirstOrDefault(i => i.Color == selectedColor);

            if (mostRecentColorItem is not null)
            {
                recentColorsGridItems.Remove(mostRecentColorItem);
                recentColorItems.Remove(mostRecentColorItem);
            }
            else
            {
                mostRecentColorItem = new PredefinedColorItem(selectedColor, selectedColor.ToString());
            }

            recentColorItems.Insert(0, mostRecentColorItem);
            recentColorsGridItems.Insert(0, mostRecentColorItem);

            RaiseEvent(new RoutedEventArgs(DoneClickedEvent));
        }
예제 #4
0
        /// <summary>
        /// The initialize theme colors.
        /// </summary>
        private void InitializeThemeColors()
        {
            if (_themeColors != null)
            {
                return;
            }

            var list = PredefinedColor.AllThemeColors;

            _themeColors = new Dictionary <Color, PredefinedColorItem>();
            var r = 0;
            var c = 0;

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

                _themeColorsGrid.Items.Add(item);

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

                if (r < 5)
                {
                    r++;
                }
                else
                {
                    r = 0;
                    c++;
                }
            }
        }
예제 #5
0
        /// <summary>
        /// The initialize theme colors.
        /// </summary>
        private void InitializeThemeColors()
        {
            if (_themeColors != null)
            {
                return;
            }

            List<PredefinedColor> list = PredefinedColor.AllThemeColors;
            _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;
                _themeColorsGrid.Items.Add(item);

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

                if (r < 5)
                {
                    r++;
                }
                else
                {
                    r = 0;
                    c++;
                }
            }
        }
예제 #6
0
        /// <summary>
        /// The initialize predefined.
        /// </summary>
        private void InitializePredefined()
        {
            if (_dictionaryColor != null)
            {
                return;
            }

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

                if (!_dictionaryColor.ContainsKey(color.Value))
                {
                    _dictionaryColor.Add(color.Value, item);
                }
            }
        }
예제 #7
0
        /// <summary>
        /// The on done clicked.
        /// </summary>
        public void OnDoneClicked()
        {
            var ci = new PredefinedColorItem(Color, Color.ToString());

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

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

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