History Tab doest not refresh the events for every click

Topics: Examples
Apr 19, 2016 at 9:46 AM
Edited Apr 19, 2016 at 1:05 PM
Hi ,
I am using version.
  1. When I click the History button multiple times, the same event gets added again and again
    The sample code is given below.
Microsoft.Win32.TaskScheduler.Task newTask = ts.GetTask(taskName);
TaskDefinition td = newTask.Definition;
var ted = new TaskEditDialog(ts, td, true, true);
ted.TaskName = taskName;
ted.MaxHistoryCount = 100;
((System.Windows.Forms.Control)ted.AcceptButton).Enabled = true;
ted.Task = newTask;

Please let me know if I am missing something.
Any help would be greatly appreciated.

Apr 19, 2016 at 6:51 PM
Can you describe precisely the UI steps you are executing to get this error? I am not able to replicate it by running your code snippet and then repeatedly clicking the "History" tab.

You code inspired me to add code that will automatically validate the TaskName property value and set the AcceptButton state. You will see that in 2.5.19.

By the way, you can accomplish the above with much simpler code:
new TaskEditDialog(ts.GetTask(taskName)) { MaxHistoryCount = 100 }.ShowDialog();
When setting the dialog up with a task, you don't need to pull apart the TaskDefinition nor set the TaskName or handle the AcceptButton.
Apr 20, 2016 at 12:19 PM
Thank you very much for the details given. It was really helpful to me. I appreciate it.

Steps to Reproduce the Event refresh issue in History tab
  1. Assume MaxHistoryCount is set to 4
  2. Launch the editor using new TaskEditDialog(ts.GetTask(taskName)) { MaxHistoryCount = 4}.ShowDialog();
  3. Select History Tab. Observe 4 events are listed.
  4. Now Go To 'General" tab ( or any tab )
  5. Then click on 'History' tab
  6. Now we can see 8 events in History tabs ( Actually I expect the same 4 events to be here )
Apr 20, 2016 at 7:53 PM
Thanks for the detail. With it I was able to find the bug. It will be fixed in the next release (2.5.19), due in the next week or so.
Marked as answer by dahall on 4/29/2016 at 10:05 AM
Apr 21, 2016 at 2:45 AM
Thank you very much for your help. I really appreciate it.