public override ICollection <Colour> Load() { string coloursString = GetSettingsString(); string[] colourStrings = coloursString.Split(';'); AMackColourSelectorModels.ColourUtilities.ColourStringParsers.RGBColourStringParser stringParser = new AMackColourSelectorModels.ColourUtilities.ColourStringParsers.RGBColourStringParser(); List <Colour> colours = new List <Colour>(); foreach (string colStr in colourStrings) { if (!String.IsNullOrWhiteSpace(colStr)) { Colour c; if (stringParser.TryParse(colStr, out c)) { colours.Add(c); } } } return(colours); }
private void ListBoxCustomColours_DragEnter(object sender, DragEventArgs e) { string dragAndDropValue = (string)e.Data.GetData(DataFormats.StringFormat); AMackColourSelectorModels.ColourUtilities.ColourStringParsers.RGBColourStringParser hex = new AMackColourSelectorModels.ColourUtilities.ColourStringParsers.RGBColourStringParser(); AMackColourSelectorModels.Colour c; if (hex.TryParse(dragAndDropValue, out c)) { e.Effects = DragDropEffects.None; } }