void LoadReceipt()
        {
            WaffleMachine wm             = WaffleMachine.Get_Instance();
            float         wafflePrice    = wm.CalculateWaffleTotal();
            float         chocolatePrice = wm.CalculateChocolateTotal();
            float         total          = wm.CalculateTotal();

            if (wafflePrice > 0)
            {
                lblWafflesCount.Visibility = Visibility.Visible;
                lblWafflesPrice.Visibility = Visibility.Visible;

                lblWafflesCount.Content = "Waffles x" + wm.GetWaffleCount();
                lblWafflesPrice.Content = wafflePrice + " EGP";
            }
            if (chocolatePrice > 0)
            {
                lblChocolateCount.Visibility = Visibility.Visible;
                lblChocolatePrice.Visibility = Visibility.Visible;

                lblChocolateCount.Content = "Chocolate x" + wm.GetChocolateWaffleCount();
                lblChocolatePrice.Content = chocolatePrice + " EGP";
            }

            lblTotalPrice.Content     = total + " EGP";
            lblTotalPriceDesc.Content = total + " EGP";
        }
Example #2
0
 private void btnConfirm_Click(object sender, RoutedEventArgs e)
 {
     if (wm.GetWaffleCount() > 0)
     {
         PaymentScreen ps = new PaymentScreen();
         ps.Visibility = Visibility.Visible;
         Close();
     }
 }
Example #3
0
        public WelcomeScreen()
        {
            InitializeComponent();

            lblWaffleNum.Content    = wm?.GetWaffleCount();
            lblChocolateNum.Content = wm?.GetChocolateWaffleCount();

            lblWafflePrice.Content    = wm.WafflePrice + " EGP each";
            lblChocolatePrice.Content = wm.ChocolatePrice + " EGP each";
        }
        private async void RequestNewOrder(string referenceNum, float amount)
        {
            WaffleApiIntegrator integrator = new WaffleApiIntegrator();
            WaffleMachine       wm         = WaffleMachine.Get_Instance();

            WaffleApiIntegrator.NewOrderResponse response = await integrator.RequestWaffleOrder(wm.GetWaffleCount(), wm.GetChocolateWaffleCount(), referenceNum, amount);

            if (response.statusCode != System.Net.HttpStatusCode.OK || !response.accepted || response.orderId == -1)
            {
                ErrorScreen es = new ErrorScreen();
                es.ShowActivated = true;
                es.Show();
                Close();
            }
            else
            {
                WaitingScreen ws = new WaitingScreen(response.orderId);
                ws.ShowActivated = true;
                ws.Show();
                Close();
            }
        }