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


C# PropVariant.SetString方法代码示例

本文整理汇总了C#中PropVariant.SetString方法的典型用法代码示例。如果您正苦于以下问题:C# PropVariant.SetString方法的具体用法?C# PropVariant.SetString怎么用?C# PropVariant.SetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PropVariant的用法示例。


在下文中一共展示了PropVariant.SetString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateLeafCondition

        /// <summary>
        /// Creates a leaf condition node that represents a comparison of property value and constant value. 
        /// </summary>
        /// <param name="propertyName">The name of a property to be compared, or null for an unspecified property. 
        /// The locale name of the leaf node is LOCALE_NAME_USER_DEFAULT.</param>
        /// <param name="value">The constant value against which the property value should be compared.</param>
        /// <param name="operation">Specific condition to be used when comparing the actual value and the expected value of the given property</param>
        /// <returns>SearchCondition based on the given parameters</returns>
        /// <remarks>
        /// The search will only work for files that are indexed, as well as the specific properties are indexed. To find 
        /// the properties that are indexed, look for the specific property's property description and 
        /// <see cref="P:Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.TypeFlags"/> property for IsQueryable flag.
        /// </remarks>
        public static SearchCondition CreateLeafCondition(string propertyName, string value, SearchConditionOperation operation)
        {
            PropVariant propVar = new PropVariant();
            propVar.SetString(value);

            return CreateLeafCondition(propertyName, propVar, null, operation);
        }
开发者ID:TanyaTPG,项目名称:Log2Console,代码行数:20,代码来源:SearchConditionFactory.cs

示例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;
        }
开发者ID:ldh9451,项目名称:XLE,代码行数:100,代码来源:ColorPickerPropertiesProvider.cs

示例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.TooltipTitle)
            {
                if (_tooltipTitle != null)
                {
                    newValue.SetString(_tooltipTitle);
                }
            }
            else if (key == RibbonProperties.TooltipDescription)
            {
                if (_tooltipDescription != null)
                {
                    newValue.SetString(_tooltipDescription);
                }
            }

            return HRESULT.S_OK;
        }
开发者ID:ldh9451,项目名称:XLE,代码行数:26,代码来源:TooltipPropertiesProvider.cs

示例4: SetWindowAppId

        /// <summary>
        /// Sets the window's application id by its window handle.
        /// </summary>
        /// <param name="hwnd">The window handle.</param>
        /// <param name="appId">The application id.</param>
        internal static void SetWindowAppId(IntPtr hwnd, string appId)
        {
            IPropertyStore propStore = GetWindowPropertyStore(hwnd);

            PropVariant pv = new PropVariant();
            pv.SetString(appId);
            PropertyKey appUserModelId = SystemProperties.System.AppUserModel.ID;
            propStore.SetValue(ref appUserModelId, ref pv);

            Marshal.ReleaseComObject(propStore);
        }
开发者ID:overeemm,项目名称:JoomlaPodcaster,代码行数:16,代码来源:TaskbarNativeMethods.cs

示例5: 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.StringValue)
            {
                if (_stringValue != null)
                {
                    newValue.SetString(_stringValue);
                }
            }

            return HRESULT.S_OK;
        }
开发者ID:ldh9451,项目名称:XLE,代码行数:19,代码来源:StringValueProperiesProvider.cs

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

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

示例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;
        }
开发者ID:ldh9451,项目名称:XLE,代码行数:50,代码来源:SpinnerPropertiesProvider.cs


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