예제 #1
0
        public bool SelectTask(String text, UIExtension.SelectTask selectTask, bool caseSensitive, bool wholeWord, bool findReplace)
        {
            if (text == String.Empty)
            {
                return(false);
            }

            switch (selectTask)
            {
            case UIExtension.SelectTask.SelectFirstTask:
                // TODO
                break;

            case UIExtension.SelectTask.SelectNextTask:
                // TODO
                break;

            case UIExtension.SelectTask.SelectNextTaskInclCurrent:
                // TODO
                break;

            case UIExtension.SelectTask.SelectPrevTask:
                // TODO
                break;

            case UIExtension.SelectTask.SelectLastTask:
                // TODO
                break;
            }

            // all else
            return(false);
        }
        public bool SelectMatch(String words, UIExtension.SelectTask selectTask, bool caseSensitive, bool wholeWord, bool findReplace)
        {
            if (Items.Count == 0)
            {
                return(false);
            }

            if (SelectedIndices.Count == 0)
            {
                SelectedIndices.Add(0);
            }

            int selIndex   = SelectedIndices[0];
            int matchIndex = -1;

            switch (selectTask)
            {
            case UIExtension.SelectTask.SelectFirstTask:
                matchIndex = FindTask(words, 0, true, caseSensitive, wholeWord, findReplace);
                break;

            case UIExtension.SelectTask.SelectNextTask:
                matchIndex = FindTask(words, (selIndex + 1), true, caseSensitive, wholeWord, findReplace);
                break;

            case UIExtension.SelectTask.SelectNextTaskInclCurrent:
                matchIndex = FindTask(words, selIndex, true, caseSensitive, wholeWord, findReplace);
                break;

            case UIExtension.SelectTask.SelectPrevTask:
                matchIndex = FindTask(words, (selIndex - 1), false, caseSensitive, wholeWord, findReplace);
                break;

            case UIExtension.SelectTask.SelectLastTask:
                matchIndex = FindTask(words, (Items.Count - 1), false, caseSensitive, wholeWord, findReplace);
                break;
            }

            if (matchIndex != -1)
            {
                SelectedIndices.Clear();
                SelectedIndices.Add(matchIndex);

                EnsureSelectionVisible();
                return(true);
            }

            return(false);
        }
        public bool SelectTask(String text, UIExtension.SelectTask selectTask, bool caseSensitive, bool wholeWord, bool findReplace)
        {
            if (text == String.Empty)
            {
                return(false);
            }

            if (!findReplace)
            {
                var words = CloudTaskItem.ToWords(text);

                if (!words.Any())
                {
                    return(false);
                }

                if (!m_WordCloud.SelectedWordMatches(words, caseSensitive, wholeWord))
                {
                    var matches = m_WordCloud.Match(words, false);

                    if (matches.Any())
                    {
                        m_WordCloud.SelectedWord = matches.First().Text;
                        return(true);
                    }

                    return(false);
                }
            }

            // Then on the match list
            if (m_TaskMatchesList.SelectMatch(text, selectTask, caseSensitive, wholeWord, findReplace))
            {
                return(true);
            }

            // all else
            return(false);
        }
        public bool SelectTask(String text, UIExtension.SelectTask selectTask, bool caseSensitive, bool wholeWord, bool findReplace)
        {
            if ((text == String.Empty) || IsEmpty())
            {
                return(false);
            }

            TreeNode node    = null;          // start node
            bool     forward = true;

            switch (selectTask)
            {
            case UIExtension.SelectTask.SelectFirstTask:
                node = RootNode.Nodes[0];
                break;

            case UIExtension.SelectTask.SelectNextTask:
                node = TreeCtrl.GetNextItem(SelectedNode);
                break;

            case UIExtension.SelectTask.SelectNextTaskInclCurrent:
                node = SelectedNode;
                break;

            case UIExtension.SelectTask.SelectPrevTask:
                node = TreeCtrl.GetPrevItem(SelectedNode);

                if ((node == null) || ((node == RootNode) && !NodeIsTask(RootNode)))
                {
                    node = LastNode;
                }

                forward = false;
                break;

            case UIExtension.SelectTask.SelectLastTask:
                node    = LastNode;
                forward = false;
                break;
            }

            // Avoid recursion
            while (node != null)
            {
                if (StringUtil.Find(node.Text, text, caseSensitive, wholeWord))
                {
                    SelectedNode = node;
                    return(true);
                }

                if (forward)
                {
                    node = TreeCtrl.GetNextItem(node);
                }
                else
                {
                    node = TreeCtrl.GetPrevItem(node);
                }
            }

            return(false);
        }
예제 #5
0
 public bool SelectTask(String text, UIExtension.SelectTask selectTask, bool caseSensitive, bool wholeWord, bool findReplace)
 {
     return(m_DayView.SelectTask(text, selectTask, caseSensitive, wholeWord, findReplace));
 }