private ObservableCollection <ColorInfo> Load_Colors()
        {
            var        result     = new ObservableCollection <ColorInfo>();
            EntryCodes entryCodes = new EntryCodes();

            foreach (var meaning in Enum.GetValues(entryCodes.GetType()))
            {
                result.Add(new ColorInfo
                {
                    Mean = GetCode.GetCodeMeaning((EntryCodes)meaning),
                    Name = GetColor.GetColorByCode((EntryCodes)meaning).Name
                });
            }
            return(result);
        }
Beispiel #2
0
        public static EntryCodes GetCodeByColor(Color color)
        {
            EntryCodes code = default;

            for (int i = 0; i < GetColor.TextColors.Count; i++)
            {
                if (color.Equals(GetColor.TextColors[i]))
                {
                    code = (EntryCodes)i;
                    if (!Enum.IsDefined(code.GetType(), code))
                    {
                        throw new InvalidEnumArgumentException("This Color is not defined in EntryCodes");
                    }
                    break;
                }
            }
            return(code);
        }