当前位置: 首页>>代码示例>>C#>>正文


C# TextArea.EndUpdate方法代码示例

本文整理汇总了C#中TextArea.EndUpdate方法的典型用法代码示例。如果您正苦于以下问题:C# TextArea.EndUpdate方法的具体用法?C# TextArea.EndUpdate怎么用?C# TextArea.EndUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TextArea的用法示例。


在下文中一共展示了TextArea.EndUpdate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

		/// <remarks>
		/// Executes this edit action
		/// </remarks>
		/// <param name="textArea">The <see cref="ItextArea"/> which is used for callback purposes</param>
		public override void Execute(TextArea textArea)
		{
			if (textArea.Document.ReadOnly) {
				return;
			}
			if (textArea.SelectionManager.HasSomethingSelected) {
				foreach (ISelection selection in textArea.SelectionManager.SelectionCollection) {
					int startLine = selection.StartPosition.Y;
					int endLine   = selection.EndPosition.Y;
					if (startLine != endLine) {
						textArea.BeginUpdate();
						InsertTabs(textArea.Document, selection, startLine, endLine);
						textArea.Document.UpdateQueue.Clear();
						textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.LinesBetween, startLine, endLine));
						textArea.EndUpdate();
					} else {
						InsertTabAtCaretPosition(textArea);
						break;
					}
				}
				textArea.Document.OnUpdateCommited();
				textArea.AutoClearSelection = false;
			} else {
				InsertTabAtCaretPosition(textArea);
			}
		}
开发者ID:tangxuehua,项目名称:DataStructure,代码行数:30,代码来源:MiscActions.cs

示例2: Execute

        /// <remarks>
        /// Executes this edit action
        /// </remarks>
        /// <param name="textArea">The <see cref="ItextArea"/> which is used for callback purposes</param>
        public override void Execute(TextArea textArea)
        {
            if (textArea.SelectionManager.HasSomethingSelected) {
                Delete.DeleteSelection(textArea);
            } else {
                if (textArea.Caret.Offset > 0 && !textArea.IsReadOnly(textArea.Caret.Offset - 1)) {
                    textArea.BeginUpdate();
                    int curLineNr     = textArea.Document.GetLineNumberForOffset(textArea.Caret.Offset);
                    int curLineOffset = textArea.Document.GetLineSegment(curLineNr).Offset;

                    if (curLineOffset == textArea.Caret.Offset) {
                        LineSegment line = textArea.Document.GetLineSegment(curLineNr - 1);
                        int lineEndOffset = line.Offset + line.Length;
                        int lineLength = line.Length;
                        textArea.Document.Remove(lineEndOffset, curLineOffset - lineEndOffset);
                        textArea.Caret.Position = new TextLocation(lineLength, curLineNr - 1);
                        textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.PositionToEnd, new TextLocation(0, curLineNr - 1)));
                    } else {
                        int caretOffset = textArea.Caret.Offset - 1;
                        textArea.Caret.Position = textArea.Document.OffsetToPosition(caretOffset);
                        textArea.Document.Remove(caretOffset, 1);

                        textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.PositionToLineEnd, new TextLocation(textArea.Caret.Offset - textArea.Document.GetLineSegment(curLineNr).Offset, curLineNr)));
                    }
                    textArea.EndUpdate();
                }
            }
        }
开发者ID:umabiel,项目名称:WsdlUI,代码行数:32,代码来源:MiscActions.cs

示例3: Execute

 public override void Execute(TextArea textArea)
 {
     textArea.BeginUpdate();
     if (textArea.SelectionManager.HasSomethingSelected) {
         foreach (ISelection selection in textArea.SelectionManager.SelectionCollection) {
             Convert(textArea.Document, selection.Offset, selection.Length);
         }
     } else {
         Convert(textArea.Document, 0, textArea.Document.TextLength);
     }
     textArea.Caret.ValidateCaretPos();
     textArea.EndUpdate();
     //textArea.Refresh();
 }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:14,代码来源:FormatActions.cs

