private void DataGrid_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { gridMenu.Show(CaptchaDataGrid, CaptchaDataGrid.PointToClient(Cursor.Position)); } }
private void resetStatsToolStripMenuItem_Click(object sender, EventArgs e) { foreach (DataGridViewRow row in CaptchaDataGrid.SelectedRows) { CaptchaAPI c = row.DataBoundItem as CaptchaAPI; c.fail_count = 0; c.success_count = 0; } CaptchaDataGrid.Refresh(); }
private void moveUPToolStripMenuItem_Click(object sender, EventArgs e) { CaptchaAPI c = CaptchaDataGrid.SelectedRows[0].DataBoundItem as CaptchaAPI; if (c.order == 1) { MessageBox.Show("1 is the highest priority."); return; } GlobalSettings.captchaSettings.FirstOrDefault(_ => (c.order - _.order) == 1).order += 1; c.order -= 1; CaptchaDataGrid.Refresh(); }
private void moveDownToolStripMenuItem_Click(object sender, EventArgs e) { CaptchaAPI c = CaptchaDataGrid.SelectedRows[0].DataBoundItem as CaptchaAPI; if (c.order == Enum.GetValues(typeof(CaptchaProvider)).Length) { MessageBox.Show(Enum.GetValues(typeof(CaptchaProvider)).Length + " is the lowest priority."); return; } GlobalSettings.captchaSettings.FirstOrDefault(_ => (_.order - c.order) == 1).order -= 1; c.order += 1; CaptchaDataGrid.Refresh(); }
private void DataGrid_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e) { if (e.Button == MouseButtons.Right) { if (!(CaptchaDataGrid.SelectedRows.Count > 1)) { CaptchaDataGrid.ClearSelection(); } try { CaptchaDataGrid.Rows[e.RowIndex].Selected = true; cellMenu.Show(CaptchaDataGrid, CaptchaDataGrid.PointToClient(Cursor.Position)); } catch { } } }
private void moveToFirstToolStripMenuItem_Click(object sender, EventArgs e) { if (CaptchaDataGrid.SelectedRows.Count > 1) { MessageBox.Show("You can only select one row."); return; } CaptchaAPI c = CaptchaDataGrid.SelectedRows[0].DataBoundItem as CaptchaAPI; foreach (CaptchaAPI _ in GlobalSettings.captchaSettings) { if (_ == c) { continue; } else if (_.order < c.order) { _.order += 1; } } c.order = 1; CaptchaDataGrid.Refresh(); }
private void selectAllToolStripMenuItem_Click(object sender, EventArgs e) { CaptchaDataGrid.SelectAll(); CaptchaDataGrid.Refresh(); }