private CustomRecurrenceTask GetRecurrence(IGanttTask task, int index) { CustomRecurrenceTask taskToReturn = null; var recurrenceTask = task as CustomRecurrenceTask; if (recurrenceTask != null && recurrenceTask.RecurrenceRule != null) { var start = new DateTime(recurrenceTask.RecurrenceRule.Start.Ticks + index * recurrenceTask.RecurrenceRule.Interval.Ticks); var end = start + (recurrenceTask.End - recurrenceTask.Start); taskToReturn = new CustomRecurrenceTask(start, end, "recurrence " + (index + 1).ToString()); } return taskToReturn; }
private CustomRecurrenceTask GetRecurrence(IGanttTask task, int index) { CustomRecurrenceTask taskToReturn = null; var recurrenceTask = task as CustomRecurrenceTask; if (recurrenceTask != null && recurrenceTask.RecurrenceRule != null) { var start = new DateTime(recurrenceTask.RecurrenceRule.Start.Ticks + index * recurrenceTask.RecurrenceRule.Interval.Ticks); var end = start + (recurrenceTask.End - recurrenceTask.Start); taskToReturn = new CustomRecurrenceTask(start, end, "recurrence " + (index + 1).ToString()); } return(taskToReturn); }
public IDependency AddDependency(IGanttTask fromTask, DependencyType type) { var dependency = new Dependency() { FromTask = fromTask, Type = type }; this.Dependencies.Add(dependency); return dependency; }
private static void RemoveChild(IList<IGanttTask> items, IGanttTask targetTask) { for (var i = 0; i < items.Count; i++) { if (items[i] == targetTask) { items.RemoveAt(i); break; } else { RemoveChild((items[i] as GanttTask).Children, targetTask); } } }
private static IEnumerable<IGanttTask> GetAllChildren(IGanttTask task) { return Telerik.Windows.Core.EnumerableExtensions.Append(task.Children.OfType<IGanttTask>(), task.Children.OfType<IGanttTask>().SelectMany(GetAllChildren)); }
private static void RemoveRelations(IList<IGanttTask> tasks, IGanttTask targetItem) { foreach (var child in tasks.OfType<GanttTask>()) { var relationsToRemove = child.Dependencies.OfType<IDependency>().Where(rel => rel.FromTask == targetItem).ToList(); foreach (var rel in relationsToRemove) { child.Dependencies.Remove(rel); } RemoveRelations(child.Children, targetItem); } }
public static GanttTask FindParent(IList<IGanttTask> items, IGanttTask task) { GanttTask parent = null; foreach (GanttTask item in items) { if (!item.IsSummary) { break; } if (item.Children.Contains(task)) { parent = item; break; } else { parent = FindParent(item.Children, task); } } return parent; }