bool FindMatch() { MatchResult match; PathElement destination; if (TaskFinder.TaskFromMatch(currentElement, previousMatch, out match)) { StartMatch(match); return(true); } else if (TaskFinder.TaskFromPathElement(currentElement, out match)) { StartMatch(match); return(true); } else if (TaskFinder.TaskFromConnections(currentElement, out destination, out match)) { if (destination != null) { SetDestination(destination); } else if (match != null) { StartMatch(match); } return(true); } else if (TaskFinder.NearestPairFromDisabledTask(currentElement, out destination)) { SetDestination(destination); return(true); } return(false); }
/// <summary> /// /// </summary> public void Initialize() { _taskType = TaskFinder.FindType(Task); if (_taskType == null) { return; } ServicesContainer.Current.Register <ITaskServicesContainer, TaskServicesContainer>(); ServicesContainer.Current.Register <IArgumentInitializer, ArgumentInitializer>(); TaskInitializer.Initialize(_taskType); }
/// <summary> /// /// </summary> /// <param name="task"></param> /// <returns></returns> public static BaseTaskDataEditor GetDataEditor(Task task) { var type = TaskFinder.FindType(task); var attr = type.GetCustomAttribute <TaskDataEditorAttribute>(); if (attr == null) { return(null); } return(ActivatorHelper.CreateInstance(attr.ViewType) as BaseTaskDataEditor); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TaskLibrary_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { var library = TaskLibrariesComboBox.SelectedValue as TaskLibraryInfo; if (library == null) { return; } TaskInfo.TaskLibraryPath = library.LibraryPath; var tasks = TaskFinder.GetTasksList(library.LibraryPath); TaskClassesComboBox.Items.Clear(); tasks.ForEach(f => TaskClassesComboBox.Items.Add(f)); }
void AssignPoint(PathElement elem) { MatchResult match; if (TaskFinder.TaskFromPathElement(elem, out match)) { Indicator.SetTask(match.Match); } else { Indicator.RemoveTask(); } if (elem != currentElement) { StopMatch(); SetDestination(elem); } }
void OnCompleteTask(PerformerTask task) { task.onComplete -= OnCompleteTask; PathElement destination; if (TaskFinder.PairFromTask(task, currentElement, previousElement, out destination)) { SetDestination(destination); } else if (!FindMatch()) { if (TaskFinder.NearestPathElementWithTask(currentElement, task, out destination)) { SetDestination(destination); } else { Idle = true; } } }