Exemplo n.º 1
0
        public void PerformRemoveSwatch()
        {
            ISwatch swatch = SwatchDisplayer.Swatch;

            if (swatch == null)
            {
                return;
            }

            if (SwatchDisplayer.HasPrimaryColor)
            {
                swatch.RemoveAt(SwatchDisplayer.PrimaryColorIndex);

                if (swatch.Count == 0)
                {
                    SwatchDisplayer.PrimaryColorIndex = SwatchDisplayer.SecondaryColorIndex = -1;
                }
                else
                {
                    if (SwatchDisplayer.PrimaryColorIndex >= swatch.Count)
                    {
                        SwatchDisplayer.PrimaryColorIndex = swatch.Count - 1;
                    }

                    if (SwatchDisplayer.SecondaryColorIndex >= swatch.Count)
                    {
                        SwatchDisplayer.SecondaryColorIndex = swatch.Count - 1;
                    }
                }

                SwatchDisplayer.RecalculateSize();
            }
        }
Exemplo n.º 2
0
        public void PerformAddSwatch()
        {
            ISwatch swatch = SwatchDisplayer.Swatch;

            if (swatch == null)
            {
                return;
            }

            swatch.Add(new NamedColor("New Color", Editor.MainForm.ColorPanel.SelectedColor.RGB));
            SwatchDisplayer.RecalculateSize();
        }