You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lj_plc/Actions/Default/Mesnac.Action.Default/SynchroData/LastTimeRow.cs

53 lines
1.5 KiB
C#

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;
}
}
}
}
}