本文整理汇总了C#中PropertyKey类的典型用法代码示例。如果您正苦于以下问题:C# PropertyKey类的具体用法?C# PropertyKey怎么用?C# PropertyKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertyKey类属于命名空间,在下文中一共展示了PropertyKey类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCell
internal Segment<byte>? GetCell(PropertyKey key)
{
var colDef = _columnDefs.FirstOrDefault(d => d.Tag.Key == key);
if (colDef == null)
return null;
if (!ColumnExists(colDef.CebIndex))
return null;
var type = colDef.Tag.Type;
Segment<byte> data;
var offset = colDef.Offset + (_rowIndex * _offsets.Bm);
if (!type.IsVariableLength() && type.GetLength() <= 8)
{
var length = colDef.Tag.Type.GetLength();
data = _rowData.Derive(offset, length);
}
else
{
var hnid = BitConverter.ToUInt32(_rowData.Array, _rowData.Offset + offset);
if ((hnid & 0x1f) == 0)
{
data = _heap[hnid];
}
else
{
var subnode = _node.FindSubnode(hnid);
var subBlock = subnode.GetDataBlock();
data = subBlock.Data;
}
}
return data;
}
示例2: UpdateProperty
public virtual int UpdateProperty(uint commandId, ref PropertyKey key, PropVariantRef currentValue, out PropVariant newValue)
{
Command command = ParentCommandManager.Get((CommandId)commandId);
if (command == null)
{
return NullCommandUpdateProperty(commandId, ref key, currentValue, out newValue);
}
try
{
newValue = new PropVariant();
command.GetPropVariant(key, currentValue, ref newValue);
if (newValue.IsNull())
{
Trace.Fail("Didn't property update property for " + PropertyKeys.GetName(key) + " on command " + ((CommandId)commandId).ToString());
newValue = PropVariant.FromObject(currentValue.PropVariant.Value);
}
}
catch (Exception ex)
{
Trace.Fail("Exception in UpdateProperty for " + PropertyKeys.GetName(key) + " on command " + commandId + ": " + ex);
newValue = PropVariant.FromObject(currentValue.PropVariant.Value);
}
return HRESULT.S_OK;
}
示例3: ConstructorWithString
public void ConstructorWithString(string formatId, int propertyId)
{
PropertyKey pk = new PropertyKey(formatId, propertyId);
Assert.Equal<Guid>(new Guid(formatId), pk.FormatId);
Assert.Equal<int>(propertyId, pk.PropertyId);
}
示例4: EntityHierarchyEnumerator
public EntityHierarchyEnumerator(EntitySystem EntitySystem, ViewModelContext selectedEntitiesContext)
{
isSelectedProperty = new PropertyKey<bool>("IsSelected", typeof(EntityHierarchyEnumerator), new StaticDefaultValueMetadata(false) { PropertyUpdateCallback = IsSelectedChanged });
this.EntitySystem = EntitySystem;
this.selectedEntitiesContext = selectedEntitiesContext;
}
示例5: GetOverride
protected object GetOverride(ref PropertyKey key, object defaultValue)
{
PropVariant propVariant;
if (_overrides.TryGetValue(key, out propVariant))
return propVariant.Value;
return defaultValue;
}
示例6: ConstructorWithGuid
public void ConstructorWithGuid(string formatIdString, int propertyId)
{
Guid formatId = new Guid(formatIdString);
PropertyKey pk = new PropertyKey(formatId, propertyId);
Assert.Equal<Guid>(formatId, pk.FormatId);
Assert.Equal<int>(propertyId, pk.PropertyId);
}
示例7: GetPropertyDescription
public ShellPropertyDescription GetPropertyDescription(PropertyKey key)
{
if (!propsDictionary.ContainsKey(key))
{
propsDictionary.Add(key, new ShellPropertyDescription(key));
}
return propsDictionary[key];
}
示例8: IsStringPropertyKey
public static bool IsStringPropertyKey(PropertyKey key)
{
return (key == PropertyKeys.Label ||
key == PropertyKeys.LabelDescription ||
key == PropertyKeys.Keytip ||
key == PropertyKeys.TooltipTitle ||
key == PropertyKeys.TooltipDescription);
}
示例9: GetPropVariant
public override void GetPropVariant(PropertyKey key, PropVariantRef currentValue, ref PropVariant value)
{
if (key == PropertyKeys.ContextAvailable)
{
value.SetUInt((uint)ContextAvailability);
}
else
base.GetPropVariant(key, currentValue, ref value);
}
示例10: FindProperty
public Property FindProperty(PropertyKey key)
{
Type type = FindType(key);
Property member = type.FindProperty(key);
if (member == null)
{
member = type.AddProperty(key);
}
return member;
}
示例11: UpdateInvalidationStateAndNotifyIfDifferent
private void UpdateInvalidationStateAndNotifyIfDifferent(ref PropertyKey key, IComparable overrideValue, IComparableDelegate currentValueDelegate)// where T : IComparable
{
// Only invalidate if we're actually making a change.
// Unnecessary invalidations hurt perf as well as cause ribbon bugs.
if (overrideValue.CompareTo(currentValueDelegate()) != 0)
{
UpdateInvalidationState(key, InvalidationState.Pending);
OnStateChanged(EventArgs.Empty);
}
}
示例12: ToStringReturnsExpectedString
public void ToStringReturnsExpectedString()
{
Guid guid = new Guid("00000000-1111-2222-3333-000000000000");
int property = 1234;
PropertyKey key = new PropertyKey(guid, property);
Assert.Equal<string>(
"{" + guid.ToString() + "}, " + property.ToString(),
key.ToString());
}
示例13: RemoveOverride
protected int RemoveOverride(ref PropertyKey key, IComparableDelegate currentValueDelegate)
{
PropVariant overrideValue;
if (_overrides.TryGetValue(key, out overrideValue))
{
_overrides.Remove(key);
UpdateInvalidationStateAndNotifyIfDifferent(ref key, (IComparable)overrideValue.Value, currentValueDelegate);
return HRESULT.S_OK;
}
return HRESULT.S_FALSE;
}
示例14: HasAssessor_DeclaringType_And_PropertyName
public void HasAssessor_DeclaringType_And_PropertyName()
{
var declaringType = typeof(SimpleClass);
var propertyName = "Id";
var propertyKey = new PropertyKey(declaringType, propertyName);
var assessor = CreatePropertyAssessor(propertyKey);
_cache.TryAdd(propertyKey, assessor);
var result = PropertyAssessorCache.HasAssessor(typeof(SimpleClass), "Id");
Assert.IsTrue(result);
}
示例15: HasAssessor_PropertyInfo
public void HasAssessor_PropertyInfo()
{
var propertyInfo = typeof(SimpleClass).GetProperty("Id");
var propertyKey = new PropertyKey(propertyInfo);
var assessor = CreatePropertyAssessor(propertyKey);
_cache.TryAdd(propertyKey, assessor);
propertyInfo = typeof(SimpleClass).GetProperty("Id");
var result = PropertyAssessorCache.HasAssessor(propertyInfo);
Assert.IsTrue(result);
}