Ejemplo n.º 1
0
        /// <summary>
        /// PropertyChangedCallback for ColorString
        /// </summary>
        private static void ColorStringChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            if (obj is ColorPickerPlugin)
            {
                ColorPickerPlugin owner = (ColorPickerPlugin)obj;
                Shazzam.Properties.Settings.Default.ColorPickerColors = args.NewValue as string;

                if (!owner.updateinternal)
                {
                    owner.updateinternal = true;

                    owner.Colors.Clear();
                    string[] colors = (args.NewValue as string).Split(owner.DELIMITER);

                    foreach (string s in colors)
                    {
                        try
                        {
                            if (s.Length > 3)
                            {
                                Color c = ColorPickerUtil.ColorFromString(s);
                                owner.Colors.Add(c);
                            }
                        }
                        catch { }
                    }

                    owner.updateinternal = false;
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// PropertyChangedCallback for Colors
        /// </summary>
        private static void ColorsChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            if (obj is ColorPickerPlugin)
            {
                ColorPickerPlugin owner = (ColorPickerPlugin)obj;

                ObservableCollection <Color> c = args.NewValue as ObservableCollection <Color>;
                if (c != null)
                {
                    c.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(owner.c_CollectionChanged);
                }
            }
        }