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


C# Management.ObjectGetOptions类代码示例

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


ObjectGetOptions类属于System.Management命名空间,在下文中一共展示了ObjectGetOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: buttonSystemRestore_Click

        //Create a system restore point using WMI. Should work in XP, VIsta and 7
        private void buttonSystemRestore_Click(object sender, EventArgs e)
        {
            ManagementScope oScope = new ManagementScope("\\\\localhost\\root\\default");
            ManagementPath oPath = new ManagementPath("SystemRestore");
            ObjectGetOptions oGetOp = new ObjectGetOptions();
            ManagementClass oProcess = new ManagementClass(oScope, oPath, oGetOp);

            ManagementBaseObject oInParams = oProcess.GetMethodParameters("CreateRestorePoint");
            oInParams["Description"] = "Nvidia PowerMizer Manager";
            oInParams["RestorePointType"] = 10;
            oInParams["EventType"] = 100;

            this.buttonOK.Enabled = false;
            this.buttonCancel.Enabled = false;
            this.buttonSystemRestore.Enabled = false;

            this.labelDis.Text = "Creating System Restore Point. Please wait...";

            ManagementBaseObject oOutParams = oProcess.InvokeMethod("CreateRestorePoint", oInParams, null);

            this.buttonOK.Enabled = true;
            this.buttonCancel.Enabled = true;
            this.buttonSystemRestore.Enabled = true;

            this.labelDis.Text = text;
        }
开发者ID:michael-manley,项目名称:nvpmmgr,代码行数:27,代码来源:InstantApplyDisc.cs

示例2: getComputerInfos

        public static String[] getComputerInfos(string computername)
        {
            String[] computerInfos = new String[2];

            ConnectionOptions connOptions = new ConnectionOptions();
            ObjectGetOptions objectGetOptions = new ObjectGetOptions();
            ManagementPath managementPath = new ManagementPath("Win32_Process");

            //To use caller credential
            connOptions.Impersonation = ImpersonationLevel.Impersonate;
            connOptions.EnablePrivileges = true;
            ManagementScope manScope = new ManagementScope(String.Format(@"\\{0}\ROOT\CIMV2", computername), connOptions);
            manScope.Connect();
            ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_OperatingSystem");
            ManagementObjectSearcher searcher = new ManagementObjectSearcher(manScope, query);
            ManagementObjectCollection queryCollection = searcher.Get();

            foreach (ManagementObject m in queryCollection){

                computerInfos[0] = Convert.ToString(m["Caption"]);
                computerInfos[1] = Convert.ToString(m["Status"]);

            }

            return computerInfos;
        }
开发者ID:banctilrobitaille,项目名称:RemoteScriptLauncher,代码行数:26,代码来源:CommUtility.cs

示例3: InstallHosts

        public static string InstallHosts(string ServerName, string HostName, string UserName, string Password, bool StartHost)
        {
            PutOptions options = new PutOptions();
            options.Type = PutType.CreateOnly;
            ObjectGetOptions bts_objOptions = new ObjectGetOptions();

            // Creating instance of BizTalk Host.
            ManagementClass bts_AdminObjClassServerHost = new ManagementClass("root\\MicrosoftBizTalkServer", "MSBTS_ServerHost", bts_objOptions);
            ManagementObject bts_AdminObjectServerHost = bts_AdminObjClassServerHost.CreateInstance();

            // Make sure to put correct Server Name,username and // password
            bts_AdminObjectServerHost["ServerName"] = ServerName;
            bts_AdminObjectServerHost["HostName"] = HostName;
            bts_AdminObjectServerHost.InvokeMethod("Map", null);

            ManagementClass bts_AdminObjClassHostInstance = new ManagementClass("root\\MicrosoftBizTalkServer", "MSBTS_HostInstance", bts_objOptions);
            ManagementObject bts_AdminObjectHostInstance = bts_AdminObjClassHostInstance.CreateInstance();

            bts_AdminObjectHostInstance["Name"] = "Microsoft BizTalk Server " + HostName + " " + ServerName;

            //Also provide correct user name and password.
            ManagementBaseObject inParams = bts_AdminObjectHostInstance.GetMethodParameters("Install");
            inParams["GrantLogOnAsService"] = false;
            inParams["Logon"] = UserName;
            inParams["Password"] = Password;

            bts_AdminObjectHostInstance.InvokeMethod("Install", inParams, null);
            
            if(StartHost)
                bts_AdminObjectHostInstance.InvokeMethod("Start", null);

            return "  Host - " + HostName + " - has been installed. \r\n";
        }
