public FridgePage()
        {
            ApiHelper.InitializeClient();



            ScrollView scrollView = new ScrollView {
                Orientation = ScrollOrientation.Vertical
            };

            scrollView.Content = grid;
            Content            = scrollView;

            var col   = Database.db.GetCollection <FrigoBaseDeDonnée>("FrigoBaseDeDonnée");
            int longu = col.Count();



            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(10)
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(70)
            });

            for (int i = 1; i < longu + 12; i++)

            {
                grid.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(40)
                });
            }



            for (int j = 1; j < 3; j++)

            {
                grid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
            }

            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(10)
            });

            var TextFridge = new Label {
                Text = "My Fridge", FontSize = 30, FontAttributes = FontAttributes.Bold, TextColor = Color.White
            };



            TextFridge.HorizontalTextAlignment = TextAlignment.Center;


            var AddProduct = new Label {
                Text = "Add a product", TextColor = Color.White, HorizontalTextAlignment = TextAlignment.Center, FontAttributes = FontAttributes.Bold, FontSize = 30
            };

            grid.Children.Add(AddProduct, 2, 0);



            addperemp.Text = "Peremption date:";

            addperemp.TextColor = Color.Black;

            addperemp.VerticalTextAlignment   = TextAlignment.End;
            addperemp.HorizontalTextAlignment = TextAlignment.Center;

            EntréeCodeBarre.TextColor               = Color.White;
            EntréeCodeBarre.BackgroundColor         = Color.BlueViolet;
            EntréeCodeBarre.Placeholder             = "Enter a barrcode";
            EntréeCodeBarre.HorizontalTextAlignment = TextAlignment.Center;

            valider.Clicked        += new EventHandler(this.Sauvegarder_Clicked);
            valider.Text            = "Save";
            valider.TextColor       = Color.White;
            valider.BackgroundColor = Color.BlueViolet;
            valider.FontSize        = 24;

            SiPasCodeBarre.Placeholder             = "Description of the product (if it doesn't have a barcode)";
            SiPasCodeBarre.BackgroundColor         = Color.BlueViolet;
            SiPasCodeBarre.TextColor               = Color.White;
            SiPasCodeBarre.HorizontalTextAlignment = TextAlignment.Center;



            SortieApi.FontSize = 15;
            SortieApi.HorizontalTextAlignment = TextAlignment.Center;

            create();



            DateTime date = peremption.Date;



            grid.Children.Add(TextFridge, 1, 0);
            grid.Children.Add(EntréeCodeBarre, 2, 1);
            grid.Children.Add(SiPasCodeBarre, 2, 3);
            grid.Children.Add(addperemp, 2, 5);
            grid.Children.Add(peremption, 2, 6);
            grid.Children.Add(valider, 2, 8);
            grid.Children.Add(SortieApi, 2, 10);
            grid.Children.Add(Notif_Bas, 1, longu + 12);


            Grid.SetRowSpan(EntréeCodeBarre, 2);
            Grid.SetRowSpan(peremption, 2);
            Grid.SetRowSpan(valider, 2);
            Grid.SetColumnSpan(Notif_Bas, 2);
            Grid.SetRowSpan(SiPasCodeBarre, 2);


            ImageButton Close = new ImageButton();

            Close.Scale    = 0.9;
            Close.Source   = "Assets/croix.png";
            Close.Clicked += (sender, e) => OnCloseClicked2();
            grid.Children.Add(Close, 3, 0);



            grid.BackgroundColor = Color.White;

            create();
        }
Example #2
0
        public Shopping_List()
        {
            test.Children.Clear();
            gridforSL.Children.Clear();
            ApiHelper.InitializeClient();

            ScrollView ScrollContainer = new ScrollView
            {
                Orientation = ScrollOrientation.Both,
            };

            int colMax = 15;
            int rowMax = 15;

            for (int i = 0; i < colMax; i++)
            {
                grid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(100, GridUnitType.Absolute)
                });
            }

            for (int i = 0; i < rowMax; i++)
            {
                grid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(100, GridUnitType.Absolute)
                });
            }



            //______________ Titre de la liste___________________________
            Label LShopList = new Label();

            LShopList.Text           = "Shopping List";
            LShopList.TextColor      = Color.BlueViolet;
            LShopList.FontSize       = 26;
            LShopList.FontAttributes = FontAttributes.Bold;
            grid.Children.Add(LShopList, 1, 0);
            Grid.SetColumnSpan(LShopList, 3);


            //____________________________________________________________
            //__________________ Frame = Liste de Courses_________________
            List <(Label, CheckBox)> AllOfLabAndCheck = GetAllFoodItem();



            for (int i = 0; i < 3; i++)
            {
                gridforSL.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(100, GridUnitType.Absolute)
                });
            }

            for (int i = 0; i < 20; i++)
            {
                gridforSL.RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(100, GridUnitType.Absolute)
                });
            }
            //_________________ Testing grid for this #ITWORKSNOW
            int roww = 0;

            foreach ((Label labb, CheckBox checkk) in AllOfLabAndCheck) //(Label labb, CheckBox checkk)
            {
                checkk.Color             = Color.BlueViolet;
                checkk.FlowDirection     = FlowDirection.LeftToRight;
                checkk.HorizontalOptions = LayoutOptions.End;

                gridforSL.Children.Add(checkk, 0, roww);

                labb.FontSize = 18;
                labb.HorizontalTextAlignment = TextAlignment.Start;
                labb.VerticalOptions         = LayoutOptions.Center;
                gridforSL.Children.Add(labb, 1, roww);
                Grid.SetColumnSpan(labb, 2);


                roww += 1;
            }
            int coundofgrid = gridforSL.Children.Count();

            frame.Content      = gridforSL;
            frame.BorderColor  = Color.DarkSlateBlue;
            frame.CornerRadius = 10;



            grid.Children.Add(frame, 1, 1);
            Grid.SetColumnSpan(frame, 3);
            Grid.SetRowSpan(frame, 15);

            //_____________________________________________________________________________
            //____________________________ Close _________________________________________
            ImageButton Close = new ImageButton();

            Close.Source          = "Assets/croix.png";
            Close.HeightRequest   = 50;
            Close.Scale           = 0.5;
            Close.VerticalOptions = LayoutOptions.Start;
            Close.Clicked        += (sender, e) => OnCloseClicked2();
            grid.Children.Add(Close, 3, 0);


            //______________________________________________________________________________
            //__________________Refresh button______________________________________________

            ImageButton Refresh = new ImageButton();

            Refresh.Source   = "Assets/refresh_Icon.png";
            Refresh.Scale    = 0.75;
            Refresh.Clicked += (sender, e) => RefreshFoodItems();
            grid.Children.Add(Refresh, 4, 1);


            //_____________________________________________________________________________
            //____________________ Add in Shopping List ___________________________________
            ImageButton Add_To_SL = new ImageButton();

            Add_To_SL.Source   = "Assets/Add_Food.png";
            Add_To_SL.Scale    = 0.65;
            Add_To_SL.Clicked += (sender, e) => Add(sender, e);
            grid.Children.Add(Add_To_SL, 4, 2);


            ScrollContainer.Content = grid;

            Content = ScrollContainer;
        }
 public apipage()
 {
     InitializeComponent();
     ApiHelper.InitializeClient();
 }