Esempio n. 1
0
        private void btnWafflesMinus_Click(object sender, RoutedEventArgs e)
        {
            int waffles = wm.RemoveWaffle();

            lblWaffleNum.Content    = waffles;
            lblChocolateNum.Content = wm.GetChocolateWaffleCount();
        }
        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";
        }
Esempio n. 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();
            }
        }