public ControlHintAttribute(ControlHint type, int controlHeight = 0) { ControlHint = type; ControlHeight = controlHeight; }
/// <summary> /// Creates tool parameter for a property of a given type. /// </summary> private static BaseParameter CreateParameter(Type type, PropertyInfo prop) { ControlHint customType = GetParameterHint(prop); switch (customType) { case ControlHint.Field: return(new FieldParameter()); case ControlHint.Combo: return(new OptionsParameter()); case ControlHint.Filename: { DataSourceType dataType = GetDataType(prop); return(new FilenameParameter(dataType)); } case ControlHint.MultipleFilename: { DataSourceType dataType = GetDataType(prop); return(new MultiFilenameParameter(dataType)); } case ControlHint.MultiLineString: return(new StringParameter(true)); case ControlHint.OutputName: return(new OutputNameParameter()); } if (customType != ControlHint.Auto) { throw new IndexOutOfRangeException("No handler for parameter type: " + customType); } if (type == typeof(IEnvelope)) { return(new ExtentsParameter()); } if (type == typeof(FieldOperationList)) { return(new FieldOperationParameter()); } if (type == typeof(ISpatialReference)) { return(new GeoProjectionParameter()); } if (type == typeof(double)) { return(new DoubleParameter()); } if (type == typeof(int)) { return(new IntegerParameter()); } if (type == typeof(string)) { return(new StringParameter()); } if (type == typeof(bool)) { return(new BooleanParameter()); } if (type == typeof(IRasterInput)) { return(new RasterLayerParameter()); } if (type == typeof(IVectorInput)) { return(new VectorLayerParameter()); } if (type == typeof(IRasterSource)) { return(new RasterLayerParameter()); } if (type == typeof(IDatasourceInput)) { return(new GenericLayerParameter()); } if (type == typeof(Distance)) { return(new DistanceParameter()); } if (type == typeof(OutputLayerInfo)) { return(new OutputLayerParameter()); } string msg = "Unexpected parameter type for the tool: " + type.Name + ". "; msg += "Consider using ControlHintAttribute."; throw new ApplicationException(msg); }