Exemplo n.º 1
0
        /// <summary>
        /// This method is used to retrieve the CPU usage of a particular process
        /// </summary>
        private void t_Tick(object sender, EventArgs e)
        {
            dataGridView1.Visible = true;
            int index_2 = dataGridView1.VerticalScrollingOffset;
            //keep track of the previous scroll position
            int index = dataGridView1.FirstDisplayedScrollingRowIndex;

            pl = new ProcessLocal();
            dataGridView1.DataSource = pl.ProcessMonitor();
            if (index >= 0)
            {
                dataGridView1.FirstDisplayedScrollingRowIndex = index;
            }
            updateChart();
            count++;
        }
Exemplo n.º 2
0
        /// <summary>
        /// This method is used to retrieve the CPU usage of a particular process
        /// </summary>
        private void getProcessInfo(object sender)
        {
            dataGridView1.SafeInvoke(d => d.Visible = true);
            //keep track of the previous scroll position
            int index = Int32.Parse(dataGridView1.FirstDisplayedScrollingRowIndex.ToString());

            pl = new ProcessLocal();
            DataTable processMonitor = new DataTable();

            processMonitor = pl.ProcessMonitor();
            dataGridView1.SafeInvoke(d => d.DataSource = processMonitor);
            if (index == -1)
            {
                dataGridView1.SafeInvoke(d => d.FirstDisplayedScrollingRowIndex = index + 1);
            }
            else
            {
                dataGridView1.SafeInvoke(d => d.FirstDisplayedScrollingRowIndex = index);
            }
            this.changeUsageValue();
            this.updateChart();
            count++;
        }