Пример #1
0
        private void PopActiveBehavior()
        {
            ToolBehavior activeBehavior = this.ActiveBehavior;

            if (activeBehavior == null)
            {
                throw new InvalidOperationException(ExceptionStringTable.EventRouterCannotPopBehavior);
            }
            this.behaviorStack.Pop();
            activeBehavior.Suspend();
            activeBehavior.Detach();
        }
Пример #2
0
 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;
 }
Пример #4
0
        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();
        }
Пример #5
0
        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);
        }
Пример #6
0
 public OnlyUpdateCursorToken(ToolBehavior toolBehavior)
 {
     this.toolBehavior = toolBehavior;
     this.toolBehavior.IsOnlyUpdatingCursor = true;
 }
Пример #7
0
        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));
        }
Пример #8
0
 public bool ContainsBehavior(ToolBehavior toolBehavior)
 {
     return(this.behaviorStack.Contains(toolBehavior));
 }