Esempio n. 1
0
        private void Initialize(Brush seriesBrush, Pen seriesPen, Brush labelBrush, Pen gridPen, int numberOfValues, float timeStepInSeconds, Font font, string header)
        {
            Font headerFont = new Font(font, FontStyle.Bold);
            Font labelFont  = font;

            float xMin     = -numberOfValues * timeStepInSeconds;
            float xMax     = 0;
            float xSpacing = (float)Math.Round(Math.Abs(xMin / 3));

            Font  = headerFont;
            Text  = header;
            XAxis = new XAxis(xMin, xMax, xSpacing, true, true, gridPen, labelBrush, "{0:;#s;0}", labelFont);
            YAxis = YAxis.PercentAxis(50, gridPen, labelBrush, labelFont, HorizontalAlignment.Right);

            _cpuSeries       = new ContinousSeries();
            _cpuSeries.Brush = seriesBrush;
            _cpuSeries.Pen   = seriesPen;
            for (int i = -numberOfValues; i <= 0; i++)
            {
                _cpuSeries.AddXY(i * timeStepInSeconds, 0);
            }
            base.AddSeries(_cpuSeries);

            _cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total");

            _timer          = new System.Windows.Forms.Timer();
            _timer.Interval = (int)(timeStepInSeconds * 1000f);
            _timer.Tick    += (object sender, EventArgs e) => UpdateSeries();
            _timer.Start();
        }
Esempio n. 2
0
        private void Initialize(Brush sentBrush, Pen sentPen, Brush recievedBrush, Pen recievedPen, Brush labelBrush, Pen gridPen, int numberOfValues, float timeStepInSeconds, Font font, string header)
        {
            Font headerFont = new Font(font, FontStyle.Bold);
            Font labelFont  = font;

            float xMin     = -numberOfValues * timeStepInSeconds;
            float xMax     = 0;
            float xSpacing = (float)Math.Round(Math.Abs(xMin / 3));
            float yMin     = 0;
            float yMax     = 100;
            float ySpacing = 50;

            Font = headerFont;
            Text = header;

            XAxis = new XAxis(xMin, xMax, xSpacing, true, true, gridPen, labelBrush, "{0:;#s;0}", labelFont);
            YAxis = new YAxis(yMin, yMax, ySpacing, true, true, gridPen, labelBrush, "{0:0.#\\%;;0}", labelFont, HorizontalAlignment.Right);

            _sentSeries       = new ContinousSeries();
            _sentSeries.Brush = sentBrush;
            _sentSeries.Pen   = sentPen;
            for (int i = -numberOfValues; i <= 0; i++)
            {
                _sentSeries.AddXY(i * timeStepInSeconds, 0);
            }
            base.AddSeries(_sentSeries);

            _recievedSeries       = new ContinousSeries();
            _recievedSeries.Brush = recievedBrush;
            _recievedSeries.Pen   = recievedPen;
            for (int i = -numberOfValues; i <= 0; i++)
            {
                _recievedSeries.AddXY(i * timeStepInSeconds, 0);
            }
            base.AddSeries(_recievedSeries);

            if (NetworkInterface.GetIsNetworkAvailable())
            {
                interfaces = NetworkInterface.GetAllNetworkInterfaces();
            }

            UpdateYLabels();

            timer          = new Timer();
            timer.Interval = (int)(timeStepInSeconds * 1000f);
            timer.Tick    += (object sender, EventArgs e) => UpdateSeries();
            timer.Start();
        }
Esempio n. 3
0
        private void Initialize(Brush seriesBrush, Pen seriesPen, Brush labelBrush, Pen gridPen, int numberOfValues, float timeStepInSeconds, Font font, string header)
        {
            Font headerFont = new Font(font, FontStyle.Bold);
            Font labelFont  = font;

            float xMin     = -numberOfValues * timeStepInSeconds;
            float xMax     = 0;
            float xSpacing = (float)Math.Round(Math.Abs(xMin / 3));

            Font = headerFont;
            Text = header;

            XAxis = new XAxis(xMin, xMax, xSpacing, true, true, gridPen, labelBrush, "{0:;#s;0}", labelFont);
            YAxis = YAxis.PercentAxis(50, gridPen, labelBrush, labelFont, HorizontalAlignment.Right);

            _series       = new ContinousSeries();
            _series.Brush = seriesBrush;
            _series.Pen   = seriesPen;
            for (int i = -numberOfValues; i <= 0; i++)
            {
                _series.AddXY(i * timeStepInSeconds, 0);
            }
            base.AddSeries(_series);

            timer          = new Timer();
            timer.Interval = (int)(timeStepInSeconds * 1000f);
            timer.Tick    += (object sender, EventArgs e) => UpdateSeries();
            timer.Start();

            long systemMemory;

            GetPhysicallyInstalledSystemMemory(out systemMemory);

            _totalRam = systemMemory / 1024f;

            _ramCounter = new PerformanceCounter("Memory", "Available MBytes");
        }