示例4: Execute

        /// <remarks>
        /// Executes this edit action
        /// </remarks>
        /// <param name="textArea">The <see cref="ItextArea"/> which is used for callback purposes</param>
        public override void Execute(TextArea textArea)
        {
            if (textArea.Document.ReadOnly) {
                return;
            }
            if (textArea.SelectionManager.HasSomethingSelected) {
                textArea.BeginUpdate();
                textArea.Caret.Position = textArea.SelectionManager.SelectionCollection[0].StartPosition;
                textArea.SelectionManager.RemoveSelectedText();
                textArea.ScrollToCaret();
                textArea.EndUpdate();
            } else {
                if (textArea.Caret.Offset > 0) {
                    textArea.BeginUpdate();
                    int curLineNr     = textArea.Document.GetLineNumberForOffset(textArea.Caret.Offset);
                    int curLineOffset = textArea.Document.GetLineSegment(curLineNr).Offset;

                    if (curLineOffset == textArea.Caret.Offset) {
                        LineSegment line = textArea.Document.GetLineSegment(curLineNr - 1);
                        bool lastLine = curLineNr == textArea.Document.TotalNumberOfLines;
                        int lineEndOffset = line.Offset + line.Length;
                        int lineLength = line.Length;
                        textArea.Document.Remove(lineEndOffset, curLineOffset - lineEndOffset);
                        textArea.Caret.Position = new Point(lineLength, curLineNr - 1);
                        textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.PositionToEnd, new Point(0, curLineNr - 1)));
                        textArea.EndUpdate();
                    } else {
                        int caretOffset = textArea.Caret.Offset - 1;
                        textArea.Caret.Position = textArea.Document.OffsetToPosition(caretOffset);
                        textArea.Document.Remove(caretOffset, 1);

            //						textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.PositionToLineEnd, new Point(textArea.Caret.Offset - textArea.Document.GetLineSegment(curLineNr).Offset, curLineNr)));
                        textArea.EndUpdate();
                    }
                }
            }
        }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:41,代码来源:MiscActions.cs

示例5: Execute

		public override void Execute(TextArea textArea)
		{
			if (textArea.SelectionManager.SelectionIsReadonly) {
				return;
			}
			this.textArea = textArea;
			textArea.BeginUpdate();
			textArea.Document.UndoStack.StartUndoGroup();
			if (textArea.SelectionManager.HasSomethingSelected) {
				foreach (ISelection selection in textArea.SelectionManager.SelectionCollection) {
					Convert(textArea.Document, selection.StartPosition.Y, selection.EndPosition.Y);
				}
			} else {
				Convert(textArea.Document, 0, textArea.Document.TotalNumberOfLines - 1);
			}
			textArea.Document.UndoStack.EndUndoGroup();
			textArea.Caret.ValidateCaretPos();
			textArea.EndUpdate();
			textArea.Refresh();
		}
开发者ID:Shaykh,项目名称:Loyc,代码行数:20,代码来源:FormatActions.cs

示例6: Execute

        /// <remarks>
        /// Executes this edit action
        /// </remarks>
        /// <param name="textArea">The <see cref="TextArea"/> which is used for callback purposes</param>
        public override void Execute(TextArea textArea)
        {
            if (textArea.Document.ReadOnly)
            {
                return;
            }
            textArea.BeginUpdate();
            textArea.Document.UndoStack.StartUndoGroup();
            try
            {
                if (textArea.HandleKeyPress('\n'))
                    return;

                textArea.InsertString(Environment.NewLine);

                int curLineNr = textArea.Caret.Line;
                textArea.Document.FormattingStrategy.FormatLine(textArea, curLineNr, textArea.Caret.Offset, '\n');
                textArea.SetDesiredColumn();

                textArea.Document.UpdateQueue.Clear();
                textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.PositionToEnd, new TextLocation(0, curLineNr - 1)));
            }
            finally
            {
                textArea.Document.UndoStack.EndUndoGroup();
                textArea.EndUpdate();
            }
        }
