コード例 #1
0
        /// <summary>
        /// Confirms or cancels the order, OR removes an item from the order
        /// </summary>
        /// <param name="sender">button</param>
        /// <param name="e">left mouse down</param>
        public void uxButton_Click(object sender, RoutedEventArgs e)
        {
            Button button = (Button)sender;

            if (button.Name == "Finalize")
            {
                MessageBox.Show("Receipt Printed");
                PaymentViewModel pvm       = (PaymentViewModel)this.DataContext;
                OrderList        currOrder = (OrderList)this.ancestor.openSpace.DataContext;
                PrintReceipt     pn        = new PrintReceipt(currOrder);
                pn.PrintReceiptCash(pvm.CurrentChangeDue);
                pvm.FinishSale();
                this.ancestor.openSpace2.Child       = new OrderSideBar.Order(this.ancestor);
                this.ancestor.openSpace.DataContext  = new OrderList();
                this.ancestor.openSpace2.DataContext = this.ancestor.openSpace.DataContext;
                this.ancestor.SwitchScreen(Screen.Empty);
            }
            if (button.Name == "Cancel")
            {
                this.ancestor.openSpace2.Child       = new OrderSideBar.Order(this.ancestor);
                this.ancestor.openSpace.DataContext  = new OrderList();
                this.ancestor.openSpace2.DataContext = this.ancestor.openSpace.DataContext;
                this.ancestor.SwitchScreen(Screen.Empty);
            }
        }
コード例 #2
0
        public void uxButton_Click(object sender, RoutedEventArgs e)
        {
            Button button = (Button)sender;

            if (button.Name == "Cash")
            {
                this.ancestor.openSpace2.Child = new OrderSideBar.Order(this.ancestor);
                this.ancestor.screens.Remove(Screen.CashPayment);
                this.ancestor.screens.Add(Screen.CashPayment, new CashPayment(this.ancestor));
                this.ancestor.SwitchScreen(Screen.CashPayment);
            }
            if (button.Name == "CreditDebit")
            {
                OrderList             o      = (OrderList)this.ancestor.openSpace.DataContext;
                CardTransactionResult result = CardReader.RunCard(o.Total);
                MessageBox.Show(result.ToString());
                if (result == CardTransactionResult.Approved)
                {
                    MessageBox.Show("Receipt Printed");
                    PrintReceipt pn = new PrintReceipt(o);
                    pn.PrintReceiptCard();


                    this.ancestor.openSpace2.Child       = new OrderSideBar.Order(this.ancestor);
                    this.ancestor.openSpace.DataContext  = new OrderList();
                    this.ancestor.openSpace2.DataContext = this.ancestor.openSpace.DataContext;
                    this.ancestor.SwitchScreen(Screen.Empty);
                }
            }
        }