public EditListAccount()
        {
            NavigationPage.SetHasBackButton(this, false);
            Label label = new TitleLabel {
                Text = "Список аккаунтов"
            };

            Button button = new EndButton {
                Text = "Добавить"
            };

            button.Clicked += AddBicycle;
            #region ListView
            list = new ListView {
                RowHeight = 220,
            };
            list.ItemTapped += List_ItemTapped;

            list.ItemTemplate = new DataTemplate(() =>
            {
                Label lIdAccount = new Label {
                    FontSize = 14,
                };
                lIdAccount.SetBinding(Label.TextProperty, new Binding {
                    Path = "IdAccount", StringFormat = "ID: {0}",
                });

                Label lName = new Label {
                    FontSize = 14,
                };
                lName.SetBinding(Label.TextProperty, new Binding {
                    Path = "Name", StringFormat = "Имя: {0}",
                });

                Label lSurname = new Label {
                    FontSize = 14,
                };
                lSurname.SetBinding(Label.TextProperty, new Binding {
                    Path = "Surname", StringFormat = "Фамилия: {0}",
                });

                Label lPrice = new Label {
                    FontSize = 14,
                };
                lPrice.SetBinding(Label.TextProperty, new Binding {
                    Path = "Patronymic", StringFormat = "Отчество: {0}",
                });

                Label lMoney = new Label {
                    FontSize = 14,
                };
                lMoney.SetBinding(Label.TextProperty, new Binding {
                    Path = "Money", StringFormat = "Кол-во валюты: {0}",
                });

                Label lAdmin = new Label {
                    FontSize = 14,
                };
                lAdmin.SetBinding(Label.TextProperty, new Binding {
                    Path = "Admin", StringFormat = "Администратор: {0}",
                });

                Image image = new Image {
                    Aspect = Aspect.AspectFit
                };
                image.SetBinding(Image.SourceProperty, new Binding {
                    Path = "ImageLink"
                });

                #region RelativeLayout
                RelativeLayout relative = new RelativeLayout {
                };

                relative.Children.Add(image,
                                      Constraint.RelativeToParent((parent) => - 5),
                                      Constraint.RelativeToParent((parent) => - 5),
                                      Constraint.RelativeToParent((parent) => parent.Width * 0.075 + 150),
                                      Constraint.RelativeToParent((parent) => 150));

                relative.Children.Add(lIdAccount,
                                      Constraint.RelativeToView(image, (parent, view) => view.X + view.Width + 10),
                                      Constraint.RelativeToView(image, (parent, view) => 5));

                relative.Children.Add(lName,
                                      Constraint.RelativeToView(lIdAccount, (parent, view) => view.X),
                                      Constraint.RelativeToView(lIdAccount, (parent, view) => view.Y + view.Height + 2));

                relative.Children.Add(lSurname,
                                      Constraint.RelativeToView(lName, (parent, view) => view.X),
                                      Constraint.RelativeToView(lName, (parent, view) => view.Y + view.Height + 2));

                relative.Children.Add(lPrice,
                                      Constraint.RelativeToView(lSurname, (parent, view) => view.X),
                                      Constraint.RelativeToView(lSurname, (parent, view) => view.Y + view.Height + 2));

                relative.Children.Add(lMoney,
                                      Constraint.RelativeToView(lPrice, (parent, view) => view.X),
                                      Constraint.RelativeToView(lPrice, (parent, view) => view.Y + view.Height + 2));

                relative.Children.Add(lAdmin,
                                      Constraint.RelativeToView(lMoney, (parent, view) => view.X),
                                      Constraint.RelativeToView(lMoney, (parent, view) => view.Y + view.Height + 2));
                #endregion

                return(new ViewCell {
                    View = new Frame {
                        Margin = 15, Content = relative, CornerRadius = 20, BackgroundColor = Color.LightSkyBlue, HeightRequest = 70
                    }
                });
            });
            #endregion

            Content = new StackLayout {
                Children = { label, list, button },
            };
        }
        public Refill(MainPage _main) // пополнение счета
        {
            main = _main;

            Image image = new Image {
                Aspect = Aspect.AspectFit, WidthRequest = 100
            };

            image.SetBinding(Image.SourceProperty, new Binding {
                Path = "ImageLink"
            });

            Label lName = new Label {
                FontSize = 14, Margin = new Thickness(10, 0)
            };

            lName.SetBinding(Label.TextProperty, new Binding {
                Path = "Name", StringFormat = "Имя: {0}",
            });

            Label lSurname = new Label {
                FontSize = 14, Margin = new Thickness(10, 0)
            };

            lSurname.SetBinding(Label.TextProperty, new Binding {
                Path = "Surname", StringFormat = "Фамилия: {0}",
            });

            Label lPatronymic = new Label {
                FontSize = 14, Margin = new Thickness(10, 0)
            };

            lPatronymic.SetBinding(Label.TextProperty, new Binding {
                Path = "Patronymic", StringFormat = "Отчество: {0}",
            });

            Label lMoney = new Label {
                FontSize = 14, Margin = new Thickness(10, 0)
            };

            lMoney.SetBinding(Label.TextProperty, new Binding {
                Path = "Money", StringFormat = "Денег на счету: {0}",
            });

            Entry entryCardNumber = new Entry {
                Placeholder = "Номер карты", Margin = new Thickness(10, 2)
            };
            Entry entryCardCode = new Entry {
                Placeholder = "Защитный код", Margin = new Thickness(10, 2)
            };

            entryMoney = new Entry {
                Placeholder = "Кол-во денег на пополнение счета", Margin = new Thickness(10, 2)
            };
            Button button = new EndButton {
                Text = "Пополнить счет"
            };

            button.Clicked += Button_Clicked;

            StackLayout stack = new StackLayout
            {
                Children =
                {
                    new CustomFrame
                    {
                        Content = new StackLayout
                        {
                            Children ={ image, new StackLayout                {
                              Children = { lName, lSurname, lPatronymic, lMoney }
                          } },
                            Orientation = StackOrientation.Horizontal,
                        },
                    },
                    entryCardNumber,
                    entryCardCode,
                    entryMoney,
                    button
                }
            };

            Content = new ScrollView {
                Content = stack
            };
        }
        public BasketMovie(MainPage _main)
        {
            main = _main;
            NavigationPage.SetHasBackButton(this, false);

            Label label = new TitleLabel {
                Text = "Корзина"
            };

            labelSum = new TitleLabel {
                HorizontalTextAlignment = TextAlignment.End, BackgroundColor = Color.Transparent
            };

            Button button = new EndButton {
                Text = "Купить"
            };

            button.Clicked += Buy;
            #region ListView
            list                   = new CollectionViewCustom {
            };
            list.ItemsSource       = main.GetBasketMovies;
            list.SelectionChanged += ListSpecial_ItemTapped;

            list.ItemTemplate = new DataTemplate(() =>
            {
                Label lName = new Label {
                    FontSize = 14,
                };
                lName.SetBinding(Label.TextProperty, new Binding {
                    Path = "Name", StringFormat = "Название: {0}",
                });

                Label lSurname = new Label {
                    FontSize = 14,
                };
                lSurname.SetBinding(Label.TextProperty, new Binding {
                    Path = "Surname", StringFormat = "Дата выхода: {0}",
                });

                Label lPrice = new Label {
                    FontSize = 14,
                };
                lPrice.SetBinding(Label.TextProperty, new Binding {
                    Path = "Price", StringFormat = "Цена: {0}",
                });

                Image image = new Image {
                    Aspect = Aspect.AspectFit
                };
                image.SetBinding(Image.SourceProperty, new Binding {
                    Path = "ImageLink"
                });

                #region RelativeLayout
                RelativeLayout relative = new RelativeLayout {
                };

                relative.Children.Add(image,
                                      Constraint.RelativeToParent((parent) => - 5),
                                      Constraint.RelativeToParent((parent) => - 5),
                                      Constraint.RelativeToParent((parent) => parent.Width * 0.25),
                                      Constraint.RelativeToParent((parent) => 150));

                relative.Children.Add(lName,
                                      Constraint.RelativeToView(image, (parent, view) => view.X + view.Width + 10),
                                      Constraint.RelativeToView(image, (parent, view) => 5));

                relative.Children.Add(lSurname,
                                      Constraint.RelativeToView(lName, (parent, view) => view.X),
                                      Constraint.RelativeToView(lName, (parent, view) => view.Y + view.Height + 2));

                relative.Children.Add(lPrice,
                                      Constraint.RelativeToView(lSurname, (parent, view) => view.X),
                                      Constraint.RelativeToView(lSurname, (parent, view) => view.Y + view.Height + 2));

                #endregion

                return(new CustomFrameCollection {
                    Content = relative
                });
            });
            #endregion

            Content = new StackLayout {
                Children = { label, list, labelSum, button },
            };
        }
