Esempio n. 1
0
        public DescribableTreeNode FindPrevious(bool select)
        {
            DescribableTreeNode previousMatch = FindPrevDescription(m_DescribableTreeNodes);

            if (previousMatch != null)
            {
                var listItem = VisualLogicalTreeWalkHelper.FindObjectInVisualTreeWithMatchingType <ListViewItem>(
                    m_view.ListView,
                    child =>
                {
                    object dc = child.GetValue(FrameworkElement.DataContextProperty);
                    return(dc != null && dc == previousMatch);
                });
                if (select)
                {
                    previousMatch.IsSelected = true;
                    if (listItem != null)
                    {
                        FocusHelper.FocusBeginInvoke(listItem); //m_view.m_LastListItemSelected
                    }
                }
                else
                {
                    if (listItem != null)
                    {
                        listItem.BringIntoView();
                    }
                }
            }
            else
            {
                AudioCues.PlayBeep();
            }
            return(previousMatch);
        }
Esempio n. 2
0
        private RecentFileWrapper FindPrevious(bool select)
        {
            RecentFileWrapper previousMatch = FindPrevSetting();

            if (previousMatch != null)
            {
                if (select)
                {
                    previousMatch.IsSelected = true;
                }
                else
                {
                    var listItem = VisualLogicalTreeWalkHelper.FindObjectInVisualTreeWithMatchingType <ListViewItem>(
                        RecentFilesList,
                        child =>
                    {
                        object dc = child.GetValue(FrameworkElement.DataContextProperty);
                        return(dc != null && dc == previousMatch);
                    });
                    if (listItem != null)
                    {
                        listItem.BringIntoView();
                    }
                }
            }
            else
            {
                AudioCues.PlayBeep();
            }
            return(previousMatch);
        }
Esempio n. 3
0
        public MarkedTreeNode FindNext(bool select)
        {
            MarkedTreeNode nextMatch = FindNextMarkers(m_MarkedTreeNodes);

            if (nextMatch != null)
            {
                var listItem = VisualLogicalTreeWalkHelper.FindObjectInVisualTreeWithMatchingType <ListViewItem>(
                    m_view.ListView,
                    child =>
                {
                    object dc = child.GetValue(FrameworkElement.DataContextProperty);
                    return(dc != null && dc == nextMatch);
                });
                if (select)
                {
                    nextMatch.IsSelected = true;
                    if (listItem != null)
                    {
                        FocusHelper.FocusBeginInvoke(listItem); //m_view.m_LastListItemSelected
                    }
                }
                else
                {
                    if (listItem != null)
                    {
                        listItem.BringIntoView();
                    }
                }
            }
            else
            {
                AudioCues.PlayBeep();
            }
            return(nextMatch);
        }
        public HeadingTreeNodeWrapper FindPrevious(bool select)
        {
            ExpandAll();

            HeadingTreeNodeWrapper prevMatch = FindPrevMatch(m_roots);

            if (prevMatch != null)
            {
                if (select)
                {
                    //prevMatch.IsSelected = true;
                    ViewModel.View.SelectTreeNodeWrapper(prevMatch, true);
                }
                else
                {
                    var treeViewItem = VisualLogicalTreeWalkHelper.FindObjectInVisualTreeWithMatchingType <TreeViewItem>(
                        ViewModel.View.TreeView,
                        child =>
                    {
                        object dc = child.GetValue(FrameworkElement.DataContextProperty);
                        return(dc != null && dc == prevMatch);
                    });
                    if (treeViewItem != null)
                    {
                        treeViewItem.BringIntoView();
                    }
                }
            }
            else
            {
                AudioCues.PlayBeep();
            }

            return(prevMatch);
        }
Esempio n. 5
0
        private SettingWrapper FindNext(bool select)
        {
            SettingWrapper nextMatch = FindNextSetting();

            if (nextMatch != null)
            {
                if (select)
                {
                    nextMatch.IsSelected = true;
                }
                else
                {
                    var listItem = VisualLogicalTreeWalkHelper.FindObjectInVisualTreeWithMatchingType <ListViewItem>(
                        SettingsList,
                        child =>
                    {
                        object dc = child.GetValue(FrameworkElement.DataContextProperty);
                        return(dc != null && dc == nextMatch);
                    });
                    if (listItem != null)
                    {
                        listItem.BringIntoView();
                    }
                }
            }
            else
            {
                AudioCues.PlayBeep();
            }
            return(nextMatch);
        }
