本文整理汇总了C#中System.Management.ManagementClass.GetPropertyQualifierValue方法的典型用法代码示例。如果您正苦于以下问题:C# ManagementClass.GetPropertyQualifierValue方法的具体用法?C# ManagementClass.GetPropertyQualifierValue怎么用?C# ManagementClass.GetPropertyQualifierValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Management.ManagementClass
的用法示例。
在下文中一共展示了ManagementClass.GetPropertyQualifierValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BrowsePropertyList_SelectedIndexChanged
//-------------------------------------------------------------------------
// Handles the event when the user selects one of the properties in the
// BrowsePropertyList on the browse tab. This displays the property information.
//-------------------------------------------------------------------------
private void BrowsePropertyList_SelectedIndexChanged(object sender, System.EventArgs e)
{
string propertyInfo = "Qualifiers: " + System.Environment.NewLine;
string description = "Description: " + System.Environment.NewLine;
try
{
// Gets the property qualifiers.
ObjectGetOptions op = new ObjectGetOptions(null, System.TimeSpan.MaxValue, true);
ManagementClass mc = new ManagementClass(this.BrowseNamespaceList.Text,
this.BrowseClassList.Text, op);
mc.Options.UseAmendedQualifiers = true;
foreach (PropertyData p in mc.Properties)
{
if(p.Name.Equals(this.BrowsePropertyList.SelectedItem))
{
foreach (QualifierData q in p.Qualifiers)
{
propertyInfo = propertyInfo + q.Name + System.Environment.NewLine;
if(q.Name.Equals("Description"))
{
description = description +
mc.GetPropertyQualifierValue(p.Name, q.Name) + System.Environment.NewLine;
}
}
}
this.PropertyInformation.Text = description + System.Environment.NewLine + propertyInfo;
}
}
catch (ManagementException mErr)
{
this.PropertyInformation.Text = "Could not get property information";
if(mErr.Message.Equals("Not found "))
MessageBox.Show("WMI class not found.");
else
MessageBox.Show(mErr.Message.ToString());
}
}