Example #1
0
        bool IsActive(ChoiceActionItem choiceActionItem)
        {
            var xpoStateMachine = (choiceActionItem.Data as IStateMachine);

            if (xpoStateMachine != null)
            {
                var boolList = new BoolList(true, BoolListOperatorType.Or);
                boolList.BeginUpdate();
                foreach (var item in choiceActionItem.Items)
                {
                    var xpoTransition        = ((XpoTransition)item.Data);
                    var choiceActionItemArgs = new ChoiceActionItemArgs(xpoTransition, item.Active);
                    OnRequestActiveState(choiceActionItemArgs);
                    boolList.SetItemValue(xpoTransition.Oid.ToString(), item.Active.ResultValue);
                }
                boolList.EndUpdate();
                return(boolList.ResultValue);
            }
            var transition = choiceActionItem.Data as XpoTransition;

            if (transition != null)
            {
                var choiceActionItemArgs = new ChoiceActionItemArgs(transition, choiceActionItem.Active);
                OnRequestActiveState(choiceActionItemArgs);
                return(choiceActionItem.Active);
            }
            throw new NotImplementedException();
        }
 void SyncStates(string id, BoolList boolList, Dictionary <string, BoolList> boolLists)
 {
     if (boolLists.ContainsKey(id))
     {
         var list = boolLists[id];
         boolList.BeginUpdate();
         if (list.GetKeys().FirstOrDefault() != null)
         {
             boolList.Clear();
             foreach (var key in list.GetKeys())
             {
                 boolList.SetItemValue(key, list[key]);
             }
         }
         boolList.EndUpdate();
     }
 }