Exemplo n.º 1
0
 public bool DoesTransitionMatch(TransitionModel model)
 {
     if (model.FromStateName != null)
     {
         return(model.FromStateName == this.Name);
     }
     return(this.Name == model.ToStateName);
 }
Exemplo n.º 2
0
 private void ParkTransition(TransitionModel transition)
 {
     if (this.parkedTransitions == null)
     {
         this.parkedTransitions = new List <TransitionModel>();
     }
     this.parkedTransitions.Add(transition);
 }
Exemplo n.º 3
0
        public void AddTransitionModel(TransitionModel model)
        {
            bool flag = false;

            foreach (StateModel stateModel in (Collection <StateModel>) this.states)
            {
                if (stateModel.DoesTransitionMatch(model))
                {
                    stateModel.AddTransitionModel(model);
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                this.ParkTransition(model);
            }
            if (this.DefaultTransition == model && !model.IsDefaultTransition)
            {
                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");
            }
            if (!model.IsDefaultTransition || this.DefaultTransition.TransitionSceneNode != null && this.DefaultTransition.TransitionSceneNode.ShouldSerialize && this.DefaultTransition.TransitionSceneNode.IsAttached)
            {
                return;
            }
            if (this.DefaultTransition.TransitionSceneNode == null)
            {
                this.parkedTransitions.Remove(this.DefaultTransition);
                this.DefaultTransition.ParentModel = (ModelBase)null;
                this.DefaultTransition.GroupModel  = (StateGroupModel)null;
            }
            this.DefaultTransition = model;
            this.NotifyPropertyChanged("DefaultTransition");
        }
Exemplo n.º 4
0
 public void AddTransitionModel(TransitionModel model)
 {
     model.ParentModel = (ModelBase)this;
     if (model.ToStateName == this.Name)
     {
         this.transitions.Insert(0, model);
     }
     else if (this.transitions.Count > 0 && string.IsNullOrEmpty(this.transitions[this.transitions.Count - 1].ToStateName))
     {
         this.transitions.Insert(this.transitions.Count - 1, model);
     }
     else
     {
         this.transitions.Add(model);
     }
     this.NotifyHasPotentialTransitionsChanged();
 }
Exemplo n.º 5
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");
        }
Exemplo n.º 6
0
 public void RemoveTransitionModel(TransitionModel model)
 {
     model.ParentModel = (ModelBase)null;
     this.transitions.Remove(model);
     this.NotifyHasPotentialTransitionsChanged();
 }
Exemplo n.º 7
0
 public void SelectTransition(TransitionModel transitionModel)
 {
     this.ModelManager.SelectTransition(transitionModel);
 }