private void APICaller_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Result != null) { //canceled int count = APIView.Rows.Count; int result = -1; string canceledFile = e.Result as string; for (int i = 0; i < count; i++) { if (APIView[APIView_FileName.Index, i].Value.ToString() == canceledFile) { result = i + 1; // 探知結果までは処理済みのため break; } } if (result != -1 && result < count) { APIView.ClearSelection(); APIView.Rows[result].Selected = true; APIView.FirstDisplayedScrollingRowIndex = result; } } }
private void LoadFiles(string path) { if (!Directory.Exists(path)) { return; } CurrentPath = path; APIView.Rows.Clear(); var rows = new LinkedList <DataGridViewRow>(); foreach (string file in Directory.GetFiles(path, "*.json", SearchOption.TopDirectoryOnly)) { var row = new DataGridViewRow(); row.CreateCells(APIView); row.SetValues(Path.GetFileName(file)); rows.AddLast(row); } APIView.Rows.AddRange(rows.ToArray()); APIView.Sort(APIView_FileName, ListSortDirection.Ascending); }
private void ButtonSearchLastStart2_Click(object sender, EventArgs e) { for (int i = APIView.Rows.Count - 1; i >= 0; i--) { if (APIView[APIView_FileName.Index, i].Value.ToString().ToLower().Contains("s@api_start2.")) { APIView.ClearSelection(); APIView.Rows[i].Selected = true; APIView.FirstDisplayedScrollingRowIndex = i; return; } } //failed System.Media.SystemSounds.Asterisk.Play(); }
private void ButtonExecuteNext_Click(object sender, EventArgs e) { if (APIView.SelectedRows.Count == 1) { var row = APIView.SelectedRows[0]; int index = APIView.SelectedRows[0].Index; ExecuteAPI((string)row.Cells[APIView_FileName.Index].Value); APIView.ClearSelection(); if (index < APIView.Rows.Count - 1) { APIView.Rows[index + 1].Selected = true; APIView.FirstDisplayedScrollingRowIndex = index + 1; } } else { MessageBox.Show("単一行を選択してください。", "情報", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void ButtonSearchPrev_Click(object sender, EventArgs e) { int count = APIView.Rows.Count; int index; int result = -1; if (APIView.SelectedRows.Count > 0) { index = APIView.SelectedRows[0].Index - 1; } else { index = count - 1; } if (index < 0) { index = count - 1; } for (int i = index; i >= 0; i--) { if (APIView[APIView_FileName.Index, i].Value.ToString().ToLower().Contains(TextFilter.Text.ToLower())) { result = i; break; } } if (result != -1) { APIView.ClearSelection(); APIView.Rows[result].Selected = true; APIView.FirstDisplayedScrollingRowIndex = result; } else { System.Media.SystemSounds.Asterisk.Play(); } }