Esempio n. 4
0
        public EditListMovie()
        {
            NavigationPage.SetHasBackButton(this, false);
            Label label = new TitleLabel {
                Text = "Список фильмов"
            };

            Button button = new EndButton {
                Text = "Добавить"
            };

            button.Clicked += AddBicycle;
            #region ListView
            list = new CollectionViewCustom {
            };
            list.SelectionChanged += List_ItemTapped;

            list.ItemTemplate = new DataTemplate(() =>
            {
                Label lIdAccount = new Label {
                    FontSize = 14,
                };
                lIdAccount.SetBinding(Label.TextProperty, new Binding {
                    Path = "IdMovie", StringFormat = "ID BuyMovie: {0}",
                });

                Label lName = new Label {
                    FontSize = 14,
                };
                lName.SetBinding(Label.TextProperty, new Binding {
                    Path = "Name", StringFormat = "Наименование фильма: {0}",
                });

                Label lSurname = new Label {
                    FontSize = 14,
                };
                lSurname.SetBinding(Label.TextProperty, new Binding {
                    Path = "DateCreate", StringFormat = "Дата выпуска фильма: {0:dd/MM/yyyy}",
                });

                Label lPrice = new Label {
                    FontSize = 14,
                };
                lPrice.SetBinding(Label.TextProperty, new Binding {
                    Path = "Price", StringFormat = "Цена: {0}",
                });

                Image image = new Image {
                    Aspect = Aspect.AspectFit
                };
                image.SetBinding(Image.SourceProperty, new Binding {
                    Path = "ImageLink"
                });

                #region RelativeLayout
                RelativeLayout relative = new RelativeLayout {
                };

                relative.Children.Add(image,
                                      Constraint.RelativeToParent((parent) => - 5),
                                      Constraint.RelativeToParent((parent) => - 5),
                                      Constraint.RelativeToParent((parent) => parent.Width * 0.075 + 150),
                                      Constraint.RelativeToParent((parent) => 150));

                relative.Children.Add(lIdAccount,
                                      Constraint.RelativeToView(image, (parent, view) => view.X + view.Width + 10),
                                      Constraint.RelativeToView(image, (parent, view) => 5));

                relative.Children.Add(lName,
                                      Constraint.RelativeToView(lIdAccount, (parent, view) => view.X),
                                      Constraint.RelativeToView(lIdAccount, (parent, view) => view.Y + view.Height + 2));

                relative.Children.Add(lSurname,
                                      Constraint.RelativeToView(lName, (parent, view) => view.X),
                                      Constraint.RelativeToView(lName, (parent, view) => view.Y + view.Height + 2));

                relative.Children.Add(lPrice,
                                      Constraint.RelativeToView(lSurname, (parent, view) => view.X),
                                      Constraint.RelativeToView(lSurname, (parent, view) => view.Y + view.Height + 2));

                #endregion

                return(new CustomFrameCollection {
                    Content = relative
                });
            });
            #endregion

            Content = new StackLayout {
                Children = { label, list, button },
            };
        }