我正在为我的CRM系统写一个rad桌面警报,我想让我想在gridview中回调的人,其中一列保存回调的日期和时间。这是到目前为止的完整代码:
public async void ScheduleAction(Action action, DateTime ExecutionTime)
{
try
{
if (DateTime.Now < ExecutionTime)//ExecutionTime - not passed
{
await Task.Delay((int)ExecutionTime.Subtract(DateTime.Now).TotalMilliseconds);
action();
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
public void action()
{
radDesktopAlert1.CaptionText = "Telefonmøde";
radDesktopAlert1.ContentText = navn;
radDesktopAlert1.Show();
}
string navn = "";
private void radButton1_Click(object sender, EventArgs e)
{
try
{
for(int i = 0; i < radGridView4.Rows.Count; i++)
{
string dateTime = radGridView4.Rows[i].Cells[10].Value.ToString();
DateTime executionTime = Convert.ToDateTime(dateTime);
navn = radGridView4.Rows[i].Cells[1].Value.ToString();
ScheduleAction(action, executionTime);
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
我的问题是,当navn被指定为radDesktopAlert1.ContentText时,它将始终是gridview中的最后一行。我怎样才能克服这个问题,所以它会为每个回调显示正确的名称?
提前致谢