private void DeleteProc_Click(object sender, EventArgs e) { AddProcForm fm4 = new AddProcForm(); fm4.Buttons(); fm4.ShowDialog(); foreach (KeyValuePair <string, Process> proc in manager.ProcessList) { if (proc.Key == fm4.ProcessName.Text) { element = proc.Key; } } manager.DelProc((Computer)CurrentPC.SelectedItem, element); for (int i = table.Rows.Count - 1; i >= 0; i--) { DataRow dr = table.Rows[i]; if (dr["Process"].ToString() == fm4.ProcessName.Text) { dr.Delete(); } } dataGridView1.DataSource = table; }
private void ChangeProcess_Click(object sender, EventArgs e) { AddProcForm fm5 = new AddProcForm(); fm5.Buttons(); fm5.ShowDialog(); AddProcForm fm6 = new AddProcForm(); fm6.ShowDialog(); foreach (KeyValuePair <string, Process> proc in manager.ProcessList) { if (proc.Key == fm5.ProcessName.Text) { proc.Value.ProcessName = fm6.ProcessName.Text; proc.Value.User = fm6.ProcessUser.Text; proc.Value.CPU = (int)fm6.Cpu.Value; proc.Value.Ram = (int)fm6.Ram.Value; proc.Value.Discription = fm6.Discription.Text; proc.Value.Priority = (int)fm6.Priority.Value; } } for (int i = table.Rows.Count - 1; i >= 0; i--) { DataRow dr = table.Rows[i]; if (dr["Process"].ToString() == fm5.ProcessName.Text) { dr["Process"] = fm6.ProcessName.Text; dr["Priority"] = (int)fm6.Priority.Value; dr["Cpu"] = (int)fm6.Cpu.Value; dr["Ram"] = (int)fm6.Ram.Value; dr["Discription"] = fm6.Discription.Text; } } dataGridView1.DataSource = table; }