예제 #1
0
 private void goToSide(object sender, NavigationEventArgs e)
 {
     if (sideIds.Count > 0)
     {
         SidePage sp   = mainFrame.Content as SidePage;
         Grid     grid = sp.Content as Grid;
         var      ch   = grid.Children;
         foreach (var id in sideIds)
         {
             foreach (var can in ch)
             {
                 Canvas c = can as Canvas;
                 if (Int32.Parse(c.Uid) == id)
                 {
                     c.Background = Brushes.LightGreen;
                 }
             }
         }
     }
     mainFrame.Navigated -= goToSide;
 }
예제 #2
0
        private void backToSides(object sender, NavigationEventArgs e)
        {
            SidePage sp   = mainFrame.Content as SidePage;
            Grid     grid = sp.Content as Grid;
            var      ch   = grid.Children;

            foreach (var id in sideIds)
            {
                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 -= backToSides;
        }
예제 #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;
                    }
                }
            }
        }
예제 #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;
            }
        }