开发者ID:navkar,项目名称:BizTalkControlCenter,代码行数:33,代码来源:WMIMethods.cs

示例4: RemoteComputerInfo

        private List<String> RemoteComputerInfo(string Username, string Password, string IP, string sWin32class)
        {
            List<String> resultList = new List<String>();

            ConnectionOptions options = new ConnectionOptions();
            options.Username = Username;
            options.Password = Password;
            options.Impersonation = ImpersonationLevel.Impersonate;
            options.EnablePrivileges = true;
            try
            {
                ManagementScope mgtScope = new ManagementScope(string.Format("\\\\{0}\\root\\cimv2", IP), options);
                mgtScope.Connect();

                ObjectGetOptions objectGetOptions = new ObjectGetOptions();
                ManagementPath mgtPath = new ManagementPath(sWin32class);
                ManagementClass mgtClass = new ManagementClass(mgtScope, mgtPath, objectGetOptions);

                PropertyDataCollection prptyDataCollection = mgtClass.Properties;

                foreach (ManagementObject mgtObject in mgtClass.GetInstances())
                {
                    foreach (PropertyData property in prptyDataCollection)
                    {
                        try
                        {
                            string mobjvalue = "";
                            if (mgtObject.Properties[property.Name].Value == null)
                            {
                                mobjvalue = "null";
                            }
                            else
                            {
                                mobjvalue = mgtObject.Properties[property.Name].Value.ToString();
                            }

                            if (ShouldInclude(property.Name))
                            {
                                resultList.Add(string.Format(property.Name + ":  " + mobjvalue));
                            }
                        }
                        catch (Exception ex)
                        {
                            System.Diagnostics.Debug.WriteLine(ex.Message);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                resultList.Add(string.Format("Can't Connect to Server: {0}\n{1}", IP, ex.Message));
            }

            return resultList;
        }
开发者ID:PaulWillis,项目名称:ServerInfoWMI,代码行数:55,代码来源:SystemInformation.cs

示例5: Main

        public static void Main(string[] args)
        {
            var now = DateTime.Now.ToString();
            var filepath = Environment.CurrentDirectory + @"\output.txt";
            Console.WriteLine("Fetching information about BitLocker using WIM ..\r\n");
            using (var file = File.CreateText(filepath))
            {
                try
                {
                    var path = new ManagementPath();
                    path.NamespacePath = BITLOCKER_NS;
                    path.ClassName = BITLOCKER_CLASS;

                    var scope = new ManagementScope(path);
                    var options = new ObjectGetOptions();
                    var management = new ManagementClass(scope, path, options);

                    file.WriteLine(string.Format("{0}\r\n", now));
                    int counter = 1;
                    foreach (var instance in management.GetInstances())
                    {
                        var builder = new StringBuilder();
                        builder.AppendFormat("{0}.\r\n", counter);
                        builder.AppendFormat("  DeviceID:            {0}\r\n", instance["DeviceID"]);
                        builder.AppendFormat("  PersistentVolumeID:  {0}\r\n", instance["PersistentVolumeID"]);
                        builder.AppendFormat("  DriveLetter:         {0}\r\n", instance["DriveLetter"]);
                        builder.AppendFormat("  ProtectionStatus:    {0}\r\n", instance["ProtectionStatus"]);

                        Console.WriteLine(builder.ToString());
                        file.Write(builder.ToString());
                        counter++;
                    }
                    file.Flush();

                    Console.WriteLine("Output written to: " + filepath);
                }
                catch (Exception ex)
                {
                    file.WriteLine(ex.Message);
                    Console.WriteLine(ex.Message);
                    file.WriteLine(ex.StackTrace);
                    Console.WriteLine(ex.StackTrace);
                }
                finally
                {
                    Console.WriteLine("\r\nPress Enter to continue ..");
                    Console.ReadLine();
                }
            }
        }
开发者ID:JakobssonAndre,项目名称:BitlockedDriveStatus,代码行数:50,代码来源:Program.cs

示例6: QueryConditionForm

        //-------------------------------------------------------------------------
        // Initializes the EventQueryCondition object, to create a pointer
        // back to the parent WMIScripter form.
        //-------------------------------------------------------------------------
        public QueryConditionForm(QueryControl2 parent)
        {
            InitializeComponent();
            this.StoredValue = "";

            this.OperatorBox.Items.Add("=");
            this.OperatorBox.Items.Add("<>");
            this.OperatorBox.Items.Add(">");
            this.OperatorBox.Items.Add("<");
            this.OperatorBox.Items.Add("ISA");

            this.Q_Info = parent;

            this.PropertyList.DrawMode = DrawMode.OwnerDrawFixed;
            this.PropertyList.DrawItem += new DrawItemEventHandler(this.PropertyList_DrawItem);

            this.ValueList.DrawMode = DrawMode.OwnerDrawFixed;
            this.ValueList.DrawItem += new DrawItemEventHandler(this.ValueList_DrawItem);

            try
            {
                ObjectGetOptions op = new ObjectGetOptions(null, System.TimeSpan.MaxValue, true);
                ManagementClass mc = new ManagementClass(this.Q_Info.GetNamespaceName(),
                    this.Q_Info.GetClassName(), op);
                mc.Options.UseAmendedQualifiers = true;

                foreach (PropertyData property in mc.Properties)
                {
                    if (property.IsArray)
                    {
                        // Don't add it to the list.
                    }
                    else
                    {
                        this.PropertyList.Items.Add(property.Name);
                    }
                }

                if (this.PropertyList.Items.Count > 0)
                {
                    this.PropertyList.Text = this.PropertyList.Items[0].ToString();
                }

            }
            catch (ManagementException)
            {
                // Invalid Query, the class or namespace might be blank.  Do nothing.
            }
        }
开发者ID:ctscoville,项目名称:WMIScripter,代码行数:53,代码来源:QueryConditionForm.cs

示例7: TestCreate

 private void TestCreate()
 {
     ConnectionOptions Conn = new ConnectionOptions();
     //Conn.Username = "wmitest";
     //Conn.Password = "wmitest";
     Conn.Impersonation = ImpersonationLevel.Impersonate;
     Conn.EnablePrivileges = true;
     ManagementScope ms = new ManagementScope(@"\\.\root\sbs", Conn);
     ms.Connect();
     ObjectGetOptions option = new ObjectGetOptions();
     ManagementClass mc = new ManagementClass(ms, new ManagementPath("sbs_user"), option);
     ManagementObject mo = mc.CreateInstance();
     mo["UserName"] = "aaa";
     mo.Put();
 }
开发者ID:cpm2710,项目名称:cellbank,代码行数:15,代码来源:Client.cs

示例8: getProfile

        /*
         *Method that execute a WMI command on a remote computer and return all the profile folders' name
         * in an arraylist
         */
        public static ArrayList getProfile(string computername)
        {
            //List to store the user profiles
            ArrayList profileList = new ArrayList();

            //Line of the file written on the client
            string line;

            ConnectionOptions connOptions = new ConnectionOptions();
            ObjectGetOptions objectGetOptions = new ObjectGetOptions();
            ManagementPath managementPath = new ManagementPath("Win32_Process");

            //To use caller credential
            connOptions.Impersonation = ImpersonationLevel.Impersonate;
            connOptions.EnablePrivileges = true;
            ManagementScope manScope = new ManagementScope(String.Format(@"\\{0}\ROOT\CIMV2", computername), connOptions);
            manScope.Connect();
            InvokeMethodOptions methodOptions = new InvokeMethodOptions(null, System.TimeSpan.MaxValue);
            ManagementClass processClass = new ManagementClass(manScope, managementPath, objectGetOptions);
            ManagementBaseObject inParams = processClass.GetMethodParameters("Create");

            //The command to execute to get the profile folder and write the result to C:\\tmp.txt
            inParams["CommandLine"] = "cmd /c " + "dir C:\\Users /B" + " > c:\\tmp.txt";
            ManagementBaseObject outParams = processClass.InvokeMethod("Create", inParams,methodOptions);

            //Arbitratry delay to make sure that the command is done
            Thread.Sleep(2000);

            //Reading the result file
            StreamReader sr = new StreamReader("\\\\" + computername + "\\c$\\tmp.txt");
            line = sr.ReadLine();

            //While there are profile
            while (line != null)
            {
              //Add the profile to the arraylist
              profileList.Add(line);
              line = sr.ReadLine();

            }

            sr.Close();

            return profileList;
        }
开发者ID:banctilrobitaille,项目名称:RemoteScriptLauncher,代码行数:49,代码来源:CommUtility.cs

示例9: RemoteHelper

        const int delayInAutoEventTimeout = 400; // 400 milliseconds

        internal RemoteHelper(string machineName)
        {
            this.machineName = machineName;

            // establish connection
            ConnectionOptions co = new ConnectionOptions();
            co.Authentication = AuthenticationLevel.PacketPrivacy;
            co.Impersonation = ImpersonationLevel.Impersonate;

            // define the management scope
            managementScope = new ManagementScope("\\\\" + machineName + "\\root\\cimv2", co);
            // define the path used
            ManagementPath path = new ManagementPath("Win32_Process");
            ObjectGetOptions options = new ObjectGetOptions(new ManagementNamedValueCollection(), TimeSpan.FromSeconds(15), false);

            // get the object for the defined path in the defined scope
            // this object will be the object on which the InvokeMethod will be called
            processClass = new ManagementClass(managementScope, path, options);
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:21,代码来源:RemoteHelper.cs

示例10: CreateClientAgents

        /// <summary>
        /// create client agents on nodes and start agents using WMI
        /// </summary>
        public static void CreateClientAgents()
        {
            Parallel.ForEach(TestEngine.TestPackage.Nodes.NodeList, node =>
            {
                for (int i = 0; i < TestEngine.TestPackage.Nodes.NoOfClientsPerNode; i++)
                {
                    string clientNumber = i.ToString();
                    //copy exe and other files to client location and start the exe
                    string remoteServerName = node;
                    if (!Directory.Exists(@"\\" + remoteServerName + @"\C$\WCFLoadUI" + clientNumber))
                    {
                        Directory.CreateDirectory(@"\\" + remoteServerName + @"\C$\WCFLoadUI" + clientNumber);
                    }

                    foreach (string newPath in Directory.GetFiles(Environment.CurrentDirectory + @"\WCFService", "*.*",
                        SearchOption.AllDirectories))
                        File.Copy(newPath,
                            newPath.Replace(Environment.CurrentDirectory + @"\WCFService",
                                @"\\" + remoteServerName + @"\C$\WCFLoadUI" + clientNumber), true);

                    ConnectionOptions connectionOptions = new ConnectionOptions();

                    ManagementScope scope =
                        new ManagementScope(
                            @"\\" + remoteServerName + "." + Domain.GetComputerDomain().Name + @"\root\CIMV2",
                            connectionOptions);
                    scope.Connect();

                    ManagementPath p = new ManagementPath("Win32_Process");
                    ObjectGetOptions objectGetOptions = new ObjectGetOptions();

                    ManagementClass classInstance = new ManagementClass(scope, p, objectGetOptions);

                    ManagementBaseObject inParams = classInstance.GetMethodParameters("Create");

                    inParams["CommandLine"] = @"C:\WCFLoadUI"  + clientNumber + @"\WCFService.exe " + Environment.MachineName + " 9090";
                    inParams["CurrentDirectory"] = @"C:\WCFLoadUI" + clientNumber;
                    classInstance.InvokeMethod("Create", inParams, null);
                }
            });
        }
开发者ID:huoxudong125,项目名称:WCFLoadUI,代码行数:44,代码来源:WMI.cs

示例11: Main

        static void Main(string[] args)
        {
            try
            {
                string ComputerName = "localhost";
                ManagementScope Scope;

                if (!ComputerName.Equals("localhost", StringComparison.OrdinalIgnoreCase))
                {
                    ConnectionOptions Conn = new ConnectionOptions();
                    Conn.Username  = "";
                    Conn.Password  = "";
                    Conn.Authority = "ntlmdomain:DOMAIN";
                    Scope = new ManagementScope(String.Format("\\\\{0}\\[WMINAMESPACE]", ComputerName), Conn);
                }
                else
                    Scope = new ManagementScope(String.Format("\\\\{0}\\[WMINAMESPACE]", ComputerName), null);

                Scope.Connect();
                ObjectGetOptions Options      = new ObjectGetOptions();
                ManagementPath Path           = new ManagementPath("[WMIPATH]");
                ManagementObject ClassInstance= new ManagementObject(Scope, Path, Options);
                ManagementBaseObject inParams = ClassInstance.GetMethodParameters("[WMIMETHOD]");
开发者ID:bgarrels,项目名称:wmi-delphi-code-creator,代码行数:23,代码来源:TemplateNonStaticMethodInvokerCSharp.cs

示例12: _Clone

		internal static ObjectGetOptions _Clone(ObjectGetOptions options, IdentifierChangedEventHandler handler)
		{
			ObjectGetOptions objectGetOption;
			if (options == null)
			{
				objectGetOption = new ObjectGetOptions();
			}
			else
			{
				objectGetOption = new ObjectGetOptions(options.context, options.timeout, options.UseAmendedQualifiers);
			}
			if (handler == null)
			{
				if (options != null)
				{
					objectGetOption.IdentifierChanged += new IdentifierChangedEventHandler(options.HandleIdentifierChange);
				}
			}
			else
			{
				objectGetOption.IdentifierChanged += handler;
			}
			return objectGetOption;
		}
开发者ID:nickchal,项目名称:pash,代码行数:24,代码来源:ObjectGetOptions.cs

示例13: GroupMembers

        public static DataTable GroupMembers(string srv, string usr, string pwd)
        {
            StringBuilder result = new StringBuilder();
            try
            {
                //
                MPSfwk.Model.Server s = new MPSfwk.Model.Server();
                s.IPHOST = srv;
                s.USUARIO = usr;
                s.SENHA = pwd;
                ManagementScope ms = scopeMgmt(false, s);
                ObjectGetOptions objectGetOptions = new ObjectGetOptions();
                //
                string targethost = "";
                string groupname = "";
                string aux_qry = "";
                if ((srv.IndexOf(".") == -1) && (srv.ToUpper() != "LOCALHOST"))
                {   aux_qry = "select * from Win32_Group Where Domain = '" + srv + "'"; }
                else
                { aux_qry = "select * from Win32_Group Where LocalAccount = True"; }
                //
                //MPS teste - 10/out
                //
                Console.WriteLine("DEBUG - aux_qry = " + aux_qry);
                //
                DataTable dt_aux = dtlistaClasse("Win32_Group",
                                                    aux_qry,
                                                    srv,
                                                    usr,
                                                    pwd);
                //
                //Cria tabela para preencher os campos
                DataTable dt1 = new DataTable();
                dt1.TableName = "GroupMembers";
                dt1.Columns.Add("Domain");
                dt1.Columns.Add("Group Name");
                dt1.Columns.Add("Users");
                //
                foreach (DataRow drow in dt_aux.Rows)
                {
                    //
                    DataRow dr = dt1.NewRow();
                    //
                    targethost = drow["Domain"].ToString();
                    groupname = drow["Name"].ToString();

                    StringBuilder qs = new StringBuilder();
                    qs.Append("SELECT PartComponent FROM Win32_GroupUser WHERE GroupComponent = \"Win32_Group.Domain='");
                    qs.Append(targethost);
                    qs.Append("',Name='");
                    qs.Append(groupname);
                    qs.AppendLine("'\"");
                    ObjectQuery query = new ObjectQuery(qs.ToString());
                    ManagementObjectSearcher searcher = new ManagementObjectSearcher(ms, query);
                    ManagementObjectCollection queryCollection = searcher.Get();
                    foreach (ManagementObject m in queryCollection)
                    {
                        ManagementPath path = new ManagementPath(m["PartComponent"].ToString());
                        {
                            String[] names = path.RelativePath.Split(',');
                            result.Append(names[0].Substring(names[0].IndexOf("=") + 1).Replace("\"", " ").Trim() + "\\");
                            result.AppendLine(names[1].Substring(names[1].IndexOf("=") + 1).Replace("\"", " ").Trim() + " ; ");
                        }
                    }
                    //Console.WriteLine("Domain =  " + targethost + " Name = " + groupname + " Users = " + result.ToString());
                    dr["Domain"] = targethost;
                    dr["Group Name"] = groupname;
                    dr["Users"] = result.ToString();
                    dt1.Rows.Add(dr);
                    //
                    result = new StringBuilder();

                }
                return dt1;
                //
            }
            catch (Exception e)
            {
                Console.WriteLine("|!| GroupMembers Error - " + e.Message);
                return null;
            }
        }
开发者ID:marcos-soares-bnu,项目名称:dotNETWrk,代码行数:82,代码来源:WMI.cs

示例14: ClassList_DrawItem

        /// <summary>
        /// Handles the event to draw the contents of the class list combo box items.
        /// </summary>
        private void ClassList_DrawItem(object sender, DrawItemEventArgs e)
        {
            string text = this.ClassList.GetItemText(this.ClassList.Items[e.Index]);

            try
            {
                ObjectGetOptions op = new ObjectGetOptions(null, System.TimeSpan.MaxValue, true);
                ManagementClass mc = new ManagementClass(this.NamespaceList.Text,
                    this.ClassList.GetItemText(this.ClassList.Items[e.Index]), op);
                mc.Options.UseAmendedQualifiers = true;

                foreach (QualifierData qualifierObject in
                    mc.Qualifiers)
                {
                    // Gets the class description.
                    if (qualifierObject.Name.ToLower().Equals("description"))
                    {
                        if (qualifierObject.Value.ToString() != String.Empty)
                        {
                            text = text + Environment.NewLine;

                            int length = 0;
                            foreach (string word in qualifierObject.Value.ToString().Split(" ".ToCharArray()))
                            {
                                if (length < 70)
                                {
                                    text = text + word + " ";
                                    length = length + word.Length;
                                }
                                else
                                {
                                    length = 0;
                                    text = text + word + Environment.NewLine;
                                }
                            }
                        }
                    }
                }
            }
            catch (ManagementException)
            {
            }

            e.DrawBackground();

            using (SolidBrush br = new SolidBrush(e.ForeColor))
            {
                e.Graphics.DrawString(text, e.Font, br, e.Bounds);
            }

            if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
            {
                int x = e.Bounds.Right;
                int y = this.ClassList.PointToClient(Cursor.Position).Y - e.Bounds.Height;

                this.QueryControlToolTip.Show(text, this.ClassList, x, y);
            }

            else
            {
                this.QueryControlToolTip.Hide(this.ClassList);
            }

            e.DrawFocusRectangle();
        }
开发者ID:ctscoville,项目名称:WMIScripter,代码行数:68,代码来源:QueryControl2.cs

示例15: PropertyList_MouseMove

        /// <summary>
        /// Sets the tool tip for items in the property list.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PropertyList_MouseMove(object sender, MouseEventArgs e)
        {
            string text = "";

            int index = this.PropertyList.IndexFromPoint(e.Location);

            if (index >= 0 && index < this.PropertyList.Items.Count)
            {
                text = this.PropertyList.Items[index].ToString();

                try
                {
                    ObjectGetOptions op = new ObjectGetOptions(null, System.TimeSpan.MaxValue, true);
                    ManagementClass mc = new ManagementClass(this.NamespaceList.Text,
                        this.ClassList.GetItemText(this.ClassList.Text), op);

                    mc.Options.UseAmendedQualifiers = true;

                    foreach (QualifierData qualifierObject in
                        mc.Properties[text].Qualifiers)
                    {
                        // Gets the class description.
                        if (qualifierObject.Name.ToLower().Equals("description"))
                        {
                            if (qualifierObject.Value.ToString() != String.Empty)
                            {
                                text = text + Environment.NewLine;

                                int length = 0;
                                foreach (string word in qualifierObject.Value.ToString().Split(" ".ToCharArray()))
                                {
                                    if (length < 70)
                                    {
                                        text = text + word + " ";
                                        length = length + word.Length;
                                    }
                                    else
                                    {
                                        length = 0;
                                        text = text + word + Environment.NewLine;
                                    }
                                }
                            }
                        }
                    }
                }
                catch (ManagementException)
                {
                }

                if (QueryControlToolTip.GetToolTip(this.PropertyList) != text)
                {
                    this.QueryControlToolTip.SetToolTip(this.PropertyList, text);
                }
            }
            else
            {
                this.QueryControlToolTip.Hide(this.PropertyList);
            }
        }
开发者ID:ctscoville,项目名称:WMIScripter,代码行数:65,代码来源:QueryControl2.cs


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