示例#1
0
 private void ExecuteGoToStateAction(Model m, GoToStateAction action)
 {
     //Change State
     PrevActionSceneStateMap[m] = ActionSceneStateMap[m];
     ActionSceneStateMap[m]     = action.State;
     ActionsExecutedInState[m]  = new List <GMDL.Action>(); //Reset executed actions
 }
        public void Invoke_UseTransitionsIsFalse_TransitionsAreNotUsed()
        {
            Grid                   stateGrid       = VisualStateHelper.CreateObjectWithStates <Grid>();
            GoToStateAction        goToStateAction = CreateTestGoToStateAction();
            VisualStateManagerStub vsm             = VisualStateHelper.AttachCustomVSM(stateGrid);
            StubTrigger            trigger         = AttachAction(goToStateAction, stateGrid);

            goToStateAction.StateName      = VisualStateHelper.ArbitraryThirdStateName;
            goToStateAction.UseTransitions = false;
            trigger.FireStubTrigger();

            Assert.IsTrue(vsm.LastUseTransitions.HasValue && !vsm.LastUseTransitions.Value, "UseTransitions should be respected by the GoToState call.");
        }
        public void Invoke_TargetObjectSet_CallsGoToStateOnTarget()
        {
            UserControl            statefulUC      = VisualStateHelper.CreateObjectWithStates <UserControl>();
            Grid                   statefulGrid    = VisualStateHelper.CreateObjectWithStates <Grid>();
            VisualStateManagerStub gridVSM         = VisualStateHelper.AttachCustomVSM(statefulGrid);
            Grid                   childGrid       = CreateEmptyGrid();
            GoToStateAction        goToStateAction = CreateTestGoToStateAction();
            StubTrigger            trigger         = AttachAction(goToStateAction, childGrid);

            // set up the tree structure
            statefulUC.Content = childGrid;

            // target the action and set the StateName
            goToStateAction.TargetObject = statefulGrid;
            goToStateAction.StateName    = VisualStateHelper.ArbitraryThirdStateName;

            trigger.FireStubTrigger();
            Assert.AreEqual(gridVSM.LastStateName, VisualStateHelper.ArbitraryThirdStateName, "test");
        }