コード例 #1
0
ファイル: frmMain.cs プロジェクト: tiendatgithub/Guna_UI
        private void timer_Main_Tick(object sender, EventArgs e)
        {
            float fCPU = CPU.NextValue();

            cir_CPU.Value = (int)fCPU;
            lb_CPU.Text   = string.Format("{0:00.0}%", fCPU);

            float fHD = HD.NextValue();

            cir_HD.Value = (int)fHD;
            lb_HD.Text   = string.Format("{0:00.0}GB", fHD);

            datetime_calendar.Value = DateTime.Now;
        }
コード例 #2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            //CPU e Memoria Use
            Computer computer = new Computer();

            decimal RAM_Used    = ((computer.Info.TotalPhysicalMemory) - (computer.Info.AvailablePhysicalMemory));
            int     percent_RAM = Convert.ToInt32(RAM_Used * 100 / computer.Info.TotalPhysicalMemory);


            metroProgressSpinner_RAM.Value = percent_RAM;
            lblRAM_use_view.Text           = "RAM: " + percent_RAM + " %";

            if (percent_RAM >= 75)
            {
                metroProgressSpinner_RAM.Style = MetroFramework.MetroColorStyle.Red;
            }

            double CPU_use = CPU.NextValue();

            lblCPU_use_view.Text = "CPU: " + Convert.ToInt32(CPU_use).ToString() + " %";

            if (CPU_use >= 99.0)
            {
                metroProgressSpinner_CPU.Value = 100;
                metroProgressSpinner_CPU.Style = MetroFramework.MetroColorStyle.Red;
            }
            else if (CPU_use < 1.0)
            {
                metroProgressSpinner_CPU.Value = (int)Math.Round(CPU_use);
            }
            else
            {
                metroProgressSpinner_CPU.Value = (int)CPU_use;

                if (CPU_use >= 90.0)
                {
                    metroProgressSpinner_CPU.Style = MetroFramework.MetroColorStyle.Red;
                }
            }


            //Hard Disk Use

            double HD_use = HD.NextValue();

            lblHD_use_view.Text = "HD: " + Convert.ToInt32(HD_use).ToString() + " %";

            if (HD_use >= 99.0)
            {
                metroProgressSpinner_HD.Value = 100;
                metroProgressSpinner_HD.Style = MetroFramework.MetroColorStyle.Red;
            }
            else if (HD_use < 1.0)
            {
                metroProgressSpinner_HD.Value = (int)Math.Round(HD_use);
            }
            else
            {
                metroProgressSpinner_HD.Value = (int)HD_use;
                if (HD_use >= 90.0)
                {
                    metroProgressSpinner_HD.Style = MetroFramework.MetroColorStyle.Red;
                }
            }
        }