本文整理汇总了C#中PropVariant.SetUInt方法的典型用法代码示例。如果您正苦于以下问题:C# PropVariant.SetUInt方法的具体用法?C# PropVariant.SetUInt怎么用?C# PropVariant.SetUInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropVariant
的用法示例。
在下文中一共展示了PropVariant.SetUInt方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: UpdateProperty
/// <summary>
/// Handles IUICommandHandler.UpdateProperty function for the supported properties
/// </summary>
/// <param name="key">The Property Key to update</param>
/// <param name="currentValue">A pointer to the current value for key. This parameter can be NULL</param>
/// <param name="newValue">When this method returns, contains a pointer to the new value for key</param>
/// <returns>Returns S_OK if successful, or an error value otherwise</returns>
public override HRESULT UpdateProperty(ref PropertyKey key, PropVariantRef currentValue, ref PropVariant newValue)
{
if (key == RibbonProperties.AutomaticColorLabel)
{
if (_automaticColorLabel != null)
{
newValue.SetString(_automaticColorLabel);
}
}
else if (key == RibbonProperties.Color)
{
if (_color.HasValue)
{
newValue.SetUInt((uint)ColorTranslator.ToWin32(_color.Value));
}
}
else if (key == RibbonProperties.ColorType)
{
if (_colorType.HasValue)
{
newValue.SetUInt((uint)_colorType.Value);
}
}
else if (key == RibbonProperties.MoreColorsLabel)
{
if (_moreColorsLabel != null)
{
newValue.SetString(_moreColorsLabel);
}
}
else if (key == RibbonProperties.NoColorLabel)
{
if (_noColorLabel != null)
{
newValue.SetString(_noColorLabel);
}
}
else if (key == RibbonProperties.RecentColorsCategoryLabel)
{
if (_recentColorsCategoryLabel != null)
{
newValue.SetString(_recentColorsCategoryLabel);
}
}
else if (key == RibbonProperties.StandardColors)
{
if (_standardColors != null)
{
int[] intStandardColors = Array.ConvertAll<Color, int>(_standardColors, new Converter<Color, int>(ColorTranslator.ToWin32));
uint[] uintStandardColors = Array.ConvertAll<int, uint>(intStandardColors, new Converter<int, uint>(Convert.ToUInt32));
newValue.SetUIntVector(uintStandardColors);
}
}
else if (key == RibbonProperties.StandardColorsCategoryLabel)
{
if (_standardColorsCategoryLabel != null)
{
newValue.SetString(_standardColorsCategoryLabel);
}
}
else if (key == RibbonProperties.StandardColorsTooltips)
{
if (_standardColorsTooltips != null)
{
newValue.SetStringVector(_standardColorsTooltips);
}
}
else if (key == RibbonProperties.ThemeColors)
{
if (_themeColors != null)
{
int[] intThemeColors = Array.ConvertAll<Color, int>(_themeColors, new Converter<Color, int>(ColorTranslator.ToWin32));
uint[] uintThemeColors = Array.ConvertAll<int, uint>(intThemeColors, new Converter<int, uint>(Convert.ToUInt32));
newValue.SetUIntVector(uintThemeColors);
}
}
else if (key == RibbonProperties.ThemeColorsCategoryLabel)
{
if (_themeColorsCategoryLabel != null)
{
newValue.SetString(_themeColorsCategoryLabel);
}
}
else if (key == RibbonProperties.ThemeColorsTooltips)
{
if (_themeColorsTooltips != null)
{
newValue.SetStringVector(_themeColorsTooltips);
}
}
return HRESULT.S_OK;
}
示例3: UpdateProperty
/// <summary>
/// Handles IUICommandHandler.UpdateProperty function for the supported properties
/// </summary>
/// <param name="key">The Property Key to update</param>
/// <param name="currentValue">A pointer to the current value for key. This parameter can be NULL</param>
/// <param name="newValue">When this method returns, contains a pointer to the new value for key</param>
/// <returns>Returns S_OK if successful, or an error value otherwise</returns>
public override HRESULT UpdateProperty(ref PropertyKey key, PropVariantRef currentValue, ref PropVariant newValue)
{
if (key == RibbonProperties.ContextAvailable)
{
if (_contextAvailable.HasValue)
{
newValue.SetUInt((uint)_contextAvailable.Value);
}
}
return HRESULT.S_OK;
}
示例4: GetPropVariant
public virtual void GetPropVariant(PropertyKey key, PropVariantRef currentValue, ref PropVariant value)
{
if (key == PropertyKeys.Enabled)
{
value.SetBool(Enabled);
}
else if (key == PropertyKeys.SmallImage)
{
RibbonHelper.CreateImagePropVariant(SmallImage, out value);
}
else if (key == PropertyKeys.SmallHighContrastImage)
{
// If in High Contrast White mode or a disabled icon in High Contrast Black, use regular image
RibbonHelper.CreateImagePropVariant(ApplicationEnvironment.IsHighContrastWhite || (ApplicationEnvironment.IsHighContrastBlack && !Enabled) ? SmallImage : SmallHighContrastImage, out value);
}
else if (key == PropertyKeys.LargeImage)
{
RibbonHelper.CreateImagePropVariant(LargeImage, out value);
}
else if (key == PropertyKeys.LargeHighContrastImage)
{
// If in High Contrast White mode or a disabled icon in High Contrast Black, use regular image
RibbonHelper.CreateImagePropVariant(ApplicationEnvironment.IsHighContrastWhite || (ApplicationEnvironment.IsHighContrastBlack && !Enabled) ? LargeImage : LargeHighContrastImage, out value);
}
else if (key == PropertyKeys.Label)
{
value.SetString(LabelTitle ?? String.Empty);
}
else if (key == PropertyKeys.LabelDescription)
{
value.SetString(LabelDescription ?? String.Empty);
}
else if (key == PropertyKeys.TooltipTitle)
{
// In order to eliminate some duplicate strings in our localization we will
// return the LabelTitle for the TooltipTitle if the TooltipTitle is missing in the markup.
value.SetString(TooltipTitle ?? (LabelTitle ?? String.Empty));
}
else if (key == PropertyKeys.TooltipDescription)
{
value.SetString(TooltipDescription ?? String.Empty);
}
else if (key == PropertyKeys.Keytip)
{
value.SetString(Keytip ?? String.Empty);
}
else if (key == PropertyKeys.ContextAvailable)
{
value.SetUInt(Enabled ? (uint)ContextAvailability.Active : (uint)ContextAvailability.NotAvailable);
}
else if (key == PropertyKeys.RepresentativeString)
{
IRepresentativeString rs = (IRepresentativeString)this;
value.SetString(rs.RepresentativeString);
}
else if (key == PropertyKeys.BooleanValue)
{
value.SetBool(Latched);
}
else
{
Trace.Fail("Didn't properly update property for " + key + " on command " + CommandId);
throw new Exception("Failed to get PropVariant for " + key);
}
}
示例5: GetPropVariant
public override void GetPropVariant(PropertyKey key, PropVariantRef currentValue, ref PropVariant value)
{
if (key == PropertyKeys.DecimalValue)
{
value.SetDecimal(Value);
}
else if (key == PropertyKeys.MinValue)
{
value.SetDecimal(MinValue);
}
else if (key == PropertyKeys.MaxValue)
{
value.SetDecimal(MaxValue);
}
else if (key == PropertyKeys.Increment)
{
value.SetDecimal(Increment);
}
else if (key == PropertyKeys.DecimalPlaces)
{
value.SetUInt(DecimalPlaces);
}
else if (key == PropertyKeys.FormatString)
{
value.SetString(FormatString);
}
else
base.GetPropVariant(key, currentValue, ref value);
}
示例6: GetProperty
public int GetProperty(ItemPropId propID, ref PropVariant value)
{
value.Clear();
if (_subArchiveMode)
{
if (propID == ItemPropId.Name)
{
value.SetBString(_subArchiveName);
}
}
else
{
switch (propID)
{
case ItemPropId.Name:
if (!_streamMode)
{
value.SetBString(Path.GetFileName(_fileName));
}
break;
case ItemPropId.IsDirectory:
value.SetBool(_streamMode ? false : (byte)(new FileInfo(_fileName).Attributes & FileAttributes.Directory) != 0);
break;
case ItemPropId.Size:
value.SetULong((ulong)_currentVolumeSize);
break;
case ItemPropId.Attributes:
value.SetUInt(_streamMode ? (uint)0 : (uint)new FileInfo(_fileName).Attributes);
break;
case ItemPropId.CreationTime:
if (!_streamMode)
{
value.SetDateTime(new FileInfo(_fileName).CreationTime);
}
break;
case ItemPropId.LastAccessTime:
if (!_streamMode)
{
value.SetDateTime(new FileInfo(_fileName).LastAccessTime);
}
break;
case ItemPropId.LastWriteTime:
if (!_streamMode)
{
value.SetDateTime(new FileInfo(_fileName).LastWriteTime);
}
break;
}
}
return HRESULT.S_OK;
}
示例7: UpdateProperty
/// <summary>
/// Handles IUICommandHandler.UpdateProperty function for the supported properties
/// </summary>
/// <param name="key">The Property Key to update</param>
/// <param name="currentValue">A pointer to the current value for key. This parameter can be NULL</param>
/// <param name="newValue">When this method returns, contains a pointer to the new value for key</param>
/// <returns>Returns S_OK if successful, or an error value otherwise</returns>
public override HRESULT UpdateProperty(ref PropertyKey key, PropVariantRef currentValue, ref PropVariant newValue)
{
if (key == RibbonProperties.Categories)
{
if (CategoriesReady != null)
{
CategoriesReady(_sender, EventArgs.Empty);
}
}
else if (key == RibbonProperties.ItemsSource)
{
if (ItemsSourceReady != null)
{
ItemsSourceReady(_sender, EventArgs.Empty);
}
}
else if (key == RibbonProperties.SelectedItem)
{
if (_selectedItem.HasValue)
{
newValue.SetUInt(_selectedItem.Value);
}
}
return HRESULT.S_OK;
}
示例8: UpdateProperty
/// <summary>
/// Handles IUICommandHandler.UpdateProperty function for the supported properties
/// </summary>
/// <param name="key">The Property Key to update</param>
/// <param name="currentValue">A pointer to the current value for key. This parameter can be NULL</param>
/// <param name="newValue">When this method returns, contains a pointer to the new value for key</param>
/// <returns>Returns S_OK if successful, or an error value otherwise</returns>
public override HRESULT UpdateProperty(ref PropertyKey key, PropVariantRef currentValue, ref PropVariant newValue)
{
if (key == RibbonProperties.DecimalValue)
{
}
else if (key == RibbonProperties.Increment)
{
if (_increment.HasValue)
{
newValue.SetDecimal(_increment.Value);
}
}
else if (key == RibbonProperties.MaxValue)
{
if (_maxValue.HasValue)
{
newValue.SetDecimal(_maxValue.Value);
}
}
else if (key == RibbonProperties.MinValue)
{
if (_minValue.HasValue)
{
newValue.SetDecimal(_minValue.Value);
}
}
else if (key == RibbonProperties.DecimalPlaces)
{
if (_decimalPlaces.HasValue)
{
newValue.SetUInt(_decimalPlaces.Value);
}
}
else if (key == RibbonProperties.FormatString)
{
if (_formatString != null)
{
newValue.SetString(_formatString);
}
}
return HRESULT.S_OK;
}