Пример #1
0
        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;
            }
        }
Пример #2
0
 public MotherboardsPartialForm(Model model)
 {
     _model        = model ?? throw new ArgumentNullException(nameof(model));
     _motherboards = new GenericBindingList <IMotherboard>(_model.Motherboards);
     InitializeComponent();
     InitializeDataGridComponent();
 }
Пример #3
0
        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);
            }
        }
Пример #4
0
        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);
            }
        }
Пример #5
0
        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;
        }