Beispiel #1
0
        private void ViewRamBarMethod()

        {
            string getTotalRam      = GetTotalRamMethod();
            double getTotalParse    = double.Parse(getTotalRam);
            string getAvailRam      = NewMethod();
            double getAvailRamParse = double.Parse(getAvailRam);
            double usedRAM          = getTotalParse - getAvailRamParse;
            double rate             = 144 / getTotalParse;
            int    usedBar          = (int)(usedRAM * rate);

            btnRamBar.Text = ((usedRAM / getTotalParse) * 100).ToString("0,0") + "%";
            if (((usedRAM / getTotalParse) * 100) >= 80)
            {
                this.btnRamBar.BackColor = Color.Red;
            }
            else
            {
                this.btnRamBar.BackColor = Color.Green;
            }
            //CPU温度
            this.labCPUTem.Text = GetPCId.GetCOUTem();
        }