public override void ShowMainElement(TaskGraphItem item) { AbilitiModel ab = this.PersProperty.Abilitis.First(n => n.GUID == item.Uid); ab.EditAbility(); this.PersProperty.SellectedAbilityProperty = ab; }
/// <summary> /// The linkwith qwests. /// </summary> /// <param name="task"> /// The task. /// </param> /// <param name="taskVertex"> /// The task vertex. /// </param> private void linkwithQwests(Task task, TaskGraphItem taskVertex) { List <Aim> aimLinks = new List <Aim>(); foreach (TaskGraphItem aimItem in aimLinks.Select(abilLink => this.TasksGraphProperty.AllVertices.First(n => n.Uid == abilLink.GUID))) { this.TasksGraphProperty.AddEdge( new Edge <TaskGraphItem>(taskVertex, aimItem, new Arrow()) { Minlen = this.minlen }); } }
/// <summary> /// The link with abilitis. /// </summary> /// <param name="task"> /// The task. /// </param> /// <param name="taskVertex"> /// The task vertex. /// </param> private void linkWithAbilitis(Task task, TaskGraphItem taskVertex) { List <AbilitiModel> abilityLinks = new List <AbilitiModel>(); foreach (TaskGraphItem abItem in abilityLinks.Select(abilLink => this.TasksGraphProperty.AllVertices.First(n => n.Uid == abilLink.GUID))) { this.TasksGraphProperty.AddEdge( new Edge <TaskGraphItem>(taskVertex, abItem, new Arrow()) { Minlen = this.minlen }); } }
/// <summary> /// Получить элемент задачи /// </summary> /// <param name="task"></param> /// <returns></returns> public static TaskGraphItem GetTaskGraphItem(Task task) { var fromString = (Color)ColorConverter.ConvertFromString((string)task.Cvet); SolidColorBrush convertFromString = new SolidColorBrush((Color)fromString); TaskGraphItem taskGraphItem = new TaskGraphItem() { Name = task.NameOfProperty, ImageProperty = null, Type = "задача", Uid = task.GUID, IsQwest = false, Color = task.IsDelProperty ? Brushes.Yellow : Brushes.White, BorderColor = (Brush)convertFromString }; return(taskGraphItem); }
public override void buildGraph(List <Task> _onlyThisTasks = null) { this.TasksGraphProperty = null; this.TasksGraphProperty = new Graph <TaskGraphItem>() { Rankdir = RankDirection.BottomToTop }; var selAbility = StaticMetods.PersProperty.SellectedAbilityProperty; // Добавляем скилл TaskGraphItem taskGraphQwest = new TaskGraphItem() { Name = selAbility.NameOfProperty, ImageProperty = selAbility.ImageProperty, Type = "Квест", Uid = selAbility.GUID, IsQwest = true, Color = Brushes.LimeGreen, BorderColor = Brushes.DarkSlateGray }; this.TasksGraphProperty.AddVertex(taskGraphQwest); // Добавляем задачи к скиллу var tasksWithoutParrents = (from needTaskse in selAbility.NeedTasks where needTaskse.TaskProperty.NextActions.Any(n => selAbility.NeedTasks.Any(q => q.TaskProperty == n)) == false select needTaskse).ToList(); foreach (var tasksWithoutParrent in tasksWithoutParrents) { var taskGraphItem = GetTaskGraphItem(tasksWithoutParrent.TaskProperty); this.TasksGraphProperty.AddVertex(taskGraphItem); this.TasksGraphProperty.AddEdge( new Edge <TaskGraphItem>(taskGraphItem, taskGraphQwest, new Arrow()) { Label = "+" }); } var prevActionTasks = selAbility.NeedTasks.Except(tasksWithoutParrents); foreach (var prevTaske in prevActionTasks) { var taskGraphItem = GetTaskGraphItem(prevTaske.TaskProperty); this.TasksGraphProperty.AddVertex(taskGraphItem); } // Строим остальные связи // Строим остальные связи this.buildLincs( this.PersProperty.Tasks, this.PersProperty.Characteristics, this.PersProperty.Abilitis, this.PersProperty.Aims, this.TasksGraphProperty); OnPropertyChanged(nameof(TasksGraphProperty)); }
/// <summary> /// The link with characteristics. /// </summary> /// <param name="task"> /// The task. /// </param> /// <param name="taskVertex"> /// The task vertex. /// </param> private void linkWithCharacteristics(Task task, TaskGraphItem taskVertex) { }
/// <summary> /// Построить колонки /// </summary> /// <param name="_onlyThisTasks"> /// Отображать только эти задачи /// </param> private void buildLevelsTasks(List <Task> _onlyThisTasks) { int tasksCounter = 0; // Удаляем требования, которые были удалены из задач if (_onlyThisTasks != null) { List <Task> taskToDel = _onlyThisTasks.Where(onlyThisTask => this.PersProperty.Tasks.Count(n => n == onlyThisTask) == 0) .ToList(); foreach (var task in taskToDel) { _onlyThisTasks.Remove(task); } } // Строим уровни с задачами if (_onlyThisTasks == null) { // Для всех задач foreach (IGrouping <int, Task> tasks in this.PersProperty.Tasks.OrderByDescending(n => n.LevelProperty).GroupBy(n => n.LevelProperty)) { int taskLevel = tasks.First().LevelProperty; SubGraph <TaskGraphItem> columnSubGraph = new SubGraph <TaskGraphItem> { Label = taskLevel.ToString() }; foreach (Task task in tasks) { TaskGraphItem taskGraphItem = new TaskGraphItem() { Level = task.LevelProperty, Name = task.NameOfProperty, ImageProperty = task.ImageProperty, Type = "задача", Color = Brushes.White, Uid = task.GUID }; columnSubGraph.AddVertex(taskGraphItem); } this.TasksGraphProperty.AddSubGraph(columnSubGraph); } } else { // Для связанных задач foreach (IGrouping <int, Task> tasks in _onlyThisTasks.OrderByDescending(n => n.LevelProperty).GroupBy(n => n.LevelProperty)) { int taskLevel = tasks.First().LevelProperty; SubGraph <TaskGraphItem> columnSubGraph = new SubGraph <TaskGraphItem> { Label = taskLevel.ToString() }; foreach (Task task in tasks) { TaskGraphItem taskGraphItem = GetTaskGraphItem(task); columnSubGraph.AddVertex(taskGraphItem); } this.TasksGraphProperty.AddSubGraph(columnSubGraph); } } // Добавляем связи между уровнями for (int i = this.TasksGraphProperty.SubGraphs.Count() - 1; i > 0; i--) { Edge <SubGraph <TaskGraphItem> > edge = new Edge <SubGraph <TaskGraphItem> >( this.TasksGraphProperty.SubGraphs.ElementAt(i), this.TasksGraphProperty.SubGraphs.ElementAt(i - 1), new ArrowLevels()) { Minlen = 2 }; this.TasksGraphProperty.AddEdge(edge); } }
/// <summary> /// Показать главный элемент /// </summary> /// <param name="item"></param> public virtual void ShowMainElement(TaskGraphItem item) { }