/// <exclude/>
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (!CanConvertTo(destinationType))
            {
                throw GetConvertToException(value, destinationType);
            }

            if ((value != null) && (value is DockTreeZOrder))
            {
                DockTreeZOrder z = (DockTreeZOrder)value;
                if (destinationType == typeof(string))
                {
                    return(z.ToString());
                }

                if (destinationType == typeof(InstanceDescriptor))
                {
                    return(new InstanceDescriptor(typeof(DockTreeZOrder).GetConstructor(new Type[] { typeof(Dock), typeof(Dock), typeof(Dock), typeof(Dock) }), new object[] { z.First, z.Second, z.Third, z.Fourth }));
                }
            }

            throw GetConvertToException(value, destinationType);
        }
        private DockTreeZOrder FromString(string s)
        {
            Dock first, second, third, fourth;

            string[] strings = s.Split(',');

            if (strings.Length != 4)
            {
                throw GetConvertFromException(s);
            }

            first  = (Dock)s_dockConverter.ConvertFrom(strings[0].Trim());
            second = (Dock)s_dockConverter.ConvertFrom(strings[1].Trim());
            third  = (Dock)s_dockConverter.ConvertFrom(strings[2].Trim());
            fourth = (Dock)s_dockConverter.ConvertFrom(strings[3].Trim());

            if (!DockTreeZOrder.CheckValues(first, second, third, fourth))
            {
                throw GetConvertFromException(s);
            }

            return(new DockTreeZOrder(first, second, third, fourth));
        }
示例#3
0
 /// <exclude/>
 public bool Equals(DockTreeZOrder value)
 {
     return(First == value.First && Second == value.Second && Third == value.Third && Fourth == value.Fourth);
 }