Esempio n. 1
0
        public CoursePage(PluralsightCourse course)
        {
            Padding         = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 0);
            BackgroundColor = Color.Gray;

            this.Title = course.TitleShort;

            var titleLabel = new Label
            {
                Text     = course.Title,
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label))
            };

            var authorLabel = new Label
            {
                Text     = course.Author,
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label))
            };

            var descriptionLabel = new Label
            {
                Text     = course.Description,
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label))
            };

            Content = new ScrollView
            {
                Content = new StackLayout
                {
                    Spacing  = 10,
                    Children = { titleLabel, authorLabel, descriptionLabel }
                }
            };
        }
Esempio n. 2
0
        public CourseMasterDetail()
        {
            var listView = new ListView();

            listView.ItemsSource   = PluralsightCourse.GetCourseList();
            listView.ItemSelected += (sender, e) =>
            {
                if (e.SelectedItem == null)
                {
                    return;
                }
                Detail = new CoursePage(e.SelectedItem as PluralsightCourse);

                IsPresented = false;
            };
            Master = new ContentPage
            {
                Title   = "Courses",
                Content = listView
            };

            Detail = new CoursePage(PluralsightCourse.GetCourseList().First());
        }
Esempio n. 3
0
        public HomePage()
        {
            Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 0);
            Title   = "Pages";

            var button1 = new Button {
                Text = "Simple Page"
            };

            button1.Clicked += (o, e) =>
            {
                Navigation.PushAsync(new CoursePage(PluralsightCourse.GetCourseList().First()));
            };

            var button2 = new Button {
                Text = "Master/Detail"
            };

            button2.Clicked += (o, e) =>
            {
                Navigation.PushAsync(new CourseMasterDetail());
            };

            var button3 = new Button {
                Text = "Master/Detail (binding)"
            };

            button3.Clicked += (o, e) =>
            {
                Navigation.PushAsync(new CourseMasterDetailDB());
            };

            var button4 = new Button {
                Text = "Tabbed"
            };

            button4.Clicked += (o, e) =>
            {
                var page = new TabbedPage();
                page.Title = "Courses";
                foreach (var course in PluralsightCourse.GetCourseList())
                {
                    var coursePage = new CoursePageDB();
                    coursePage.BindingContext = course;
                    page.Children.Add(coursePage);
                }

                Navigation.PushAsync(page);
            };

            var button5 = new Button {
                Text = "Carousel"
            };

            button5.Clicked += (o, e) =>
            {
                var page = new CarouselPage();
                page.Title = "Courses";
                foreach (var course in PluralsightCourse.GetCourseList())
                {
                    var coursePage = new CoursePageDB();
                    coursePage.BindingContext = course;
                    page.Children.Add(coursePage);
                }

                Navigation.PushAsync(page);
            };

            Content = new StackLayout
            {
                Spacing  = 10,
                Children = { button1, button2, button3, button4, button5 }
            };
        }