コード例 #1
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        PCSystem pc = (PCSystem)target;

        if (GUILayout.Button("Hide"))
        {
            pc.Hide();
        }
        if (GUILayout.Button("Show"))
        {
            pc.Show();
        }
    }
        private void timer1_Tick(object sender, EventArgs e)
        {
            float x;

            x = c.NextValue();


            //--------------------------------------------------------------------------//

            //Determine the next X value
            double nextX = 1;

            if (chart1.Series["CPU"].Points.Count > 0)
            {
                nextX = chart1.Series["CPU"].Points[chart1.Series["CPU"].Points.Count - 1].XValue + 1;
            }

            //Add a new value to the Series
            //Random rnd = new Random();
            chart1.Series["CPU"].Points.AddXY(nextX, x);

            //Remove Points on the left side after 100
            while (chart1.Series["CPU"].Points.Count > 50)
            {
                chart1.Series["CPU"].Points.RemoveAt(0);
            }

            //Set the Minimum and Maximum values for the X Axis on the Chart
            double min = chart1.Series["CPU"].Points[0].XValue - 1;

            chart1.ChartAreas[0].AxisX.Minimum = min;
            chart1.ChartAreas[0].AxisX.Maximum = min + 50;
            chart1.ChartAreas[0].AxisY.Maximum = 150;

            //---------------------------------------------------------------------------------------/

            circularProgressBar1.Value = (int)PCCPU.NextValue();
            circularProgressBar1.Update();

            int a = (int)x;

            label2.Text = a.ToString() + "%";


            int lt = (int)PCProcess.NextValue();

            lthreads.Text = lt.ToString();

            double ut = (int)PCSystem.NextValue();



            int hour   = Convert.ToInt32(Math.Floor(ut / 3600));
            int minute = Convert.ToInt32(Math.Floor((ut - (hour * 3600)) / 60));
            int sec    = Convert.ToInt32(ut) - (hour * 3600) - (minute * 60);

            luptime.Text = hour.ToString() + " H: " + minute.ToString() + " M: " + sec.ToString() + " S";


            int p = (int)PCnoOfProcess.NextValue();

            lp.Text = p.ToString();
        }