コード例 #1
0
        public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            UnicodeView       uv = ((UnicodeView)context.Instance);
            UnicodeCollection ul = uv.Collection;

            return(new TypeConverter.StandardValuesCollection(ul.GetTypes().ToList()));
        }
コード例 #2
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            InstanceDescriptor id = (value as InstanceDescriptor);

            if (id != null)
            {
                IEnumerator ie  = id.Arguments.GetEnumerator();
                object[]    obj = new object[2];
                int         i   = 0;
                while (ie.MoveNext())
                {
                    obj[i++] = ie.Current;
                }

                return(new UnicodeType((UnicodeIndex)obj[0], (string)obj[1]));
            }

            string unicodeName = value as string;

            if (unicodeName != null)
            {
                UnicodeView       uv = ((UnicodeView)context.Instance);
                UnicodeCollection ul = uv.Collection;
                return(new UnicodeType(ul[unicodeName]));
            }

            return(base.ConvertFrom(context, culture, value));
        }
コード例 #3
0
        public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
        {
            InstanceDescriptor id = value as InstanceDescriptor;

            if (id != null)
            {
                IEnumerator ie  = id.Arguments.GetEnumerator();
                object[]    obj = new object[4];
                int         i   = 0;
                while (ie.MoveNext())
                {
                    obj[i++] = ie.Current;
                }

                return(new UnicodeCategory((UnicodeType)obj[0], (string)obj[1], (int)obj[2], (int)obj[3]));
            }

            string categoryName = value as string;

            if (categoryName != null)
            {
                UnicodeView       uv  = ((UnicodeView)context.Instance);
                UnicodeCollection ul  = uv.Collection;
                UnicodeCategory   cat = ul.GetCategory(categoryName);
                return(new UnicodeCategory(cat));
            }

            return(base.ConvertFrom(context, culture, value));
        }