示例#1
0
        private void SetHardwareText(Computer comp)
        {
            if (this.hardwareTreeView.InvokeRequired)
            {
                SetHardwareCallback d = new SetHardwareCallback(SetHardwareText);
                this.Invoke(d, new object[] { comp });
            }
            else
            {
                if (comp.HostName == "")
                {
                }
                else
                {
                    //Set Computer Information
                    this.hardwareTreeView.Nodes[0].Nodes[0].Nodes[0].Text = comp.HostName;
                    this.hardwareTreeView.Nodes[0].Nodes[0].Nodes[1].Text = comp.SystemOS;
                    this.hardwareTreeView.Nodes[0].Nodes[0].Nodes[2].Text = comp.HostName;

                    //Set CPU information
                    this.hardwareTreeView.Nodes[0].Nodes[1].Nodes[0].Text = comp.CPUName;
                    this.hardwareTreeView.Nodes[0].Nodes[1].Nodes[1].Text = comp.CPUNumPhysicalCores.ToString();
                    this.hardwareTreeView.Nodes[0].Nodes[1].Nodes[2].Text = comp.CPUNumLogicalCores.ToString();

                    //Set Mobo Information
                    this.hardwareTreeView.Nodes[0].Nodes[2].Nodes[0].Text = comp.SystemMotherboard.Manufacturer;
                    this.hardwareTreeView.Nodes[0].Nodes[2].Nodes[1].Text = comp.SystemMotherboard.Model;
                    this.hardwareTreeView.Nodes[0].Nodes[2].Nodes[2].Text = comp.SystemMotherboard.SystemModel;

                    //Set Memory Information
                    this.hardwareTreeView.Nodes[0].Nodes[3].Nodes[0].Text = (comp.SystemRAM.totalRAM + "MB");
                    this.hardwareTreeView.Nodes[0].Nodes[3].Nodes[1].Text = comp.SystemRAM.installedRAM[0].speed;
                    this.hardwareTreeView.Nodes[0].Nodes[3].Nodes[2].Text = comp.SystemRAM.installedRAM[0].Manufacturer;
                }
            }
        }
