public void Dispose() { dirtiableActionMap.Clear(); actionStack.Undone -= ActionItemsAddedOrChanged; actionStack.Redone -= ActionItemsAddedOrChanged; actionStack.ActionItemsAdded -= ActionItemsAddedOrChanged; actionStack.ActionItemsCleared -= ActionItemsCleared; actionStack.ActionItemsDiscarded -= ActionItemsDiscarded; actionStack = null; }
public void Dispose() { dirtiableActionMap.Clear(); actionStack.Undone -= ActionItemsAddedOrChanged; actionStack.Redone -= ActionItemsAddedOrChanged; actionStack.ActionItemsAdded -= ActionItemsAddedOrChanged; actionStack.ActionItemsCleared -= ActionItemsCleared; actionStack.ActionItemsDiscarded -= ActionItemsDiscarded; actionStack = null; }
public DirtiableManager(IActionStack actionStack) { if (actionStack == null) throw new ArgumentNullException(nameof(actionStack)); this.actionStack = actionStack; actionStack.Undone += ActionItemsAddedOrChanged; actionStack.Redone += ActionItemsAddedOrChanged; actionStack.ActionItemsAdded += ActionItemsAddedOrChanged; actionStack.ActionItemsCleared += ActionItemsCleared; actionStack.ActionItemsDiscarded += ActionItemsDiscarded; }
/// <inheritdoc/> public virtual void Activate(DocumentEditorContext context, IActionStack actionStack) { Activate(context.Selection, context.CaretMovementMode, context.IsSelectionExtendActive ? SelectionMode.Extend : SelectionMode.Replace); if (!ShouldPreserveCaretMovementMode) { context.CaretMovementMode.SetModeToNone(); } }
/// <inheritdoc /> public void Activate(DocumentEditorContext context, IActionStack actionStack) { TextBlock previous; TextBlock next; if (!TryGetTextBlocks(context, out previous, out next)) { return; } actionStack.Do(new MergeTextBlockAction(previous, next, context.Selection)); }
public DirtiableManager(IActionStack actionStack) { if (actionStack == null) { throw new ArgumentNullException(nameof(actionStack)); } this.actionStack = actionStack; actionStack.Undone += ActionItemsAddedOrChanged; actionStack.Redone += ActionItemsAddedOrChanged; actionStack.ActionItemsAdded += ActionItemsAddedOrChanged; actionStack.ActionItemsCleared += ActionItemsCleared; actionStack.ActionItemsDiscarded += ActionItemsDiscarded; }
/// <summary> /// Initializes a new instance of the <see cref="CancellableCommand"/> class. /// </summary> /// <param name="serviceProvider">A service provider that can provide a <see cref="IActionStack"/> to use for this view model.</param> /// <param name="dirtiables">The <see cref="IDirtiableViewModel"/> instances associated to this command.</param> protected CancellableCommand(IViewModelServiceProvider serviceProvider, IEnumerable <IDirtiableViewModel> dirtiables) : base(serviceProvider) { actionStack = serviceProvider.Get <IActionStack>(); this.dirtiables = dirtiables; }
/// <inheritdoc/> public void Activate(DocumentEditorContext context, IActionStack actionStack) { actionStack.Do(new ConvertTextBlockIntoHeadingAction((TextCaret)context.Selection.Start, _level)); }
/// <inheritdoc/> public void Activate(DocumentEditorContext context, IActionStack actionStack) { actionStack.Do(new ConvertIntoParagraphAction((TextCaret)context.Selection.Start)); }
/// <inheritdoc /> void IContextualCommand <string> .Activate(DocumentEditorContext context, IActionStack actionStack, string text) { // TODO delete any text that is selected actionStack.Do(new InsertTextUndoableAction(context.Selection, text)); }
/// <inheritdoc/> void IContextualCommand.Activate(DocumentEditorContext context, IActionStack actionStack) { context.UndoStack.Redo(); }
/// <inheritdoc /> public void Activate(DocumentEditorContext context, IActionStack actionStack) { var caret = (TextCaret)context.Selection.Start; actionStack.Do(new DeletePreviousCharacterAction(caret)); }
/// <inheritdoc /> void IContextualCommand.Activate(DocumentEditorContext context, IActionStack actionStack) { // TODO delete any text that is selected actionStack.Do(new BreakTextBlockAction(context.Selection)); }
/// <inheritdoc /> public void Activate(DocumentEditorContext context, IActionStack actionStack) { actionStack.Do(new DeleteNextCharacterAction((TextCaret)context.Selection.Start)); }