Esempio n. 6
0
        public void CheckParseScanWalkUiTreeThing()
        {
            Stopwatch startRecursiveDepth = Stopwatch.StartNew();

            VisualLogicalTreeWalkHelper.GetElements(this, false, false, false);
            startRecursiveDepth.Stop();
            TimeSpan timeRecursiveDepth = startRecursiveDepth.Elapsed;

            Stopwatch startRecursiveLeaf = Stopwatch.StartNew();

            VisualLogicalTreeWalkHelper.GetElements(this, false, true, false);
            startRecursiveLeaf.Stop();
            TimeSpan timeRecursiveLeaf = startRecursiveLeaf.Elapsed;

            Stopwatch startNonRecursiveDepth = Stopwatch.StartNew();

            VisualLogicalTreeWalkHelper.GetElements(this, true, false, false);
            startNonRecursiveDepth.Stop();
            TimeSpan timeNonRecursiveDepth = startNonRecursiveDepth.Elapsed;

            Stopwatch startNonRecursiveLeaf = Stopwatch.StartNew();

            VisualLogicalTreeWalkHelper.GetElements(this, true, true, false);
            startNonRecursiveLeaf.Stop();
            TimeSpan timeNonRecursiveLeaf = startNonRecursiveLeaf.Elapsed;

#if DEBUG
            int nVisualLeafNoError  = ValidationErrorTreeSearch.CheckTreeWalking(this, false, true, false);
            int nVisualDepthNoError = ValidationErrorTreeSearch.CheckTreeWalking(this, false, false, false);

            int nLogicalLeafNoError  = ValidationErrorTreeSearch.CheckTreeWalking(this, false, true, true);
            int nLogicalDepthNoError = ValidationErrorTreeSearch.CheckTreeWalking(this, false, false, true);

            MessageBox.Show(String.Format(
                                "VisualLeafNoError={0}"
                                + Environment.NewLine
                                + "VisualDepthNoError={1}"
                                + Environment.NewLine
                                + "LogicalLeafNoError={2}"
                                + Environment.NewLine
                                + "LogicalDepthNoError={3}"
                                + Environment.NewLine + Environment.NewLine
                                + "timeNonRecursiveDepth={4}"
                                + Environment.NewLine
                                + "timeNonRecursiveLeaf={5}"
                                + Environment.NewLine
                                + "timeRecursiveDepth={6}"
                                + Environment.NewLine
                                + "timeRecursiveLeaf={7}"
                                + Environment.NewLine
                                , nVisualLeafNoError, nVisualDepthNoError, nLogicalLeafNoError, nLogicalDepthNoError, timeNonRecursiveDepth, timeNonRecursiveLeaf, timeRecursiveDepth, timeRecursiveLeaf));
#endif
        }
        private void SelectValidationItem(ValidationItem selection)
        {
            if (selection == null)
            {
                return;
            }

            DataTemplate template         = Tabs.ContentTemplate;
            var          contentPresenter = VisualLogicalTreeWalkHelper.FindObjectInVisualTreeWithMatchingType <ContentPresenter>(Tabs, null);
            var          list             = (ListBox)template.FindName("ValidationItemsListBox", contentPresenter);

            if (list != null)
            {
                list.SelectedItem = selection;
                list.ScrollIntoView(selection);
            }
        }
        private void SelectFirstInValidationItemsList()
        {
            DataTemplate template         = Tabs.ContentTemplate;
            var          contentPresenter = VisualLogicalTreeWalkHelper.FindObjectInVisualTreeWithMatchingType <ContentPresenter>(Tabs, null);

            if (contentPresenter == null)
            {
                return;
            }
            var list = (ListBox)template.FindName("ValidationItemsListBox", contentPresenter);

            if (list == null)
            {
                return;
            }

            if (list.Items.Count > 0)
            {
                list.SelectedItem = list.Items[0];
            }
        }