Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
        /// <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);
        }
Ejemplo n.º 4
0
        /// <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));
        }
Ejemplo n.º 5
0
        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);
            }
        }
Ejemplo n.º 6
0
        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;
                }
            }
        }