Exemple #1
0
        /*
         * this.progressBar1 = new System.Windows.Forms.ProgressBar();
         * this.tabPage1.Controls.Add(this.progressBar1);
         * this.progressBar1.ForeColor = System.Drawing.Color.Lime;
         *  this.progressBar1.Location = new System.Drawing.Point(33, 502);
         *  this.progressBar1.Name = "progressBar1";
         *  this.progressBar1.Size = new System.Drawing.Size(153, 23);
         *  this.progressBar1.TabIndex = 22;
         *
         */
        private void butGetPC_Click(object sender, EventArgs e)
        {
            showPC = new HWInfoGeneral();
            dicPC  = showPC.GetDicPC();

            this.listPC1.Items.Clear();
            this.listPC1.Items.AddRange(dicPC.Select(x => x.Key).ToArray());
            this.labelTextAllPC.Text    = listPC1.Items.Count.ToString();
            this.labelTextAllPC.Visible = true;
        }
        private void buttonTab3GetPC_Click(object sender, EventArgs e)
        {
            showPC = new HWInfoGeneral();
            dicPC  = showPC.GetDicPC();

            #region Add data to comboBoxTab3ListCPU
            this.comboBoxTab3ListCPU.Items.Clear();
            var query = dicPC.OrderBy(x => x.Value.CPU.Name).
                        GroupBy(x => x.Value.CPU.Name,
                                (modelCPU, cpus) => new { ModelCPU = modelCPU, Count = cpus.Count() });
            foreach (var item in query)
            {
                this.comboBoxTab3ListCPU.Items.Add(item.ModelCPU);
            }
            this.comboBoxTab3ListCPU.SelectedIndex = -1;

            this.checkBoxTab3SearchByCPU.Enabled       = true;
            this.checkBoxTab3SearchByMainBoard.Enabled = true;
            #endregion

            #region Add data to comboBoxTab3ListMainBoard
            this.comboBoxTab3ListMainBoard.Items.Clear();
            var queryMainBoard = dicPC.OrderBy(x => x.Value.MainBoard.Product).
                                 GroupBy(x => x.Value.MainBoard.Product,
                                         (modelMainBoard, cpus) => new { ModelMainBoard = modelMainBoard, Count = cpus.Count() });
            foreach (var item in queryMainBoard)
            {
                this.comboBoxTab3ListMainBoard.Items.Add(item.ModelMainBoard);
            }
            this.comboBoxTab3ListMainBoard.SelectedIndex = -1;
            #endregion

            #region Add data to comboBoxTab3ListSizeSSD

            this.comboBoxTab3ListSizeSSD.Items.Clear();
            this.comboBoxTab3ListSizeSSD.Items.AddRange(filtermethods.DicSizeSSD.Keys.ToArray());

            #endregion

            #region Add date to comboBoxTab3ListVersionOS
            this.comboBoxTab3ListBuildOS.Items.Clear();
            this.comboBoxTab3ListBuildOS.Items.AddRange(dicPC.Where(x => x.Value.OS.Version == "10").Select(x => x.Value.OS.Build).Distinct().OrderBy(x => x).ToArray());

            #endregion

            #region Add date to comboBoxTab3ListSizeMonitor
            this.comboBoxTab3ListSizeMonitor.Items.Clear();
            //this.comboBoxTab3ListSizeMonitor.Items.AddRange(dicPC.SelectMany(x => x.Value.Monitors).Select(x => x.PanelSize).Distinct().OrderBy(x => x).ToArray());
            List <string> ArrSizeMonitors = new List <string>();
            foreach (MonitorInfo monitor in dicPC.SelectMany(x => x.Value.Monitors))
            {
                if (monitor.PanelSize != null)
                {
                    ArrSizeMonitors.Add(monitor.PanelSize.ToString());
                }
            }

            ArrSizeMonitors = ArrSizeMonitors.Distinct().OrderBy(x => x).ToList();
            this.comboBoxTab3ListSizeMonitor.Items.AddRange(ArrSizeMonitors.Distinct().OrderBy(x => x).ToArray());

            #endregion

            this.checkBoxTab3SearchByCPU.Enabled       = true;
            this.checkBoxTab3SearchByMainBoard.Enabled = true;
            this.checkBoxTab3SearchByRAM.Enabled       = true;
            this.checkBoxTab3SearchBySSD.Enabled       = true;
            this.checkBoxTab3SearchByOS.Enabled        = true;
            this.checkBoxTab3SearchByMonitor.Enabled   = true;
        }
