示例#1
0
        public void TogglePinState(StateModel stateModel)
        {
            StateModel pinnedState = this.PinnedState;

            if (this.PinnedState != null)
            {
                this.ModelManager.UnpinState(this, this.PinnedState);
            }
            if (pinnedState == stateModel)
            {
                return;
            }
            this.ModelManager.PinState(this, stateModel);
        }
示例#2
0
 private void UpdateParkedTransitionsForState(StateModel model)
 {
     if (this.parkedTransitions == null)
     {
         return;
     }
     this.parkedTransitions.RemoveAll((Predicate <TransitionModel>)(transition =>
     {
         if (!model.DoesTransitionMatch(transition))
         {
             return(false);
         }
         model.AddTransitionModel(transition);
         return(true);
     }));
 }
示例#3
0
 public void RemoveStateModel(StateModel model)
 {
     if (this.states.Contains(model))
     {
         this.states.Remove(model);
         foreach (TransitionModel transition in (Collection <TransitionModel>)model.Transitions)
         {
             this.ParkTransition(transition);
             transition.ParentModel = (ModelBase)null;
         }
     }
     foreach (StateModel stateModel in (Collection <StateModel>) this.StateModels)
     {
         stateModel.NotifyHasPotentialTransitionsChanged();
     }
 }
示例#4
0
        public void AddStateModel(StateModel model)
        {
            List <string> predefinedNames = new List <string>();

            if (ModelBase.stateAndStateGroupsPredefinedOrder.ContainsKey(this.Name))
            {
                predefinedNames = ModelBase.stateAndStateGroupsPredefinedOrder[this.Name];
            }
            this.states.Insert(ModelBase.GetInsertionIndex <StateModel>(model, (Collection <StateModel>) this.States, predefinedNames, (Microsoft.Expression.DesignSurface.ViewModel.SceneNode) this.SceneNode), model);
            model.ParentModel = (ModelBase)this;
            this.UpdateParkedTransitionsForState(model);
            foreach (StateModel stateModel in (Collection <StateModel>) this.StateModels)
            {
                stateModel.NotifyHasPotentialTransitionsChanged();
            }
        }
示例#5
0
        private static SceneNode GetSceneNode(ModelBase item)
        {
            StateModel stateModel = item as StateModel;

            if (stateModel != null)
            {
                return((SceneNode)stateModel.SceneNode);
            }
            StateGroupModel stateGroupModel;

            if ((stateGroupModel = item as StateGroupModel) != null)
            {
                return((SceneNode)stateGroupModel.SceneNode);
            }
            return((SceneNode)null);
        }
示例#6
0
        public void RemoveTransitionModel(TransitionModel model)
        {
            StateModel stateModel = model.StateModel;

            if (stateModel != null)
            {
                stateModel.RemoveTransitionModel(model);
                model.ParentModel = (ModelBase)null;
                model.GroupModel  = (StateGroupModel)null;
            }
            else
            {
                this.parkedTransitions.Remove(model);
            }
            if (model.GroupModel == null || model != model.GroupModel.DefaultTransition || model.TransitionSceneNode != null && model.TransitionSceneNode.ShouldSerialize && model.TransitionSceneNode.IsAttached)
            {
                return;
            }
            TransitionModel transitionModel = this.parkedTransitions.Find((Predicate <TransitionModel>)(transition =>
            {
                if (string.IsNullOrEmpty(transition.FromStateName))
                {
                    return(string.IsNullOrEmpty(transition.ToStateName));
                }
                return(false);
            }));

            if (transitionModel == null)
            {
                this.DefaultTransition = new TransitionModel((VisualStateTransitionSceneNode)null, this);
                this.parkedTransitions.Add(this.DefaultTransition);
            }
            else
            {
                this.DefaultTransition = transitionModel;
            }
            this.NotifyPropertyChanged("DefaultTransition");
        }
示例#7
0
 public void SelectState(StateModel stateModel)
 {
     this.ModelManager.SelectState(this, stateModel);
 }
示例#8
0
 public PotentialTransitionModel(StateModel fromModel, StateModel toModel)
 {
     this.fromModel = fromModel;
     this.toModel   = toModel;
 }