本文整理汇总了C#中PropertyDescriptor类的典型用法代码示例。如果您正苦于以下问题:C# PropertyDescriptor类的具体用法?C# PropertyDescriptor怎么用?C# PropertyDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertyDescriptor类属于命名空间,在下文中一共展示了PropertyDescriptor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Initialize
public void Initialize (PropertyDescriptor prop)
{
if (prop.PropertyType != typeof(int))
throw new ApplicationException ("OptIntRange editor does not support editing values of type " + prop.PropertyType);
double min = (double) Int32.MinValue;
double max = (double) Int32.MaxValue;
if (omin == null)
omin = prop.Minimum;
if (omax == null)
omax = prop.Maximum;
if (omin != null)
min = (double) Convert.ChangeType (omin, typeof(double));
if (omax != null)
max = (double) Convert.ChangeType (omax, typeof(double));
check = new Gtk.CheckButton ();
check.Show ();
check.Toggled += check_Toggled;
PackStart (check, false, false, 0);
spin = new Gtk.SpinButton (min, max, 1.0);
spin.Show ();
spin.HasFrame = false;
spin.ValueChanged += spin_ValueChanged;
PackStart (spin, true, true, 0);
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:29,代码来源:OptIntRange.cs
示例2: GetProperties
public override IEnumerable<IPropertyDescriptor> GetProperties(Type type, object container)
{
return innerTypeDescriptor.GetProperties(type, container)
.Where(p => p.GetCustomAttribute<YamlIgnoreAttribute>() == null)
.Select(p =>
{
var descriptor = new PropertyDescriptor(p);
var alias = p.GetCustomAttribute<YamlAliasAttribute>();
if (alias != null)
{
descriptor.Name = alias.Alias;
}
var member = p.GetCustomAttribute<YamlMemberAttribute>();
if (member != null)
{
if (member.SerializeAs != null)
{
descriptor.TypeOverride = member.SerializeAs;
}
}
return (IPropertyDescriptor)descriptor;
});
}
开发者ID:adbrowne,项目名称:EventStore,代码行数:26,代码来源:YamlAttributesTypeInspector.cs
示例3: GeneratePropertySet
protected override void GeneratePropertySet (GeneratorContext ctx, CodeExpression var, PropertyDescriptor prop)
{
if (prop.Name == "Alpha" && Alpha == -1)
return;
else
base.GeneratePropertySet (ctx, var, prop);
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:7,代码来源:ColorButton.cs
示例4: PropertyDescriptor
/// <summary>
/// Initializes a new instance of the <see cref="PropertyDescriptor"/> class
/// with an existing property descriptor.
/// </summary>
/// <param name="other">The other descriptor.</param>
public PropertyDescriptor(PropertyDescriptor other)
{
property = other.property;
AddKeyBuilders(other.keyBuilders);
AddGetters(other.getters);
AddSetters(other.setters);
}
开发者ID:ralescano,项目名称:castle,代码行数:12,代码来源:PropertyDescriptor.cs
示例5: Create
/// <summary>
/// Creates a new ExtenderProvidedPropertyAttribute.
/// </summary>
internal static ExtenderProvidedPropertyAttribute Create(PropertyDescriptor extenderProperty, Type receiverType, IExtenderProvider provider)
{
ExtenderProvidedPropertyAttribute e = new ExtenderProvidedPropertyAttribute();
e._extenderProperty = extenderProperty;
e._receiverType = receiverType;
e._provider = provider;
return e;
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:11,代码来源:ExtenderProvidedPropertyAttribute.cs
示例6: DefineOwnProperty
public override bool DefineOwnProperty(string propertyName, PropertyDescriptor desc, bool throwOnError)
{
if (throwOnError)
{
throw new JavaScriptException(Engine.TypeError, "Can't define a property of a NamespaceReference");
}
return false;
}
开发者ID:postromantic,项目名称:jint,代码行数:9,代码来源:NamespaceReference.cs
示例7: PropertyDescriptor
public PropertyDescriptor(PropertyDescriptor descriptor)
{
Get = descriptor.Get;
Set = descriptor.Set;
Value = descriptor.Value;
Enumerable = descriptor.Enumerable;
Configurable = descriptor.Configurable;
Writable = descriptor.Writable;
}
开发者ID:BusinessActs,项目名称:jint,代码行数:9,代码来源:PropertyDescriptor.cs
示例8: GetPropertyAsString
bool IDictionaryPropertySetter.SetPropertyValue(
IDictionaryAdapterFactory factory, IDictionary dictionary,
string key, ref object value, PropertyDescriptor property)
{
if (value != null)
{
value = GetPropertyAsString(property, value);
}
return true;
}
开发者ID:ralescano,项目名称:castle,代码行数:10,代码来源:DictionaryStringValuesAttribute.cs
示例9: Initialize
public override void Initialize (PropertyDescriptor prop)
{
base.Initialize (prop);
entry = new Gtk.Entry ();
entry.HasFrame = false;
entry.Show ();
entry.Changed += EntryChanged;
Add (entry);
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:10,代码来源:String.cs
示例10: NotifyPropertyChanged
protected void NotifyPropertyChanged(PropertyDescriptor property, object oldValue, object newValue)
{
if (property.SuppressNotifications)
return;
var propertyChanged = PropertyChanged;
if (propertyChanged == null)
return;
propertyChanged(this, new PropertyChangedEventArgsEx(property.PropertyName, oldValue, newValue));
}
开发者ID:gitter-badger,项目名称:MobileMoq,代码行数:11,代码来源:DictionaryAdapterBase.Notify.cs
示例11: BuildColumnConstraints
private List<Expression> BuildColumnConstraints(PropertyDescriptor propertyDescriptor, PropertyDescriptor foreignKeyReferencingProperty)
{
var retval = new List<Expression>();
if (foreignKeyReferencingProperty != null)
{
var valueRequiredAttribute = foreignKeyReferencingProperty.ValueRequiredAttribute;
if (foreignKeyReferencingProperty.HasUniqueAttribute && foreignKeyReferencingProperty.UniqueAttribute.Unique)
{
retval.Add(new SqlSimpleConstraintExpression(SqlSimpleConstraint.Unique));
}
if (valueRequiredAttribute != null && valueRequiredAttribute.Required)
{
retval.Add(new SqlSimpleConstraintExpression(SqlSimpleConstraint.NotNull));
}
}
else
{
if (propertyDescriptor.PropertyType.IsNullableType() || !propertyDescriptor.PropertyType.IsValueType)
{
var valueRequiredAttribute = propertyDescriptor.ValueRequiredAttribute;
if (valueRequiredAttribute != null && valueRequiredAttribute.Required)
{
retval.Add(new SqlSimpleConstraintExpression(SqlSimpleConstraint.NotNull));
}
}
else
{
retval.Add(new SqlSimpleConstraintExpression(SqlSimpleConstraint.NotNull));
}
if (propertyDescriptor.IsAutoIncrement && propertyDescriptor.PropertyType.IsIntegerType(true))
{
retval.Add(new SqlSimpleConstraintExpression(SqlSimpleConstraint.AutoIncrement, value: new object[] { propertyDescriptor.AutoIncrementAttribute.Seed, propertyDescriptor.AutoIncrementAttribute.Step }));
}
if (propertyDescriptor.HasUniqueAttribute && propertyDescriptor.UniqueAttribute.Unique)
{
retval.Add(new SqlSimpleConstraintExpression(SqlSimpleConstraint.Unique));
}
var defaultValueAttribute = propertyDescriptor.DefaultValueAttribute;
if (defaultValueAttribute != null)
{
retval.Add(new SqlSimpleConstraintExpression(SqlSimpleConstraint.DefaultValue, null, defaultValueAttribute.Value));
}
}
return retval;
}
开发者ID:crazle,项目名称:Shaolinq,代码行数:54,代码来源:SqlDataDefinitionExpressionBuilder.cs
示例12: ApplyValidationRules
private void ApplyValidationRules(IDictionaryAdapter dictionaryAdapter, IEnumerable<IValidationRule> rules,
PropertyDescriptor property, object propertyValue, IList<String> errors)
{
if (rules != null)
{
foreach (var rule in rules)
{
rule.Apply(dictionaryAdapter, property, propertyValue, errors);
}
}
}
开发者ID:vbedegi,项目名称:Castle.Core,代码行数:11,代码来源:TestDictionaryValidator.cs
示例13: Validate
public string Validate(IDictionaryAdapter dictionaryAdapter, PropertyDescriptor property)
{
List<String> errors = new List<string>();
var globalRules = AttributesUtil.GetTypeAttributes<IValidationRule>(dictionaryAdapter.Meta.Type);
var propertyRules = AttributesUtil.GetAttributes<IValidationRule>(property.Property);
var propertyValue = dictionaryAdapter.GetProperty(property.PropertyName, true);
ApplyValidationRules(dictionaryAdapter, propertyRules, property, propertyValue, errors);
ApplyValidationRules(dictionaryAdapter, globalRules, property, propertyValue, errors);
return String.Join(Environment.NewLine, errors.ToArray());
}
开发者ID:vbedegi,项目名称:Castle.Core,代码行数:12,代码来源:TestDictionaryValidator.cs
示例14: Initialize
public void Initialize (PropertyDescriptor prop)
{
if (!prop.PropertyType.IsEnum)
throw new ApplicationException ("Flags editor does not support editing values of type " + prop.PropertyType);
property = prop.Label;
Spacing = 3;
// For small enums, the editor is a list of checkboxes inside a frame
// For large enums (>5), use a selector dialog.
enm = Registry.LookupEnum (prop.PropertyType.FullName);
if (enm.Values.Length < 6)
{
Gtk.VBox vbox = new Gtk.VBox (true, 3);
flags = new Hashtable ();
foreach (Enum value in enm.Values) {
EnumValue eval = enm[value];
if (eval.Label == "")
continue;
Gtk.CheckButton check = new Gtk.CheckButton (eval.Label);
check.TooltipText = eval.Description;
uint uintVal = (uint) Convert.ToInt32 (eval.Value);
flags[check] = uintVal;
flags[uintVal] = check;
check.Toggled += FlagToggled;
vbox.PackStart (check, false, false, 0);
}
Gtk.Frame frame = new Gtk.Frame ();
frame.Add (vbox);
frame.ShowAll ();
PackStart (frame, true, true, 0);
}
else
{
flagsLabel = new Gtk.Entry ();
flagsLabel.IsEditable = false;
flagsLabel.HasFrame = false;
flagsLabel.ShowAll ();
PackStart (flagsLabel, true, true, 0);
Gtk.Button but = new Gtk.Button ("...");
but.Clicked += OnSelectFlags;
but.ShowAll ();
PackStart (but, false, false, 0);
}
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:53,代码来源:Flags.cs
示例15: Initialize
public void Initialize (PropertyDescriptor descriptor)
{
store = new ListStore (typeof(Pixbuf), typeof(string));
Model = store;
store.SetSortColumnId (1, SortType.Ascending);
CellRendererPixbuf crp = new CellRendererPixbuf ();
CellRendererText crt = new CellRendererText ();
PackStart (crp, false);
PackStart (crt, true);
SetAttributes (crp, "pixbuf", 0);
SetAttributes (crt, "text", 1);
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:12,代码来源:WidgetSelector.cs
示例16: NotifyPropertyChanging
protected bool NotifyPropertyChanging(PropertyDescriptor property, object oldValue, object newValue)
{
if (property.SuppressNotifications)
return true;
var propertyChanging = PropertyChanging;
if (propertyChanging == null)
return true;
var args = new PropertyChangingEventArgsEx(property.PropertyName, oldValue, newValue);
propertyChanging(this, args);
return !args.Cancel;
}
开发者ID:gitter-badger,项目名称:MobileMoq,代码行数:13,代码来源:DictionaryAdapterBase.Notify.cs
示例17: GeneratePropertySet
protected override void GeneratePropertySet (GeneratorContext ctx, CodeExpression var, PropertyDescriptor prop)
{
if (prop.Name == "Group") {
CodeExpression groupExp = GroupManager.GenerateGroupExpression (ctx, (Gtk.Widget) Wrapped);
ctx.Statements.Add (
new CodeAssignStatement (
new CodePropertyReferenceExpression (var, "Group"),
groupExp)
);
}
else
base.GeneratePropertySet (ctx, var, prop);
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:13,代码来源:RadioToolButton.cs
示例18: NotifyPropertyChanged
protected void NotifyPropertyChanged(PropertyDescriptor property, object oldValue, object newValue)
{
if (!property.SuppressNotifications)
{
var propertyChanged = PropertyChanged;
ComposeChildNotifications(property, oldValue, newValue);
if (propertyChanged != null)
{
propertyChanged(this, new PropertyModifiedEventArgs(property.PropertyName, oldValue, newValue));
}
}
}
开发者ID:kenegozi,项目名称:Castle.Components.DictionaryAdapter,代码行数:14,代码来源:DictionaryAdapterBase.Notify.cs
示例19: GetFieldMetadata
private IEnumerable<Attribute> GetFieldMetadata(PropertyDescriptor fieldProperty) {
if (AssociatedMetadataType != null) {
MemberTypes allowedMemberTypes = MemberTypes.Property | MemberTypes.Field;
foreach (MemberInfo buddyMember in AssociatedMetadataType.GetMembers()) {
if ((buddyMember.MemberType & allowedMemberTypes) != 0 && PropertyMatches(fieldProperty, buddyMember)) {
foreach (Attribute attribute in buddyMember.GetCustomAttributes(false)) {
yield return attribute;
}
yield break;
}
}
}
}
开发者ID:kvervo,项目名称:HorizontalLoopingSelector,代码行数:14,代码来源:AssociatedMetadataTypeTypeDescriptor.cs
示例20: Initialize
public void Initialize (PropertyDescriptor prop)
{
propType = prop.PropertyType;
double min, max;
switch (Type.GetTypeCode (propType)) {
case TypeCode.Int16:
min = (double) Int16.MinValue;
max = (double) Int16.MaxValue;
break;
case TypeCode.UInt16:
min = (double) UInt16.MinValue;
max = (double) UInt16.MaxValue;
break;
case TypeCode.Int32:
min = (double) Int32.MinValue;
max = (double) Int32.MaxValue;
break;
case TypeCode.UInt32:
min = (double) UInt32.MinValue;
max = (double) UInt32.MaxValue;
break;
case TypeCode.Int64:
min = (double) Int64.MinValue;
max = (double) Int64.MaxValue;
break;
case TypeCode.UInt64:
min = (double) UInt64.MinValue;
max = (double) UInt64.MaxValue;
break;
case TypeCode.Byte:
min = (double) Byte.MinValue;
max = (double) Byte.MaxValue;
break;
case TypeCode.SByte:
min = (double) SByte.MinValue;
max = (double) SByte.MaxValue;
break;
default:
throw new ApplicationException ("IntRange editor does not support editing values of type " + prop.PropertyType);
}
if (prop.Minimum != null)
min = (double) Convert.ChangeType (prop.Minimum, typeof(double));
if (prop.Maximum != null)
max = (double) Convert.ChangeType (prop.Maximum, typeof(double));
SetRange (min, max);
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:50,代码来源:IntRange.cs
注:本文中的PropertyDescriptor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论