Exemplo n.º 1
0
        private void FillCodeFragments()
        {
            foreach (var compilationUnit in _project.CompilationUnits)
            {
                foreach (var cl in compilationUnit.Classes)
                {
                    var clItem = new CodeFragmentViewModel(cl);
                    CodeFragments.Add(clItem);

                    foreach (var method in cl.Children)
                    {
                        var mItem = new CodeFragmentViewModel(method);
                        clItem.AddChild(mItem);
                    }
                }
            }

            UpdateCodeFragments();
        }
Exemplo n.º 2
0
        private void SelectNextFragment()
        {
            var nextCodeFragment = FlatList.Find(CurrentCodeFragment)?.Next?.Value;

            if (nextCodeFragment != null)
            {
                if (!CodeFragments.Contains(nextCodeFragment))
                {
                    //if the next code fragment is not at the root level, set the root level parent to active
                    var parent = FindRelatedParent(nextCodeFragment);
                    if (parent != null)
                    {
                        parent.IsActive = true;
                    }
                }

                nextCodeFragment.IsSelected = true;
            }
        }
Exemplo n.º 3
0
        private void SelectPreviousFragment()
        {
            var previousCodeFragment = FlatList.Find(CurrentCodeFragment).Previous.Value;

            if (previousCodeFragment != null)
            {
                if (!CodeFragments.Contains(previousCodeFragment))
                {
                    //if the next code fragment is not at the root level, set the root level parent to active
                    var parent = FindRelatedParent(previousCodeFragment);
                    if (parent != null)
                    {
                        parent.IsActive = true;
                    }
                }

                previousCodeFragment.IsSelected = true;
            }
        }
Exemplo n.º 4
0
 private CodeFragmentViewModel FindRelatedParent(CodeFragmentViewModel codeFragment)
 {
     return(CodeFragments.Where(x => x.Children.Contains(codeFragment)).FirstOrDefault());
 }