using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using Mesnac.Action.Base; using Mesnac.Controls.Base; using System.Windows.Forms; using Mesnac.Codd.Session; namespace Mesnac.Action.Default.SynchroData { public class LastTimeRow : DatabaseAction, IAction { public void Run(RuntimeParameter runtime) { base.RunIni(runtime); //必须调用 foreach (IBaseControl cgrid in GetAllMCControls()) { DataGridView grid = runtime.Sender as DataGridView; if (grid == null) { if (cgrid is DataGridView) { grid = cgrid as DataGridView; } } if (grid == null) { continue; } if (grid.Rows.Count > 0) { LastActionRow row = new LastActionRow(runtime); int index = row.Index; if (grid.Rows.Count > index) { grid.Rows[index].Selected = true; } else { grid.Rows[0].Selected = true; } } if (runtime.Sender is DataGridView) { return; } } } } }