本文整理汇总了C#中PropVariant.IsNull方法的典型用法代码示例。如果您正苦于以下问题:C# PropVariant.IsNull方法的具体用法?C# PropVariant.IsNull怎么用?C# PropVariant.IsNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropVariant
的用法示例。
在下文中一共展示了PropVariant.IsNull方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: UpdateProperty
public virtual int UpdateProperty(ref PropertyKey key, PropVariantRef currentValue, out PropVariant newValue)
{
Debug.Assert(!_flushing, "UpdateProperty called while flushing pending invalidations!");
try
{
newValue = new PropVariant();
GetPropVariant(key, currentValue, ref newValue);
// Remove key from dictionary since we have updated it.
pendingInvalidations.Remove(key);
if (newValue.IsNull())
{
Trace.Fail("Didn't properly update property for " + PropertyKeys.GetName(key) + " on command " + CommandId);
newValue = new PropVariant();
}
}
catch (Exception ex)
{
UpdateInvalidationState(key, InvalidationState.Error);
Trace.Fail("Exception in UpdateProperty for " + PropertyKeys.GetName(key) + " on command " + CommandId + ": " + ex);
newValue = new PropVariant();
}
if (newValue.VarType == VarEnum.VT_ERROR)
{
// Returning an error tells the Ribbon to ignore this property.
return HRESULT.E_NOTIMPL;
}
return HRESULT.S_OK;
}