本文整理汇总了C#中Greenshot.Drawing.Fields.FieldType类的典型用法代码示例。如果您正苦于以下问题:C# FieldType类的具体用法?C# FieldType怎么用?C# FieldType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FieldType类属于Greenshot.Drawing.Fields命名空间,在下文中一共展示了FieldType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateField
/// <param name="requestingType">Type of the class for which to create the field</param>
/// <param name="fieldType">FieldType of the field to construct</param>
/// <param name="scope">FieldType of the field to construct</param>
/// <returns>a new Field of the given fieldType, with the scope of it's value being restricted to the Type scope</returns>
public Field CreateField(Type requestingType, FieldType fieldType, object preferredDefaultValue)
{
string requestingTypeName = requestingType.Name;
string requestedField = requestingTypeName + "." + fieldType.Name;
object fieldValue = preferredDefaultValue;
// Check if the configuration exists
if (LastUsedFieldValues == null)
{
LastUsedFieldValues = new Dictionary<string, object>();
}
// Check if settings for the requesting type exist, if not create!
if (LastUsedFieldValues.ContainsKey(requestedField))
{
// Check if a value is set (not null)!
if (LastUsedFieldValues[requestedField] != null)
{
fieldValue = LastUsedFieldValues[requestedField];
}
else
{
// Overwrite null value
LastUsedFieldValues[requestedField] = fieldValue;
}
}
else
{
LastUsedFieldValues.Add(requestedField, fieldValue);
}
Field returnField = new Field(fieldType, requestingType);
returnField.Value = fieldValue;
return returnField;
}
示例2: GetField
public new Field GetField(FieldType fieldType) {
Field ret = null;
if(base.HasField(fieldType)) {
ret = base.GetField(fieldType);
} else {
foreach(IFieldHolder fh in Children) {
if(fh.HasField(fieldType)) {
ret = fh.GetField(fieldType);
break;
}
}
}
if(ret == null) {
throw new ArgumentException("Field '"+fieldType+"' does not exist in " + GetType());
}
return ret;
}
示例3: GetFieldValueAsDecimal
public decimal GetFieldValueAsDecimal(FieldType fieldType)
{
return Convert.ToDecimal(GetFieldValue(fieldType));
}
示例4: GetFieldValueAsBool
public bool GetFieldValueAsBool(FieldType fieldType)
{
return (bool)GetFieldValue(fieldType);
}
示例5: HasFieldValue
public new bool HasFieldValue(FieldType fieldType)
{
Field f = GetField(fieldType);
return f != null && f.HasValue;
}
示例6: SetFieldValue
public void SetFieldValue(FieldType fieldType, object value)
{
try
{
fieldsByType[fieldType].Value = value;
}
catch (KeyNotFoundException e)
{
throw new ArgumentException("Field '" + fieldType + "' does not exist in " + GetType(), e);
}
}
示例7: HasField
public bool HasField(FieldType fieldType)
{
return fieldsByType.ContainsKey(fieldType);
}
示例8: GetFieldValueAsBool
public bool GetFieldValueAsBool(FieldType fieldType)
{
return Convert.ToBoolean(GetFieldValue(fieldType));
}
示例9: Field
/// <summary>
/// Constructs a new Field instance, usually you should be using FieldFactory
/// to create Fields.
/// </summary>
/// <param name="fieldType">FieldType of the Field to be created</param>
/// <param name="scope">The scope to which the value of this Field is relevant.
/// Depending on the scope the Field's value may be shared for other elements
/// containing the same FieldType for defaulting to the last used value.
/// When scope is set to a Type (e.g. typeof(RectangleContainer)), its value
/// should not be reused for FieldHolders of another Type (e.g. typeof(EllipseContainer))
/// </param>
public Field(FieldType fieldType, Type scope)
{
FieldType = fieldType;
Scope = scope.Name;
}
示例10: GetFieldValueAsString
public string GetFieldValueAsString(FieldType fieldType)
{
return (string)GetFieldValue(fieldType);
}
示例11: GetFieldValueAsInt
public int GetFieldValueAsInt(FieldType fieldType)
{
return (int)GetFieldValue(fieldType);
}
示例12: GetFieldValueAsFloat
public float GetFieldValueAsFloat(FieldType fieldType)
{
return (float)GetFieldValue(fieldType);
}
示例13: GetFieldValueAsDouble
public double GetFieldValueAsDouble(FieldType fieldType)
{
return (double)GetFieldValue(fieldType);
}
示例14: GetFieldValueAsDecimal
public decimal GetFieldValueAsDecimal(FieldType fieldType)
{
return (decimal)GetFieldValue(fieldType);
}
示例15: GetFieldValueAsDouble
public double GetFieldValueAsDouble(FieldType fieldType)
{
return Convert.ToDouble(GetFieldValue(fieldType));
}