private int CreateProcesses(int NumberOfTasks)
        {
            int PCount = 0;

            try{
                foreach (var item in new System.Management.ManagementObjectSearcher("Select * from Win32_Processor").Get())
                {
                    PCount += int.Parse(item["NumberOfCores"].ToString());
                }
            }catch (Exception e) {
                Log("Unable to figure out number of cores - run in 2 core mode", MessageBoxIcon.Warning, null);
                PCount = 2;
            }


            PCount = Math.Min(PCount, NumberOfTasks);
            //int PCount = 4; //Environment.ProcessorCount;
            //вывешиваем progress bars
            PDrivers = new ProcessDriver[PCount];

            int PosShift = 38;

            this.ResumeLayout(false);
            this.Height += PosShift * PCount;

            RawList.Height    -= PosShift * PCount;
            label8.Top        -= PosShift * PCount;
            OutMgfBox.Top     -= PosShift * PCount;
            SaveMGFbutton.Top -= PosShift * PCount;
            checkBox1.Top     -= PosShift * PCount;
            groupBox2.Top     -= PosShift * PCount;
            groupBox3.Top     -= PosShift * PCount;
            DeleteButton.Top  -= PosShift * PCount;
            AddButton.Top     -= PosShift * PCount;
            label9.Top        -= PosShift * PCount;
            RTApexCheck.Top   -= PosShift * PCount;
            progressBar1.Top  -= PosShift * PCount;

            int i;

            for (i = 0; i < PCount; i++)
            {
                PDrivers[i] = new ProcessDriver();
                PDrivers[i].CreateControls(this, 12, progressBar1.Top + 37 + PosShift * i);
            }

            this.PerformLayout();
            return(PCount);
        }
示例#2
0
        private int CreateProcesses(int NumberOfTasks)
        {
            int PCount = 0;
            try{
                foreach (var item in new System.Management.ManagementObjectSearcher("Select * from Win32_Processor").Get())
                {
                    PCount += int.Parse(item["NumberOfCores"].ToString());
                }
            }catch(Exception e){
                Log("Unable to figure out number of cores - run in 2 core mode",MessageBoxIcon.Warning,null);
                PCount = 2;
            }

            PCount = Math.Min(PCount, NumberOfTasks);
            //int PCount = 4; //Environment.ProcessorCount;
            //вывешиваем progress bars
            PDrivers = new ProcessDriver[PCount];

            int PosShift = 38;
            this.ResumeLayout(false);
            this.Height += PosShift*PCount;

            RawList.Height -= PosShift*PCount;
            label8.Top -= PosShift*PCount;
            OutMgfBox.Top -= PosShift*PCount;
            SaveMGFbutton.Top -= PosShift*PCount;
            checkBox1.Top -= PosShift*PCount;
            groupBox2.Top -= PosShift*PCount;
            groupBox3.Top -= PosShift*PCount;
            DeleteButton.Top -= PosShift*PCount;
            AddButton.Top -= PosShift*PCount;
            label9.Top -= PosShift*PCount;
            RTApexCheck.Top -= PosShift*PCount;
            progressBar1.Top -= PosShift*PCount;

            int i;
            for ( i = 0 ; i < PCount ; i++ ){
                PDrivers[i] = new ProcessDriver();
                PDrivers[i].CreateControls(this,12,progressBar1.Top+37+PosShift*i);
            }

            this.PerformLayout();
            return PCount;
        }