Exemple #3
0
        private void butGetPC2_Click(object sender, EventArgs e)
        {
            showPC = new HWInfoGeneral();
            dicPC  = showPC.GetDicPC();
            this.dgShowCPU.Rows.Clear();
            this.dgShowMainBoard.Rows.Clear();
            this.dgShowStorages.Rows.Clear();
            this.dgShowOSs.Rows.Clear();
            this.dgShowMonitors.Rows.Clear();

            var query = dicPC.OrderBy(x => x.Value.CPU.Name).
                        GroupBy(x => x.Value.CPU.Name,
                                (modelCPU, cpus) => new { ModelCPU = modelCPU, Count = cpus.Count() });

            foreach (var item in query)
            {
                this.dgShowCPU.Rows.Add(item.ModelCPU, item.Count);
            }
            this.dgShowCPU.ClearSelection();

            var query1 = dicPC.OrderBy(x => x.Value.MainBoard.Product)
                         .GroupBy(x => new { x.Value.MainBoard.Product, x.Value.MainBoard.Manufacturer },
                                  (MainBoard, cpus) => new { ModelMainBoard = MainBoard.Product,
                                                             MainBoard.Manufacturer, Count = cpus.Count() });

            foreach (var item in query1)
            {
                this.dgShowMainBoard.Rows.Add(item.ModelMainBoard, item.Manufacturer, item.Count);
            }
            this.dgShowMainBoard.ClearSelection();

            var query2 = dicPC.Select(x => x.Value).
                         SelectMany(x => x.Storage).
                         GroupBy(x => new { x.Model, x.Size, x.IsSSD },
                                 (Disc, discs) => new { Disc.Model, SizeDisc = Disc.Size, Disc.IsSSD, Count = discs.Count() })
                         .ToList().
                         OrderBy(x => x.Model);

            foreach (var item in query2)
            {
                this.dgShowStorages.Rows.Add(item.Model, item.SizeDisc, item.IsSSD ? "YES" : "NO", item.Count);
            }
            this.dgShowStorages.ClearSelection();

            var query3 = dicPC.Select(x => x.Value.OS).GroupBy(x => new { x.ProductName, x.Version, x.Build, x.IsX64 },
                                                               (Os, systems) => new { OSName = Os.ProductName, Os.Version, Os.Build, Os.IsX64, Count = systems.Count() }).
                         OrderBy(x => x.OSName).ThenBy(x => x.Build);

            foreach (var item in query3)
            {
                this.dgShowOSs.Rows.Add(item.OSName, item.Build, item.Version, item.IsX64 ? "YES" : "NO", item.Count);
            }
            this.dgShowOSs.ClearSelection();

            var query4 = dicPC.Select(x => x.Value).SelectMany(x => x.Monitors).GroupBy(x => new { x.Manufacturer, x.Model, x.PanelSize, x.TrueResolution },
                                                                                        (Monitor, Monitors) => new { Monitor.Manufacturer, Monitor.Model, Size = Monitor.PanelSize, Resolution = Monitor.TrueResolution, Count = Monitors.Count() }).
                         OrderBy(x => x.Manufacturer).ThenBy(x => x.Model);

            foreach (var item in query4)
            {
                this.dgShowMonitors.Rows.Add(item.Manufacturer, item.Model, item.Size, item.Resolution, item.Count);
            }
            this.dgShowMonitors.ClearSelection();



            this.listFilteredPC.Items.Clear();



            //this.listModelCPU.Items.AddRange(query.Select(x => $"{x.ModelCPU} \t:{x.Count}").ToArray());
        }
Exemple #4
0
 private void buttonTab4GetPC_Click(object sender, EventArgs e)
 {
     showPC = new HWInfoGeneral();
     dicPC  = showPC.GetDicPC();
     MessageBox.Show(dicPC.Count.ToString());
 }