/// <summary> /// Converts a specified value (which must be a <see cref="ProgressStep"/>) into a given /// type un the specified context. /// </summary> /// <param name="context">The formatting context.</param> /// <param name="info">The culture under which the conversion should be performed.</param> /// <param name="value">Value to convert.</param> /// <param name="destType">The type the conversion should result into.</param> /// <returns>The converted value.</returns> public override object ConvertTo(ITypeDescriptorContext context, CultureInfo info, object value, Type destType) { if (destType == typeof(InstanceDescriptor)) { ZeroitProgressStep step = (ZeroitProgressStep)value; Type[] ctorTypes = new Type[] { typeof(Image), typeof(string), typeof(string), typeof(string) }; object[] ctorParams = new object[] { step.Image, step.Name, step.Text, step.Description }; return(new InstanceDescriptor(typeof(ZeroitProgressStep).GetConstructor(ctorTypes), ctorParams, true)); } return(base.ConvertTo(context, info, value, destType)); }
/// <summary> /// Removes a <see cref="ProgressStep"/> from the collection. /// </summary> /// <param name="progressStep">Step to be removed.</param> public void Remove(ZeroitProgressStep progressStep) { base.InnerList.Remove(progressStep); }
/// <summary> /// Creates a new instance for the collection. /// </summary> /// <param name="itemType">Type of the instance to be created.</param> /// <returns>A new instance with default values.</returns> protected override object CreateInstance(Type itemType) { ZeroitProgressStep result = (ZeroitProgressStep)base.CreateInstance(itemType); return(result); }
/// <summary> /// Adds a <see cref="ProgressStep"/> to the end of the collection. /// </summary> /// <param name="progressStep">Step to be added.</param> public void Add(ZeroitProgressStep progressStep) { base.InnerList.Add(progressStep); }