Пример #1
0
        private void DataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView data = (DataGridView)sender;

            if (e.RowIndex >= 0)
            {
                string value = data.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
                if (value == "Удалить")
                {
                    string     namen      = data.Rows[e.RowIndex].Cells[0].Value.ToString();
                    Installing installing = new Installing()
                    {
                        Text = "Удаление " + namen
                    };
                    installing.ShowDialog();
                    data.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "Установить";
                    data.Rows[e.RowIndex].Cells[3].Value             = "Не установлено";
                    data.Rows[e.RowIndex].Cells[2].Value             = "";
                }
                else if (value == "Установить")
                {
                    string     namen      = data.Rows[e.RowIndex].Cells[0].Value.ToString();
                    Installing installing = new Installing()
                    {
                        Text = "Установка " + namen
                    };
                    installing.ShowDialog();
                    data.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "Удалить";
                    data.Rows[e.RowIndex].Cells[3].Value             = "Установлено";
                    data.Rows[e.RowIndex].Cells[2].Value             = DateTime.Today.ToString("d");
                }
            }
        }
Пример #2
0
 // нажатие на "Вход"
 private void Button4_Click(object sender, EventArgs e)
 {
     if (textBox1.Text == "user" && textBox2.Text == "user")
     {
         button1.Visible = false;
         button1.Enabled = false;
         auth.Visible    = false;
         button5.Visible = true;
         textBox1.Text   = "";
         textBox2.Text   = "";
         if (!robotConnected)
         {
             Timer1_Tick(this, EventArgs.Empty);
         }
         Button2_Click(this, EventArgs.Empty);
         if (browserCall)
         {
             label6.Visible = false;
             AddRow("Teacher", "5.0", State.NotInstalled);
             Button3_Click(this, EventArgs.Empty);
             string     namen      = "Teacher";
             Installing installing = new Installing()
             {
                 Text = "Установка " + namen
             };
             installing.ShowDialog();
             dataGridView1.Rows[2].Cells[3].Value = "Установлено";
             dataGridView1.Rows[2].Cells[4].Value = "Удалить";
             dataGridView1.Rows[2].Cells[2].Value = DateTime.Today.ToString("d");
         }
     }
     else
     {
         MessageBox.Show("Неверный логин или пароль!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }