// Here we create basic pages for the views, only we specify the content to display in the main area
        // We also specify which CarouselView we wish to manipulate by passing it in.
        public Grid CreatePage(Color bgColor, Color textColor, View content, ManualCarouselView eventTarget)
        {
            Grid layout = new Grid {
                ColumnDefinitions = new ColumnDefinitionCollection {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    }
                },
                RowDefinitions = new RowDefinitionCollection {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                },
                BackgroundColor = bgColor
            };


            Button goBack = new Button()
            {
                Text      = "Back",
                TextColor = textColor,
                Command   = new Command(() => {
                    Device.BeginInvokeOnMainThread(() => {
                        eventTarget.AdvancePage(-1);
                    });
                })
            };

            Button goForward = new Button()
            {
                Text      = "Next",
                TextColor = textColor,
                Command   = new Command(() => {
                    Device.BeginInvokeOnMainThread(() => {
                        eventTarget.AdvancePage(1);
                    });
                })
            };

            layout.Children.Add(goBack, 0, 1, 3, 4);
            layout.Children.Add(goForward, 2, 3, 3, 4);
            layout.Children.Add(content, 0, 3, 0, 3);

            return(layout);
        }
Beispiel #2
0
        private void TimerElapsedEvt()
        {
            var secondsSinceStart = GetSecondsSinceTimerStart;

            if (secondsSinceStart % 5 == 0)
            {
                box1.AdvancePage(1);
            }
            if (secondsSinceStart % 4 == 0)
            {
                box3.AdvancePage(1);
            }
            if (secondsSinceStart % 2 == 0)
            {
                box4.AdvancePage(1);
            }
        }