public HierarchyObject(string uniqueId, string name, TaskObject parent, TaskObject node) : base(uniqueId, name) { this.Parent = parent; this.CurrentNode = node; this.Children = new ObservableCollection<TaskObject>(); }
public bool AddTaskNode(HierarchyObject taskRelations, TaskObject taskToAdd, LevelObject levelToAddTo) { bool added = false; if (_allLevels.Count > 0) { foreach (LevelObject item in _allLevels) { if (item.UniqueId.Equals(levelToAddTo.UniqueId)) { bool valid = true; foreach (HierarchyTaskObject items in item.LevelCollection) { if (taskRelations.UniqueId == items.hierarchyObj.UniqueId && taskToAdd.UniqueId == items.taskObj.UniqueId) { valid = false; } } if(valid == true) { HierarchyTaskObject TO = new HierarchyTaskObject(Guid.NewGuid().ToString(), taskRelations.Name+taskToAdd.Name); TO.hierarchyObj = taskRelations; TO.taskObj = taskToAdd; AddToLevel(levelToAddTo, TO); added = true; break; } } } } return added; }
private void UpdateLists(TaskObject taskObject) { if (taskObject.IsRunning) { if (!RunningTasks.Contains(taskObject)) { RunningTasks.Add(taskObject); } if (NotRunningTasks.Contains(taskObject)) { NotRunningTasks.Remove(taskObject); } } else { if (!NotRunningTasks.Contains(taskObject)) { NotRunningTasks.Add(taskObject); } if (RunningTasks.Contains(taskObject)) { RunningTasks.Remove(taskObject); } } }
public void UpdateTask(TaskObject taskObject) { ShowHelpText = true; if (taskObject.IsVisible) { ShowHelpText = false; if (taskObject.Deleted) { NotRunningTasks.Remove(taskObject); RunningTasks.Remove(taskObject); } else { UpdateLists(taskObject); } } ShowHelpTextTasks = NotRunningTasks.Count == 0; }
public static void CreateHierachyTaskObject(bool isCategory, TaskObject taskCreated) { HierarchyObject hierarchyNodeMetaData = new HierarchyObject(Guid.NewGuid().ToString(), "hierarchyObject_", null, taskCreated); if (isCategory == true) { _appDataSource.NodeManager.AddTaskNode(hierarchyNodeMetaData, taskCreated, _appDataSource.NodeManager.GetAllLevels[0]); } else { _appDataSource.NodeManager.AddTaskNode(hierarchyNodeMetaData, taskCreated, _appDataSource.NodeManager.GetAllLevels[1]); } }
public static string AddTask(string taskName, bool working, int level, string comment, bool isCategory, string id = null, bool isVisible = true) { string newID = id; if (newID == null) { newID = Guid.NewGuid().ToString(); } TaskObject taskCreated = new TaskObject(taskName, newID.ToString(), comment, working, isVisible); CreateHierachyTaskObject(isCategory, taskCreated); _appDataSource.TotalTasks.Add(taskCreated); return taskCreated.UniqueId; }