private async void grdBioses_CellContentClick(object sender, DataGridViewCellEventArgs e) { var grid = (DataGridView)sender; if (grid.Columns[e.ColumnIndex] is DataGridViewLinkColumn && e.RowIndex >= 0) { GenericBindingList <BiosRowData> list = (GenericBindingList <BiosRowData>)bsBioses.DataSource; BiosRowData bios = list[e.RowIndex]; Cursor.Current = Cursors.WaitCursor; if (!await _biosManager.DownloadBiosIfMissingAsync(bios)) { Cursor = Cursors.Default; return; } ProcessStartInfo psi = new ProcessStartInfo(bios.FileName) { UseShellExecute = true }; Process.Start(psi); Cursor = Cursors.Default; } }
public MotherboardsPartialForm(Model model) { _model = model ?? throw new ArgumentNullException(nameof(model)); _motherboards = new GenericBindingList <IMotherboard>(_model.Motherboards); InitializeComponent(); InitializeDataGridComponent(); }
private void grdMotherboards_CellContentClick(object sender, DataGridViewCellEventArgs e) { var grid = (DataGridView)sender; if (grid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { GenericBindingList <MotherboardRowData> list = (GenericBindingList <MotherboardRowData>)bsMotherboards.DataSource; MotherboardRowData motherboard = list[e.RowIndex]; MotherboardSelected?.Invoke(this, motherboard.Source); } }
private void grdBioses_CellContentClick(object sender, DataGridViewCellEventArgs e) { var grid = (DataGridView)sender; if (grid.Columns[e.ColumnIndex] is DataGridViewLinkColumn && e.RowIndex >= 0) { GenericBindingList <BiosRowData> list = (GenericBindingList <BiosRowData>)bsBioses.DataSource; BiosRowData bios = list[e.RowIndex]; ProcessStartInfo psi = new ProcessStartInfo(bios.FileName) { UseShellExecute = true }; Process.Start(psi); } }
private async void grd_PathCellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } DataGridView grid = (DataGridView)sender; if (!(grid.Columns[e.ColumnIndex] is DataGridViewLinkColumn)) { return; } GenericBindingList <BiosRowData> list = (GenericBindingList <BiosRowData>)grdBioses.DataSource; BiosRowData bios = list[e.RowIndex]; Cursor.Current = Cursors.WaitCursor; if (!await _biosManager.DownloadBiosIfMissingAsync(bios)) { Cursor = Cursors.Default; return; } string path = grid.Rows[e.RowIndex].Cells[e.ColumnIndex].Value?.ToString(); if (string.IsNullOrEmpty(path)) { Cursor = Cursors.Default; return; } FileInfo fi = new FileInfo(path); ProcessStartInfo startInfo = new ProcessStartInfo(fi.FullName) { UseShellExecute = true }; Process.Start(startInfo); Cursor = Cursors.Default; }