/// <summary>Lets the user browse past operations.</summary> private void OpsHistory(object sender, EventArgs ea) { int n = table.Rows.Count; var selected = new bool[n]; var stockNames = new string[n]; int multi = 0; int i = 0; foreach (DataGridViewRow row in table.Rows) { stockNames[i] = (string)GetCell(i, colStock).Value; if (selected[i] = row.Selected) { ++multi; } ++i; } Debug.Assert(i == n && stockNames.Length == stocks.Count); using (var dlg = new FormHistoryFilter(db, stockNames, multi > 1?selected:null)) dlg.ShowDialog(this); if (db.Dirty) { FillTable(); } }
/// <summary>Lets the user browse past operations.</summary> private void OpsHistory(object sender, EventArgs ea) { int n = table.Rows.Count; var selected = new bool[n]; var stockNames = new string[n]; int multi = 0; for (int i = 0; i < table.Rows.Count; i++) { var row = table.Rows[i]; stockNames[i] = (string)GetCell(i, colStock).Value; if (selected[i] = row.Selected) { ++multi; } } var dataSource = Model.Data.GetFlowEditor(); using (var dlg = new FormHistoryFilter(dataSource, stockNames, multi > 1?selected:null)) dlg.ShowDialog(this); if (dataSource.IsDataChanged) { FillTable(); } }