예제 #1
0
        private static void SetSelectionPath(TemplateCallHierarchyViewModel treeView, ICollection <Template> selectionPath)
        {
            if (treeView == null || selectionPath == null || selectionPath.Count == 0 || treeView.Template != selectionPath.First())
            {
                return;
            }

            List <TemplateCallHierarchyViewModel> nodes = new List <TemplateCallHierarchyViewModel>();

            nodes.Add(treeView);

            TemplateCallHierarchyViewModel current = treeView;

            foreach (var template in selectionPath.Skip(1))
            {
                current = current.Children.FirstOrDefault(i => i.Template == template);
                if (current == null)
                {
                    return;
                }

                nodes.Add(current);
            }

            for (int i = 0; i < nodes.Count - 1; i++)
            {
                nodes[i].IsExpanded = true;
            }

            nodes[nodes.Count - 1].IsSelected = true;
        }
예제 #2
0
        private static void SetSelectionPath(TemplateCallHierarchyViewModel viewModel, ICollection <EvalTemplateEvent> selectionPath)
        {
            if (viewModel == null || selectionPath == null || selectionPath.Count == 0 || viewModel.Event != selectionPath.First())
            {
                return;
            }

            List <TemplateCallHierarchyViewModel> nodes = new List <TemplateCallHierarchyViewModel>();

            nodes.Add(viewModel);

            TemplateCallHierarchyViewModel current = viewModel;

            foreach (var @event in selectionPath.Skip(1))
            {
                current = current.Children.FirstOrDefault(i => i.Event == @event);
                if (current == null)
                {
                    return;
                }

                nodes.Add(current);
            }

            for (int i = 0; i < nodes.Count - 1; i++)
            {
                nodes[i].IsExpanded = true;
            }

            nodes[nodes.Count - 1].IsSelected = true;
        }
예제 #3
0
        private void HandleCallHierarchyTreeViewSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            TemplateCallHierarchyViewModel selected = CallHierarchyTreeView.SelectedItem as TemplateCallHierarchyViewModel;

            if (selected != null)
            {
                currentTemplate = selected.Template;
                UpdateCurrentTemplate();
            }
        }
예제 #4
0
        private int GetIndexOfChild(EvalTemplateEvent parent, EvalTemplateEvent child)
        {
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }
            if (child == null)
            {
                throw new ArgumentNullException("child");
            }

            TemplateCallHierarchyViewModel        hierarchy = new TemplateCallHierarchyViewModel(ViewModel.Visualizer.Interpreter, parent);
            List <TemplateCallHierarchyViewModel> children  = hierarchy.Children;

            return(children.FindIndex(i => i.Event == child));
        }