private void PopActiveBehavior() { ToolBehavior activeBehavior = this.ActiveBehavior; if (activeBehavior == null) { throw new InvalidOperationException(ExceptionStringTable.EventRouterCannotPopBehavior); } this.behaviorStack.Pop(); activeBehavior.Suspend(); activeBehavior.Detach(); }
protected void PushBehavior(ToolBehavior toolBehavior) { if (toolBehavior == null) { throw new ArgumentNullException("toolBehavior"); } if (this.eventRouter == null || this.eventRouter.ActiveBehavior != this) { throw new InvalidOperationException(ExceptionStringTable.ToolBehaviorCannotPushUnlessActive); } toolBehavior.sceneInsertionPoint = this.sceneInsertionPoint; this.eventRouter.PushBehavior(toolBehavior); }
private void RemoveActiveModifierKeyBehavior() { if (this.activeModifierKeyBehaviorFactory == null) { return; } for (ToolBehavior activeBehavior = this.eventRouter.ActiveBehavior; activeBehavior != this.activeModifierKeyBehavior; activeBehavior = this.eventRouter.ActiveBehavior) { this.eventRouter.PopBehavior(); } this.eventRouter.PopBehavior(); this.eventRouter.ActiveBehavior.ToolBehaviorContext.ToolManager.OverrideTool = (Tool)null; this.activeModifierKeyBehavior = (ToolBehavior)null; this.activeModifierKeyBehaviorFactory = (IModifierKeyBehaviorFactory)null; }
public void PushBehavior(ToolBehavior newActiveBehavior) { if (newActiveBehavior == null) { throw new ArgumentNullException("newActiveBehavior"); } ToolBehavior activeBehavior = this.ActiveBehavior; if (activeBehavior != null) { activeBehavior.Suspend(); } this.behaviorStack.Push(newActiveBehavior); newActiveBehavior.Attach(this); this.ResumeActiveBehavior(); }
protected virtual bool OnButtonDownOverAdorner(IAdorner adorner) { ToolBehavior behavior = adorner.AdornerSet.Behavior; if (behavior == null) { return(false); } AdornedToolBehavior adornedToolBehavior = behavior as AdornedToolBehavior; if (adornedToolBehavior != null) { adornedToolBehavior.SetActiveAdorner(adorner); } this.PushBehavior(behavior); return(true); }
public OnlyUpdateCursorToken(ToolBehavior toolBehavior) { this.toolBehavior = toolBehavior; this.toolBehavior.IsOnlyUpdatingCursor = true; }
public ToolBehavior CreateToolBehavior(ToolBehaviorContext behaviorContext) { ToolBehavior moveBehavior = (ToolBehavior) new RelocateBehavior(behaviorContext); return((ToolBehavior) new ElementEditorBehavior(behaviorContext, false, true, true, true, false, ToolCursors.SelectionCursor, ToolCursors.SelectElementCursor, ToolCursors.RelocateCursor, moveBehavior)); }
public bool ContainsBehavior(ToolBehavior toolBehavior) { return(this.behaviorStack.Contains(toolBehavior)); }