Example #1
0
        private void SourceChanged()
        {
            lstColors.BeginUpdate();
            lstColors.Items.Clear();

            if (_colorSource != null)
            {
                int count = _colorSource.ColorCount(_colorId);
                for (int i = 0; i < count; i++)
                {
                    lstColors.Items.Add(_colorSource.GetColor(i, _colorId));
                }

                if (pnlPrimary.Visible = _colorSource.HasPrimary(_colorId))
                {
                    _primaryColor   = _colorSource.GetPrimaryColor(_colorId);
                    lblPrimary.Text = _colorSource.PrimaryColorName(_colorId);
                    UpdateBase();
                }
            }

            lstColors.EndUpdate();
        }
        public IColorSource FindColorMatch(bool constant, int frameCount, int id)
        {
            IColorSource match = null;
            IColorSource s     = this as IColorSource;

            if (!constant && s != null)
            {
                foreach (IColorSource n in ((ResourceNode)s).Parent.Children)
                {
                    if (n == s)
                    {
                        break;
                    }

                    if (!n.GetColorConstant(id))
                    {
                        for (int i = 0; i <= frameCount; i++)
                        {
                            if (n.GetColor(i, id) != s.GetColor(i, id))
                            {
                                break;
                            }
                            if (i == frameCount)
                            {
                                match = n;
                            }
                        }
                    }

                    if (match != null)
                    {
                        break;
                    }
                }
            }
            return(match);
        }