Ejemplo n.º 1
0
 private void goToDrink(object sender, NavigationEventArgs e)
 {
     if (drinkIds.Count > 0)
     {
         DrinkPage dp   = mainFrame.Content as DrinkPage;
         Grid      grid = dp.Content as Grid;
         var       ch   = grid.Children;
         foreach (var id in drinkIds)
         {
             foreach (var can in ch)
             {
                 Canvas c = can as Canvas;
                 if (Int32.Parse(c.Uid) == id)
                 {
                     c.Background = Brushes.LightGreen;
                 }
             }
         }
     }
     mainFrame.Navigated -= goToDrink;
 }
Ejemplo n.º 2
0
        private void backToDrinks(object sender, NavigationEventArgs e)
        {
            DrinkPage sp   = mainFrame.Content as DrinkPage;
            Grid      grid = sp.Content as Grid;
            var       ch   = grid.Children;

            foreach (var id in drinkIds)
            {
                foreach (var c in ch)
                {
                    Canvas can = c as Canvas;
                    if (Int32.Parse(can.Uid) == id)
                    {
                        can.Background = Brushes.LightGreen;
                    }
                }
            }


            nextButton.Content   = Application.Current.FindResource("Next") as string;
            mainFrame.Navigated -= backToDrinks;
        }
Ejemplo n.º 3
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            if (mainFrame.Source.ToString().Split('/')[2].Equals(typePage.ToString()))
            {
                TypePage tp   = mainFrame.Content as TypePage;
                var      grid = tp.Content as Grid;
                var      ch   = grid.Children;
                foreach (var can in ch)
                {
                    Canvas c = can as Canvas;
                    if (c.Background == Brushes.LightGreen)
                    {
                        type                 = c.Name.Substring(0, c.Name.Length - 6);
                        mainFrame.Source     = sizePage;
                        mainFrame.Navigated += goToSize;
                        return;
                    }
                }
            }



            else if (mainFrame.Source.ToString().Split('/')[2].Equals(sizePage.ToString()))
            {
                SizePage sp   = mainFrame.Content as SizePage;
                var      grid = sp.Content as Grid;
                var      ch   = grid.Children;
                foreach (var can in ch)
                {
                    Canvas c = can as Canvas;
                    if (c.Background == Brushes.LightGreen)
                    {
                        size                 = c.Name.Substring(0, c.Name.Length - 6);
                        mainFrame.Source     = sidePage;
                        mainFrame.Navigated += goToSide;
                        break;
                    }
                }
            }



            else if (mainFrame.Source.ToString().Split('/')[2].Equals(sidePage.ToString()))
            {
                SidePage sp   = mainFrame.Content as SidePage;
                var      grid = sp.Content as Grid;
                var      ch   = grid.Children;
                sideIds.Clear();
                foreach (var can in ch)
                {
                    Canvas c = can as Canvas;
                    if (c.Background == Brushes.LightGreen)
                    {
                        sideIds.Add(Int32.Parse(c.Uid));
                    }
                }



                mainFrame.Source     = drinkPage;
                mainFrame.Navigated += goToDrink;
            }
            else if (mainFrame.Source.ToString().Split('/')[2].Equals(drinkPage.ToString()))
            {
                DrinkPage dp   = mainFrame.Content as DrinkPage;
                var       grid = dp.Content as Grid;
                var       ch   = grid.Children;
                drinkIds.Clear();
                foreach (var can in ch)
                {
                    Canvas c = can as Canvas;
                    if (c.Background == Brushes.LightGreen)
                    {
                        drinkIds.Add(Int32.Parse(c.Uid));
                    }
                }

                mainFrame.Source     = locationPage;
                mainFrame.Navigated += goToLocation;
                nextButton.Content   = Application.Current.FindResource("Finish") as string;
            }

            else if (nextButton.Content.Equals(Application.Current.FindResource("Finish").ToString()))
            {
                LocationPage lp   = mainFrame.Content as LocationPage;
                var          grid = lp.Content as Grid;
                var          ch   = grid.Children;
                foreach (var can in ch)
                {
                    Canvas c = can as Canvas;
                    if (c.Background == Brushes.LightGreen)
                    {
                        location = c.Name.Substring(0, c.Name.Length - 6);
                        OrderModel om = new OrderModel()
                        {
                            drinkIds = new List <int>(drinkIds),
                            location = location,
                            sideIds  = new List <int>(sideIds),
                            size     = size,
                            type     = type,
                            staffId  = currentlyLogged.id,
                        };


                        //Thread t = new Thread(() => addOrder(om));
                        //t.SetApartmentState(ApartmentState.STA);
                        //t.Start();

                        nextButton.Content = Application.Current.FindResource("Next") as string;
                        mainFrame.Source   = typePage;
                        size     = null;
                        type     = null;
                        location = null;
                        drinkIds.Clear();
                        sideIds.Clear();



                        var         scheduler = TaskScheduler.FromCurrentSynchronizationContext();
                        Task <Grid> t         = addOrder(om);
                        t.Start(scheduler);
                        Grid g = await t;
                        myStackPanel.Children.Add(g);
                        return;
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (mainFrame.Source.ToString().Split('/')[2].Equals(sizePage.ToString()))
            {
                mainFrame.Source     = typePage;
                mainFrame.Navigated += backToType;
            }

            else if (mainFrame.Source.ToString().Split('/')[2].Equals(sidePage.ToString()))
            {
                SidePage sp   = mainFrame.Content as SidePage;
                Grid     grid = sp.Content as Grid;
                var      ch   = grid.Children;
                sideIds.Clear();
                foreach (var c in ch)
                {
                    Canvas can = c as Canvas;
                    if (can.Background == Brushes.LightGreen)
                    {
                        sideIds.Add(Int32.Parse(can.Uid));
                    }
                }

                mainFrame.Source     = sizePage;
                mainFrame.Navigated += backToSize;
            }

            else if (mainFrame.Source.ToString().Split('/')[2].Equals(drinkPage.ToString()))
            {
                DrinkPage dp   = mainFrame.Content as DrinkPage;
                var       grid = dp.Content as Grid;
                var       ch   = grid.Children;
                drinkIds.Clear();
                foreach (var can in ch)
                {
                    Canvas c = can as Canvas;
                    if (c.Background == Brushes.LightGreen)
                    {
                        drinkIds.Add(Int32.Parse(c.Uid));
                    }
                }

                mainFrame.Source     = sidePage;
                mainFrame.Navigated += backToSides;
            }

            else if (mainFrame.Source.ToString().Split('/')[2].Equals(locationPage.ToString()))
            {
                LocationPage lp   = mainFrame.Content as LocationPage;
                var          grid = lp.Content as Grid;
                var          ch   = grid.Children;
                foreach (var can in ch)
                {
                    Canvas c = can as Canvas;
                    if (c.Background == Brushes.LightGreen)
                    {
                        location = c.Name.Substring(0, c.Name.Length - 6);
                    }
                }
                mainFrame.Source     = drinkPage;
                mainFrame.Navigated += backToDrinks;
            }
        }