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


C# ManagementClass.GetSubclasses方法代码示例

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


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

示例1: WmiInformationGatherer

        /// <summary>
        /// Targets the specified namespace on a specified computer, and scavenges it for all classes, if the bool is set to true. If false, it is used to setup the ManagementPath which
        /// consists of the specified system and specified namespace
        /// </summary>
        /// <param name="pNamespace"></param>
        /// <param name="pHostName"></param>
        public WmiInformationGatherer(string pNamespace, string pHostName, bool pScavenge)
        {
            mRemoteWmiPath = new ManagementPath(@"\\" + pHostName + @"\root\" + pNamespace);

            if (pScavenge)
            {
                try
                {
                    ManagementClass managementClass = new ManagementClass(mRemoteWmiPath);
                    EnumerationOptions scavengeOptions = new EnumerationOptions();
                    scavengeOptions.EnumerateDeep = false;
                    WmiResults = new WmiResult(pHostName);
                    WmiResults.PopulateClassesList(managementClass.GetSubclasses());
                }
                catch (Exception e)
                {
                    WmiResults.WmiError = e;
                }
            }
        }
开发者ID:Sparse,项目名称:MultiRDP,代码行数:26,代码来源:WmiInformationGatherer.cs

示例2: RefreshClassListAsync

        /// <summary>
        /// Asynchronously refreshes the class list cache for the currently connected WMI Namespace.
        /// </summary>
        private void RefreshClassListAsync()
        {
            this.Text = String.Format("{0}{1}", WINDOW_TITLE_PREFIX, this.CurrentNamespacePath);

            classListItems.Clear();
            this.listViewClasses.Items.Clear();

            this.Log(LogLevel.Information, String.Format("Loading classes for namespace: {0}", this.CurrentNamespacePath));

            var path = new ManagementPath(this.CurrentNamespacePath);
            var ns = new ManagementClass(this.CurrentNamespaceScope, path, nsObjGetOpts);
            try
            {
                ns.GetSubclasses(classListObserver, classListEnumOpts);
                this.Log(LogLevel.Success, "Finished loading classes.");
            }

            catch (ManagementException e)
            {
                var msg = String.Format("An error occurred listing classes in {0}:\r\n\r\n{1}", this.CurrentNamespacePath, e.Message);
                this.Log(LogLevel.Critical, msg);
            }
        }
开发者ID:giapdangle,项目名称:wmilab,代码行数:26,代码来源:frmMain.cs


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