/// <summary> /// Initializes the control for the editing of a new <see cref="TaskDefinition"/>. /// </summary> /// <param name="service">A <see cref="TaskService"/> instance.</param> /// <param name="td">An optional <see cref="TaskDefinition"/>. Leaving null creates a new task.</param> public void Initialize(TaskService service, TaskDefinition td = null) { if (service == null) { throw new ArgumentNullException(nameof(service)); } if (!titleSet) { Text = string.Format(EditorProperties.Resources.TaskEditDlgTitle, "New Task", TaskEditDialog.GetServerString(service)); } TaskService = service; task = null; if (!this.IsDesignMode()) { if (td == null) { var temp = service.NewTask(); if (service.HighestSupportedVersion == new Version(1, 1)) { temp.Settings.Compatibility = TaskCompatibility.V1; } TaskDefinition = temp; } else { TaskDefinition = td; } } }
/// <summary> /// Initializes the control for the editing of an existing <see cref="Task"/>. /// </summary> /// <param name="task">A <see cref="Task"/> instance.</param> public void Initialize(Task task) { if (task == null) { throw new ArgumentNullException(nameof(task)); } if (!titleSet) { Text = string.Format(EditorProperties.Resources.TaskEditDlgTitle, task.Name, TaskEditDialog.GetServerString(task.TaskService)); } Task = task; }
/// <summary> /// Initializes the control for the editing of a new <see cref="TaskDefinition"/>. /// </summary> /// <param name="service">A <see cref="TaskService"/> instance.</param> /// <param name="td">An optional <see cref="TaskDefinition"/>. Leaving null creates a new task.</param> public void Initialize(TaskService service, TaskDefinition td = null) { if (service == null) { throw new ArgumentNullException("service"); } if (!titleSet) { this.Text = string.Format(EditorProperties.Resources.TaskEditDlgTitle, "New Task", TaskEditDialog.GetServerString(service)); } this.TaskService = service; this.task = null; if (!this.IsDesignMode()) { if (td == null) { this.TaskDefinition = service.NewTask(); } else { this.TaskDefinition = td; } } }