当前位置: 首页>>代码示例>>C#>>正文


C# PropVariant.IsNull方法代码示例

本文整理汇总了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;
        }
开发者ID:gmilazzoitag,项目名称:OpenLiveWriter,代码行数:28,代码来源:GenericCommandHandler.cs

示例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;
        }
开发者ID:gmilazzoitag,项目名称:OpenLiveWriter,代码行数:32,代码来源:Command.cs


注:本文中的PropVariant.IsNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。