示例#1
0
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow newDataRow = dataGridView1.Rows[e.RowIndex];
            AddProcForm     a          = new AddProcForm();

            a.ShowDialog();

            foreach (KeyValuePair <string, Process> proc in manager.ProcessList)
            {
                if (proc.Key == dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString())
                {
                    proc.Value.ProcessName = a.ProcessName.Text;
                    proc.Value.User        = a.ProcessUser.Text;
                    proc.Value.CPU         = (int)a.Cpu.Value;
                    proc.Value.Ram         = (int)a.Ram.Value;
                    proc.Value.Discription = a.Discription.Text;
                    proc.Value.Priority    = (int)a.Priority.Value;
                }
            }

            newDataRow.Cells[0].Value = a.ProcessName.Text;
            newDataRow.Cells[1].Value = a.Priority.Value;
            newDataRow.Cells[2].Value = a.Cpu.Value;
            newDataRow.Cells[3].Value = a.Ram.Value;
            newDataRow.Cells[4].Value = a.Discription.Text;
        }
示例#2
0
        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;
        }
示例#3
0
        private void AddProc_Click(object sender, EventArgs e)
        {
            AddProcForm fm3 = new AddProcForm();

            fm3.ShowDialog();

            proc = new Process(fm3.ProcessName.Text,
                               fm3.ProcessUser.Text,
                               (int)fm3.Cpu.Value,
                               (int)fm3.Ram.Value,
                               ((Computer)CurrentPC.SelectedItem).ComputerName,
                               fm3.Discription.Text,
                               (int)fm3.Priority.Value);

            manager.AddProc((Computer)CurrentPC.SelectedItem, proc);

            table.Rows.Add(proc.ProcessName, proc.Priority, proc.CPU, proc.Ram, proc.Discription, proc.Location);
        }
示例#4
0
        private void AddComp_Click(object sender, EventArgs e)
        {
            if (CurrentPC.Items.Count == 0)
            {
                AddProc.Enabled = !AddProc.Enabled;
                ButtonActivity();
            }
            CompAddForm fm1 = new CompAddForm();

            fm1.ShowDialog();

            var comp = manager.AddComp(fm1.textBox1.Text,
                                       (int)fm1.numericUpDown1.Value,
                                       new Dictionary <string, Process>(),
                                       (int)fm1.numericUpDown2.Value,
                                       (int)fm1.numericUpDown2.Value);

            AddProcForm apf = new AddProcForm();

            apf.ShowDialog();

            proc = new Process(apf.ProcessName.Text,
                               apf.ProcessUser.Text,
                               (int)apf.Cpu.Value,
                               (int)apf.Ram.Value,
                               comp.ComputerName,
                               apf.Discription.Text,
                               (int)apf.Priority.Value);

            comp.ProcessList.Add(proc.ProcessName, proc);

            manager.ComputerList.Add(comp.ComputerName, comp);
            manager.ProcessList.Add(proc.ProcessName, proc);

            CurrentPC.Items.Add(comp);
            CurrentPC.SelectedIndex = CurrentPC.Items.Count - 1;

            table.Rows.Add(proc.ProcessName, proc.Priority, proc.CPU, proc.Ram, proc.Discription, proc.Location);
            dataGridView1.DataSource = table;
        }
示例#5
0
        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;
        }