Ejemplo n.º 1
0
        private void FlagSearchMatches()
        {
            if (string.IsNullOrEmpty(SearchTerm))
            {
                foreach (MarkedTreeNode mnode in MarkedTreeNodes)
                {
                    mnode.SearchMatch = false;
                }
                return;
            }
            bool atLeastOneFound = false;

            foreach (MarkedTreeNode mnode in MarkedTreeNodes)
            {
                bool found = !string.IsNullOrEmpty(mnode.Description) &&
                             mnode.Description.IndexOf(SearchTerm, StringComparison.OrdinalIgnoreCase) >= 0;
                mnode.SearchMatch = found;
                if (found)
                {
                    atLeastOneFound = true;
                }
            }

            if (atLeastOneFound)
            {
                MarkedTreeNode sw = FindNext(false);
                if (sw == null)
                {
                    sw = FindPrevious(false);
                }
            }
        }
Ejemplo n.º 2
0
        public MarkedTreeNode FindPrevious(bool select)
        {
            MarkedTreeNode previousMatch = FindPrevMarkers(m_MarkedTreeNodes);

            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);
        }
        //public UIElement ViewControl
        //{
        //    get { return this; }
        //}
        //public UIElement ViewFocusStart
        //{
        //    get { return ListView; }
        //}


        private void handleListCurrentSelection()
        {
            MarkedTreeNode mnode = ListView.SelectedItem as MarkedTreeNode;

            if (mnode == null)
            {
                return;
            }
            TreeNode treeNode = mnode.TreeNode;

            if (treeNode == null)
            {
                return;
            }


            //m_Logger.Log("-- PublishEvent [TreeNodeSelectedEvent] MarkersPanelView.OnMarkersSelected", Category.Debug, Priority.Medium);

            if (!m_UrakawaSession.isAudioRecording)
            {
                _ignoreTreeNodeSelectedEvent = true;
                m_UrakawaSession.PerformTreeNodeSelection(treeNode);
            }
            //m_EventAggregator.GetEvent<TreeNodeSelectedEvent>().Publish(treeNode);
        }
Ejemplo n.º 4
0
        public void RemoveMarkedTreeNode(TreeNode node)
        {
            MarkedTreeNode toRemove = null;

            foreach (MarkedTreeNode markedTreeNode in MarkedTreeNodes)
            {
                if (markedTreeNode.TreeNode == node)
                {
                    toRemove = markedTreeNode;
                    break;
                }
            }
            if (toRemove != null)
            {
                MarkedTreeNodes.Remove(toRemove);
            }
        }
Ejemplo n.º 5
0
        private static MarkedTreeNode FindPrevMarkers(ObservableCollection <MarkedTreeNode> pages)
        {
            MarkedTreeNode pResult   = null;
            int            iStarting = -1;

            for (int i = pages.Count - 1; i >= 0; i--)
            {
                if (pages[i].SearchMatch && iStarting == -1)
                {
                    iStarting = i;
                }
                if (!pages[i].IsSelected)
                {
                    continue;
                }
                iStarting = i;
                break;
            }
            if (iStarting < 0)
            {
                return(null);
            }
            if (!pages[iStarting].IsSelected && pages[iStarting].SearchMatch)
            {
                pResult = pages[iStarting];
            }
            if (pResult == null)
            {
                for (int i = iStarting - 1; i >= 0; i--)
                {
                    if (!pages[i].SearchMatch)
                    {
                        continue;
                    }
                    pResult = pages[i];
                    break;
                }
            }
            return(pResult);
        }