Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string firma = "";
- private void radButton1_Click(object sender, EventArgs e)
- {
- try
- {
- for (int i = 0; i < radGridView4.Rows.Count; i++)
- {
- DateTime executionTime = Convert.ToDateTime(radGridView4.Rows[i].Cells[10].Value.ToString());
- ScheduleAction(action, executionTime);
- }
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex);
- }
- }
- public async void ScheduleAction(Action action, DateTime ExecutionTime)
- {
- try
- {
- if (DateTime.Now < ExecutionTime)//ExecutionTime only create an alarm for rows that are later than now
- {
- await Task.Delay((int)ExecutionTime.Subtract(DateTime.Now).TotalMilliseconds);
- action();
- }
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex);
- }
- }
- public void action()
- {
- RadDesktopAlert Alert;
- for (int i = 0; i < radGridView4.Rows.Count; i++)
- {
- DateTime executionTime = Convert.ToDateTime(radGridView4.Rows[i].Cells[10].Value.ToString());
- if (DateTime.Now.Date == executionTime.Date && DateTime.Now.Hour == executionTime.Hour && DateTime.Now.Minute == executionTime.Minute)
- {
- Alert = new RadDesktopAlert();
- firma = radGridView4.Rows[i].Cells[2].Value.ToString();
- Alert.CaptionText = "Telefonmøde";
- Alert.ContentText = firma;
- Alert.Show();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement