Ejemplo n.º 1
0
 public CustomPose Build(string name = "custompose") {
     var gesture = new CustomPose(name);
     foreach (var itemState in _items) {
         var item = itemState.What;
         var state = itemState.Trigger;
         int id = gesture.AddFlag();
         switch (state) {
             case State.Opened:
                 item.Opened += () => gesture.Flag(id, true);
                 item.Closed += () => gesture.Flag(id, false);
                 break;
             case State.Closed:
                 item.Closed += () => gesture.Flag(id, true);
                 item.Opened += () => gesture.Flag(id, false);
                 break;
             case State.Visible:
                 item.Visible += () => gesture.Flag(id, true);
                 item.NotVisible += () => gesture.Flag(id, false);
                 break;
             case State.NotVisible:
                 item.NotVisible += () => gesture.Flag(id, true);
                 item.Visible += () => gesture.Flag(id, false);
                 break;
             default:
                 throw new ArgumentOutOfRangeException();
         }
     }
     _items.Clear();
     return gesture;
 }
Ejemplo n.º 2
0
        public CustomPose Build(string name = "custompose")
        {
            var gesture = new CustomPose(name);

            foreach (var itemState in _items)
            {
                var item  = itemState.What;
                var state = itemState.Trigger;
                int id    = gesture.AddFlag();
                switch (state)
                {
                case State.Opened:
                    item.Opened += () => gesture.Flag(id, true);
                    item.Closed += () => gesture.Flag(id, false);
                    break;

                case State.Closed:
                    item.Closed += () => gesture.Flag(id, true);
                    item.Opened += () => gesture.Flag(id, false);
                    break;

                case State.Visible:
                    item.Visible    += () => gesture.Flag(id, true);
                    item.NotVisible += () => gesture.Flag(id, false);
                    break;

                case State.NotVisible:
                    item.NotVisible += () => gesture.Flag(id, true);
                    item.Visible    += () => gesture.Flag(id, false);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
            _items.Clear();
            return(gesture);
        }