public void SynchronizeTask()
{
string description = string.Format("Schedule for the Tasks. Report '{0}'", Report.FilePath);
if (!IsTasksSchedule) description = string.Format("Schedule for the output '{0}'. Report '{1}'", Output.Name, Report.FilePath);
TaskDefinition definition = Task.Definition;
if (definition.RegistrationInfo.Source != TaskSource || definition.RegistrationInfo.Description != description || TaskName != Task.Name)
{
definition.RegistrationInfo.Source = TaskSource;
definition.RegistrationInfo.Description = description;
//If name has changed, we have to delete then insert it again...
string oldName = Task.Name;
if (!string.IsNullOrEmpty(oldName) && TaskName != oldName)
{
Report.TaskFolder.DeleteTask(oldName);
RegisterTaskDefinition(definition); }
else
{
_task.RegisterChanges();
}
}
}