コード例 #1
0
        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;
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        public IDependency AddDependency(IGanttTask fromTask, DependencyType type)
		{
			var dependency = new Dependency() { FromTask = fromTask, Type = type };
			this.Dependencies.Add(dependency);
			return dependency;
		}
コード例 #4
0
		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);
				}
			}
		}
コード例 #5
0
		private static IEnumerable<IGanttTask> GetAllChildren(IGanttTask task)
		{
			return Telerik.Windows.Core.EnumerableExtensions.Append(task.Children.OfType<IGanttTask>(), task.Children.OfType<IGanttTask>().SelectMany(GetAllChildren));
		}
コード例 #6
0
		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);
			}
		}
コード例 #7
0
		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;
		}