示例#2
0
        private void SetHardwareText(string[] details)
        {
            if (this.hardwareTreeView.InvokeRequired)
            {
                SetHardwareCallback d = new SetHardwareCallback(SetHardwareText);
                this.Invoke(d, new object[] { details });
            }
            else
            {
                if (details[0] == "")
                {

                }
                else
                {

                    string[] hardwareDetails = details;
                    string[] compDetails = hardwareDetails[0].Split('$');
                    string[] cpuDetails = hardwareDetails[1].Split('$');
                    string[] moboDetails = hardwareDetails[2].Split('$');
                    string[] memoryDetails = hardwareDetails[3].Split('£');
                    string[] storageDetails = hardwareDetails[4].Split('£');
                    string[] displayDetails = hardwareDetails[5].Split('£');

                    //Clearing Nodes
                    this.hardwareTreeView.Nodes[0].Nodes[3].Nodes.Clear();
                    this.hardwareTreeView.Nodes[0].Nodes[4].Nodes.Clear();
                    this.hardwareTreeView.Nodes[0].Nodes[5].Nodes.Clear();

                    //Set Computer Information
                    this.hardwareTreeView.Nodes[0].Nodes[0].Nodes[0].Text = compDetails[0];
                    this.hardwareTreeView.Nodes[0].Nodes[0].Nodes[1].Text = compDetails[1];
                    this.hardwareTreeView.Nodes[0].Nodes[0].Nodes[2].Text = compDetails[2];

                    //Set CPU information
                    this.hardwareTreeView.Nodes[0].Nodes[1].Nodes[0].Text = cpuDetails[0];
                    this.hardwareTreeView.Nodes[0].Nodes[1].Nodes[1].Text = cpuDetails[1];
                    this.hardwareTreeView.Nodes[0].Nodes[1].Nodes[2].Text = cpuDetails[2];

                    //Set Mobo Information
                    this.hardwareTreeView.Nodes[0].Nodes[2].Nodes[0].Text = moboDetails[0];
                    this.hardwareTreeView.Nodes[0].Nodes[2].Nodes[1].Text = moboDetails[1];
                    this.hardwareTreeView.Nodes[0].Nodes[2].Nodes[2].Text = moboDetails[2];

                    //Set Memory Information
                    for(int  i = 0; i < memoryDetails.Length-1; i++)
                    {
                        string[] ram = memoryDetails[i].Split('$');
                        this.hardwareTreeView.Nodes[0].Nodes[3].Nodes.Add(ram[0]);
                        this.hardwareTreeView.Nodes[0].Nodes[3].Nodes[i].SelectedImageIndex = 4;
                        this.hardwareTreeView.Nodes[0].Nodes[3].Nodes[i].ImageIndex = 4;
                        for (int j = 0; j < ram.Length-1; j++)
                        {
                            this.hardwareTreeView.Nodes[0].Nodes[3].Nodes[i].Nodes.Add(ram[j]);
                            this.hardwareTreeView.Nodes[0].Nodes[3].Nodes[i].Nodes[j].SelectedImageIndex = 4;
                            this.hardwareTreeView.Nodes[0].Nodes[3].Nodes[i].Nodes[j].ImageIndex = 4;
                            this.hardwareTreeView.Nodes[0].Nodes[3].Nodes[i].Nodes[j].StateImageIndex = 4;

                        }
                    }

                    this.hardwareTreeView.Nodes[0].Nodes[3].Nodes.Add(memoryDetails[memoryDetails.Length-1] + " MB");
                    this.hardwareTreeView.Nodes[0].Nodes[3].Nodes[memoryDetails.Length - 1].ImageIndex = 4;

                    //Set Storage Information
                    for (int i = 0; i < storageDetails.Length - 1; i++)
                    {
                        string[] drive = storageDetails[i].Split('$');
                        this.hardwareTreeView.Nodes[0].Nodes[4].Nodes.Add(drive[0]);
                        this.hardwareTreeView.Nodes[0].Nodes[4].Nodes[i].SelectedImageIndex = 5;
                        this.hardwareTreeView.Nodes[0].Nodes[4].Nodes[i].ImageIndex = 5;
                        for (int j = 0; j < drive.Length - 1; j++)
                        {
                            this.hardwareTreeView.Nodes[0].Nodes[4].Nodes[i].Nodes.Add(drive[j]);
                            this.hardwareTreeView.Nodes[0].Nodes[4].Nodes[i].Nodes[j].SelectedImageIndex = 5;
                            this.hardwareTreeView.Nodes[0].Nodes[4].Nodes[i].Nodes[j].ImageIndex = 5;
                            this.hardwareTreeView.Nodes[0].Nodes[4].Nodes[i].Nodes[j].StateImageIndex = 5;
                        }
                    }

                    //Set display adapter information
                   for (int i = 0; i < displayDetails.Length - 1; i++)
                    {
                        string[] adapter = displayDetails[i].Split('$');
                        this.hardwareTreeView.Nodes[0].Nodes[5].Nodes.Add(adapter[0]);
                        this.hardwareTreeView.Nodes[0].Nodes[5].Nodes[i].SelectedImageIndex = 2;
                        this.hardwareTreeView.Nodes[0].Nodes[5].Nodes[i].ImageIndex = 2;
                        for (int j = 0; j < adapter.Length - 1; j++)
                        {
                            this.hardwareTreeView.Nodes[0].Nodes[5].Nodes[i].Nodes.Add(adapter[j]);
                            this.hardwareTreeView.Nodes[0].Nodes[5].Nodes[i].Nodes[j].SelectedImageIndex = 2;
                            this.hardwareTreeView.Nodes[0].Nodes[5].Nodes[i].Nodes[j].ImageIndex = 2;
                            this.hardwareTreeView.Nodes[0].Nodes[5].Nodes[i].Nodes[j].StateImageIndex = 2;
                        }
                    }

                }

            }
        }