Esempio n. 1
0
        void btn_Click(object sender, RoutedEventArgs e)
        {
            PosButton posButton = sender as PosButton;
            // object keyValue = posButton.Tag;
            // MessageBox.Show(posButton.KeyCode.ToString());
            string keyCode = posButton.KeyCode.ToString();

            Hashtable table     = PosContext.Instance.KeysById;
            PosEvent  posEvent1 = (PosEvent)table[keyCode];

            if (posEvent1 != null)
            {
                //posEvent1.Engage(posButton.KeyValue);
                if (posEvent1.isDialog)
                {
                    PosContext.Instance.PosKeyValue = posButton.KeyValue;
                    PosDialogEvent posDialog = posEvent1 as PosDialogEvent;
                    posDialog.PushState(posDialog.StartState); //Assume "0" as the default state
                    PosEventStack.Instance.PushEvent(posEvent1);
                    PosEventStack.Instance.NextEvent();
                }
                else
                {
                    posEvent1.Engage(posButton.KeyValue);
                }
            }

            //PnlInput input = PosContext.Instance.PosPrompt as PnlInput;
            //input.InputControl.Focus();
            //_contrainer.get
        }
Esempio n. 2
0
        void btn_Click(object sender, RoutedEventArgs e)
        {
            PosButton posButton = sender as PosButton;

            //MessageBox.Show(posButton.KeyCode.ToString());

            string keyCode = posButton.KeyCode.ToString();

            Hashtable table     = PosContext.Instance.KeysById;
            PosEvent  posEvent1 = (PosEvent)table[keyCode];

            if (posEvent1 != null)
            {
                // posEvent1.Engage(posButton.KeyValue);

                if (posEvent1.isDialog)
                {
                    PosContext.Instance.PosKeyValue = posButton.KeyValue;
                    PosDialogEvent posDialog = posEvent1 as PosDialogEvent;
                    posDialog.PushState(posDialog.StartState);
                    PosEventStack.Instance.PushEvent(posEvent1);
                    PosEventStack.Instance.NextEvent();
                }
                else
                {
                    posEvent1.Engage(posButton.KeyValue);
                }
            }
        }
Esempio n. 3
0
        public void NextEvent()
        {
            //this.Dump();

            PosEvent posEvent      = null;
            PosEvent posEventCheck = this.CurrentEvent;


            //Engage the pos error until Clear Key is pressed
            if (this.CurrentEvent is PosError)
            {
                this.CurrentEvent.Engage(0);
                return;
            }

            try
            {
                // if this is a dialog pop it's state stack and invoke
                // the current event

                if (this.CurrentPosEvent().isDialog)
                {
                    PosDialogEvent dialog = this.CurrentPosEvent() as PosDialogEvent;

                    // if there are state events pop

                    if (dialog.States().PendingCount > 0)
                    {
                        posEvent = this.CurrentPosEvent();
                    }
                    else
                    {
                        // if there are no state events in the dialog
                        // pop the entire event, and engage the next one
                        this.PopEvent();
                        //posEvent = PopEvent ();
                        posEvent = this.CurrentPosEvent(); //this.Peek();
                    }
                }
                else
                {
                    posEvent = this.PopEvent();
                }

                posEvent.Engage(0);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
                Logger.Error(this.GetType().FullName, this.GetType().FullName + ":" + e.ToString(), e);
            }
        }