示例#1
0
        private void _processNextSymbol(LiteralType literal)
        {
            List <State <LiteralType> > nextStates = _currentStates.Select(
                x => x.GetNext(literal)).Aggregate(
                new List <State <LiteralType> >(),
                (acum, x) => acum.Concat(x).ToList());

            if (nextStates.Count == 0)
            {
                _isBroken = true;
            }
            _currentStates = nextStates;
            ChangeStateDelegate temp_ch = StateChahged;

            if (temp_ch != null)
            {
                temp_ch(_currentStates);
            }

            _isFinal = !_isBroken && _currentStates.Any(x => x.IsFinalState);


            FinalStateAchivedDelegate temp = FinalStateAchived;

            if (temp != null && _isFinal)
            {
                temp();
            }
        }
示例#2
0
        private void DoAlterations(Operation op, Order order)
        {
            switch (op)
            {
            case Operation.New:
                LvAddDelegate lvAdd  = itemListView.Items.Add;
                ListViewItem  lvItem = new ListViewItem(new[]
                {
                    order.Id.ToString(), order.Product.Description, order.Product.Price.ToString(),
                    order.Quantity.ToString(), order.State.ToString()
                });
                lvItem.BackColor = Color.LightSalmon;
                BeginInvoke(lvAdd, lvItem);
                break;

            case Operation.Change:
                ChangeStateDelegate changeState = ChangeAnOrder;
                BeginInvoke(changeState, order);
                break;

            case Operation.Remove:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(op), op, null);
            }
        }
示例#3
0
        private void DoAlterations(Operation op, Order order)
        {
            if (order.Product.Type != _barKitchenController._productType)
            {
                return;
            }

            switch (op)
            {
            case Operation.New:
                LvAddDelegate lvAdd  = notPickedListView.Items.Add;
                ListViewItem  lvItem = new ListViewItem(new[]
                {
                    order.Id.ToString(), order.Product.Description, order.Quantity.ToString(),
                    order.State.ToString()
                });
                BeginInvoke(lvAdd, lvItem);
                break;

            case Operation.Change:
                ChangeStateDelegate changeState = ChangeAnOrder;
                BeginInvoke(changeState, order);
                break;

            case Operation.Remove:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(op), op, null);
            }
        }
示例#4
0
 private PlayInstantSettingPolicy(
     string name,
     string description,
     IsCorrectStateDelegate isCorrectState,
     ChangeStateDelegate changeState)
 {
     Name           = name;
     Description    = description;
     IsCorrectState = isCorrectState;
     ChangeState    = changeState;
 }
        private void AddMenuItem(string label, ChangeStateDelegate changeStateDelegate)
        {
            var l = new LinkLabel(_page, "MenuItem" + (_lasttabposition.X ^ _lasttabposition.Y), _lasttabposition);

            l.Text          = label;
            l.Body.Position = new Vector2(100, (_lasttabposition.Y * (l.Body.Height + 10) + 100));
            l.Render.Layer  = .2f;
            l.OnReleased   += control => changeStateDelegate();
            l.OnReleased   += control => Destroy(this);

            _lasttabposition.Y++;

            if (l.TabPosition == Point.Zero)
            {
                l.OnFocusGain();
            }
        }
        //ivan


        public PCUWriter(Compiler compiler, ChangeStateDelegate changeState) 
		{
            ChangeState += changeState;
            this.compiler = compiler;
            AllWriters.Add(this);
        }
        public PCUReader(Compiler comp, ChangeStateDelegate changeState) 
		{
			this.comp = comp;
            AllReaders.Add(this);
            ChangeState += changeState;
		}
        private void AddMenuItem(string label, ChangeStateDelegate changeStateDelegate)
        {
            var l = new LinkLabel(_page, "MenuItem" + (_lasttabposition.X ^ _lasttabposition.Y), _lasttabposition);

            l.Text = label;
            l.Body.Position = new Vector2(100, (_lasttabposition.Y * (l.Body.Height + 10) + 100));
            l.Render.Layer = .2f;
            l.OnReleased += control => changeStateDelegate();
            l.OnReleased += control => Destroy(this);

            _lasttabposition.Y++;

            if (l.TabPosition == Point.Zero) l.OnFocusGain();
        }
示例#9
0
 public void SetChangeState(ChangeStateDelegate changeState)
 {
     ChangeState = changeState;
 }