/// <summary> /// Invoked when a the content of a datagridview cell is clicked /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DgvFilesCellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 2) { GridRow row = (GridRow)gridRowBindingSource[e.RowIndex]; switch (row.Metadata.State) { case RowState.Ready: QueueOrRunWorker(row); btnCancel.Enabled = true; break; case RowState.Parsing: row.Cancel(); dgvFiles.Invalidate(); break; case RowState.Complete: string[] paths = row.LogLocation.Split(','); foreach (string path in paths) { if (File.Exists(path) || Directory.Exists(path)) { System.Diagnostics.Process.Start(path); } } break; } } }
/// <summary> /// Invoked when a the content of a datagridview cell is clicked /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DgvFiles_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 2) { GridRow row = (GridRow)gridRowBindingSource[e.RowIndex]; switch (row.Metadata.State) { case RowState.Ready: QueueOrRunWorker(row); btnCancel.Enabled = true; break; case RowState.Parsing: row.Cancel(); dgvFiles.Invalidate(); break; case RowState.Complete: string fileLoc = row.LogLocation; if (File.Exists(fileLoc)) { System.Diagnostics.Process.Start(fileLoc); } break; default: break; } } }
/// <summary> /// Invoked when the 'Clear All' button is clicked. Cancels pending operations and clears completed & un-started operations. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnClearClick(object sender, EventArgs e) { btnCancel.Enabled = false; btnParse.Enabled = false; //Clear the queue so that cancelled workers don't invoke queued workers _logQueue.Clear(); _logsFiles.Clear(); for (int i = gridRowBindingSource.Count - 1; i >= 0; i--) { GridRow row = gridRowBindingSource[i] as GridRow; if (row.BgWorker.IsBusy) { row.Cancel(); row.Metadata.State = RowState.ClearOnComplete; } else { gridRowBindingSource.RemoveAt(i); } } }