开发者ID:KindDragon,项目名称:ICSharpCode.TextEditor.V4,代码行数:32,代码来源:MiscActions.cs

示例7: DeleteSelection

 internal static void DeleteSelection(TextArea textArea)
 {
     Debug.Assert(textArea.SelectionManager.HasSomethingSelected);
     if (textArea.SelectionManager.SelectionIsReadonly)
         return;
     textArea.BeginUpdate();
     textArea.Caret.Position = textArea.SelectionManager.StartPosition;
     textArea.SelectionManager.RemoveSelectedText();
     textArea.ScrollToCaret();
     textArea.EndUpdate();
 }
开发者ID:KindDragon,项目名称:ICSharpCode.TextEditor.V4,代码行数:11,代码来源:MiscActions.cs

示例8: Execute

        /// <summary>
        /// Executes the action on a certain <see cref="TextArea"/>.
        /// </summary>
        /// <param name="textArea">The text area on which to execute the action.</param>
        public override void Execute(TextArea textArea)
        {
            if (textArea.Document.ReadOnly)
            return;

              string comment = null;
              if (textArea.Document.HighlightingStrategy.Properties.ContainsKey("LineComment"))
            comment = textArea.Document.HighlightingStrategy.Properties["LineComment"];

              if (String.IsNullOrEmpty(comment))
            return;

              textArea.Document.UndoStack.StartUndoGroup();

              if (textArea.SelectionManager.HasSomethingSelected)
              {
            bool shouldComment = true;
            foreach (ISelection selection in textArea.SelectionManager.Selections)
            {
              if (!ShouldComment(textArea.Document, comment, selection, selection.StartPosition.Y, selection.EndPosition.Y))
              {
            shouldComment = false;
            break;
              }
            }

            foreach (ISelection selection in textArea.SelectionManager.Selections)
            {
              textArea.BeginUpdate();
              if (shouldComment)
            SetCommentAt(textArea.Document, comment, selection, selection.StartPosition.Y, selection.EndPosition.Y);
              else
            RemoveCommentAt(textArea.Document, comment, selection, selection.StartPosition.Y, selection.EndPosition.Y);

              textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.LinesBetween, firstLine, lastLine));
              textArea.EndUpdate();
            }
            textArea.Document.CommitUpdate();
            textArea.AutoClearSelection = false;
              }
              else
              {
            textArea.BeginUpdate();
            int caretLine = textArea.Caret.Line;
            if (ShouldComment(textArea.Document, comment, null, caretLine, caretLine))
              SetCommentAt(textArea.Document, comment, null, caretLine, caretLine);
            else
              RemoveCommentAt(textArea.Document, comment, null, caretLine, caretLine);

            textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, caretLine));
            textArea.EndUpdate();
              }
              textArea.Document.UndoStack.EndUndoGroup();
        }
开发者ID:cavaliercoder,项目名称:expression-lab,代码行数:58,代码来源:MiscActions.cs

示例9: Execute

    /// <summary>
    /// Executes the action on a given <see cref="TextArea"/>.
    /// </summary>
    /// <param name="textArea">The text area on which to execute the action.</param>
    public override void Execute(TextArea textArea)
    {
      if (textArea.SelectionManager.SelectionIsReadonly)
        return;

      _textArea = textArea;
      textArea.BeginUpdate();
      textArea.Document.UndoStack.StartUndoGroup();
      if (textArea.SelectionManager.HasSomethingSelected)
      {
        foreach (ISelection selection in textArea.SelectionManager.Selections)
          Convert(textArea.Document, selection.Offset, selection.Length);
      }
      else
      {
        Convert(textArea.Document, 0, textArea.Document.TextLength);
      }
      textArea.Document.UndoStack.EndUndoGroup();
      textArea.EndUpdate();
      textArea.Refresh();
    }
开发者ID:sanyaade-fintechnology,项目名称:SquareOne,代码行数:25,代码来源:FormatActions.cs


注:本文中的TextArea.EndUpdate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。