Esempio n. 1
0
        private async void PMonWindow_Shown(object sender, EventArgs e)
        {
            chart_main.ChartAreas[1].Axes[1].Maximum = PC_RAM.FullRam;

            await Task.Run(() => PC_DISK.Init());

            Disk = new Dictionary <string, int>();
            foreach (string dletter in PC_DISK.Drives)
            {
                Series series = new Series
                {
                    ChartArea = "carea_disk",
                    Name      = $"Disk Active Time ({dletter})",
                    ChartType = SeriesChartType.Line
                };

                Disk.Add(dletter, RegisterChart(series));
                chart_main.Series.Add(series);
            }

            await Task.Run(() => PC_NIC.Init());

            TXNIC = new Dictionary <string, int>();
            RXNIC = new Dictionary <string, int>();
            foreach (string netn in PC_NIC.NICNames)
            {
                Series txs = new Series
                {
                    ChartArea = "carea_net",
                    Name      = $"TX {netn}",
                    ChartType = SeriesChartType.Line
                };

                TXNIC.Add(netn, RegisterChart(txs));

                Series rxs = new Series
                {
                    ChartArea = "carea_net",
                    Name      = $"RX {netn}",
                    ChartType = SeriesChartType.Line
                };

                RXNIC.Add(netn, RegisterChart(rxs));

                chart_main.Series.Add(txs);
                chart_main.Series.Add(rxs);
            }

            timer_update.Enabled = true;
        }
Esempio n. 2
0
        private void Timer_update_Tick(object sender, EventArgs e)
        {
            #region CPU

            Charts[0].Add(PC_CPU.CPUUtilization());

            Charts[1].Add(PC_CPU.CPUKernelTime());

            #endregion CPU

            #region RAM

            Charts[2].Add(PC_RAM.UsedRAM());

            #endregion RAM

            #region Drive

            foreach (string dletter in PC_DISK.Drives)
            {
                Charts[Disk[dletter]].Add(PC_DISK.GetDiskPerc(dletter));
            }

            #endregion Drive

            #region Network

            foreach (string netname in PC_NIC.NICNames)
            {
                Charts[TXNIC[netname]].Add(PC_NIC.GetTX(netname));
                Charts[RXNIC[netname]].Add(PC_NIC.GetRX(netname));
            }

            #endregion Network

            UpdateChartView();
        }