Пример #1
0
        /// <summary>
        /// Confirms the selection from the intellisense, and write the selected text back to the textbox.
        /// </summary>
        public void ConfirmIntellisense()
        {
            string wordSelected;

            try
            {
                wordSelected = ((IntellisenseListItem)m_IntellisenseBox.SelectedItem).Tag.ToString();
                //switch (_operate)
                //{
                //    case InsertOperate.InsertNodeName:
                //        _node.Name = wordSelected;
                //        break;
                //    case InsertOperate.InsertAttrName:
                //        (_args.Segment as AttrValueSegment).Attribute.Name = wordSelected;
                //        break;
                //    case InsertOperate.InsertAttrValue:
                //        (_args.Segment as AttrValueSegment).Attribute.Value = wordSelected;
                //        break;
                //}
            }
            catch
            {
                return;
            }

            Line line = m_editor.GetLine(m_editor.Caret.Line);

            if (line != null)
            {
                switch (wordSelected)
                {
                case "dmRef":

                    break;

                case "pmRef":

                    break;
                }

                line.Insert(m_editor.Caret.Column, wordSelected, m_editor.Caret);
            }
            ////Get the actual position
            //int currentPosition = m_editor.SelectionStart;
            ////Get the start position of the last word
            //int lastWordPosition = GetLastWordStartPosition(m_editor, m_editor.CodeWords_ScopeOperators);

            ////Set selection
            //m_editor.SelectionStart = lastWordPosition;
            //m_editor.SelectionLength = currentPosition - lastWordPosition;

            ////Change the word
            //m_editor.SelectedText = wordSelected;

            //Hide the intellisense
            HideIntellisenseBox();
        }