コード例 #1
0
ファイル: ReviewPage.xaml.cs プロジェクト: sliderif/Coffetab
        public ReviewPage()
        {
            NavigationPage.SetHasNavigationBar (this, false);
            InitializeComponent ();
            var submit = new Button();
            var text = new Editor ();
            var api = new Api ();
            submit.Text = "Send";
            submit.HorizontalOptions =  LayoutOptions.EndAndExpand;
            submit.Command = new Command(o => {
                api.LeaveReview(App.user, text.Text);
                var carouselPage = new CarouselPage ();
                var categories = App.api.getCategories (App.user);
                if (categories == null) {
                    categories = new List<Category>();
                }
                foreach (var category in categories) {
                    carouselPage.Children.Add (new CategoryPage(category));
                }
                App.MasterDetailPage.Detail.Navigation.PushAsync(new NavigationPage(carouselPage));
                //Navigation.PushAsync (new CategoryPage ());
            });
            this.Padding = new Thickness (0, Device.OnPlatform (0, 0, 0), 0, 0);
            var headerLayout = new StackLayout{
                Children = {
                    new Label{
                        Text = "Написать нам",
                        HorizontalOptions = LayoutOptions.Center;
                        TextColor = Color.White
                    }
                },
                BackgroundColor = Color.FromHex("666666"),
                Padding = new Thickness(10,40,10,0),

            };
            // Set the content for the page.
            this.Content = new StackLayout {
                Children = {
                    headerLayout,
                    new StackLayout{
                        Padding = new Thickness(10,20,10,0),
                        Children = {
                            text,
                            submit
                        }
                    }
                }
            };
        }