Example #1
0
        public RingTreeNode(Rings ringValue)
        {
            _ringValue = ringValue;
            Type ringType = typeof(Rings);
            Type infoType = typeof(RingInfoAttribute);

            RingInfoAttribute attr = ringType.GetMember(ringValue.ToString())[0].GetCustomAttributes(infoType, false)
                                     .Cast <RingInfoAttribute>().SingleOrDefault();

            _name        = attr.Name;
            _description = attr.Description;
        }
Example #2
0
        static MainWindow()
        {
            Type ringType = typeof(Rings);
            Type infoType = typeof(RingInfoAttribute);

            Array values = Enum.GetValues(ringType);

            _availableRings = values.OfType <Rings>().Select(x =>
            {
                RingInfoAttribute attr = ringType.GetMember(x.ToString())[0].GetCustomAttributes(infoType, false)
                                         .Cast <RingInfoAttribute>().SingleOrDefault();
                if (attr == null)
                {
                    return(null);
                }
                return(new RingDetails(x, attr.Name, attr.Description));
            }).Where(x => x != null).OrderBy(x => (ulong)x.EnumValue).ToList();
        }