Exemple #1
0
        private void AssinarMensagens()
        {
            MessagingCenter.Subscribe <ActivityIndicatorPage>(this, "GoActivity", (msg) =>
            {
                //App.Current.MainPage = new Navigation.Pagina1();
                Detail = new ActivityIndicatorPage();

                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <ProgressBarPage>(this, "GoProgressBar", (msg) =>
            {
                Detail = new ProgressBarPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <BoxViewPage>(this, "GoBoxView", (msg) =>
            {
                Detail = new BoxViewPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <LabelPage>(this, "GoLabel", (msg) =>
            {
                Detail = new LabelPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <ButtonPage>(this, "GoButton", (msg) =>
            {
                Detail = new ButtonPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <EntryEditorPage>(this, "GoEntryEditor", (msg) =>
            {
                Detail = new EntryEditorPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <DatePickerPage>(this, "GoDatePicker", (msg) =>
            {
                Detail = new DatePickerPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <TimePickerPage>(this, "GoTimePicker", (msg) =>
            {
                Detail = new TimePickerPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <PickerPage>(this, "GoPickerPage", (msg) =>
            {
                Detail = new PickerPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <SearchBarPage>(this, "GoSearchPage", (msg) =>
            {
                Detail = new SearchBarPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <SliderStepperPage>(this, "GoSliderStepper", (msg) =>
            {
                Detail = new SliderStepperPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <SwitchPage>(this, "GoSwitch", (msg) =>
            {
                Detail = new SwitchPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <ImagePage>(this, "GoImagePage", (msg) =>
            {
                Detail = new ImagePage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <ListViewPage>(this, "GoListView", (msg) =>
            {
                Detail = new ListViewPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <TableViewPage>(this, "GoTableViewPage", (msg) =>
            {
                Detail = new TableViewPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <WebViewPage>(this, "GoWebView", (msg) =>
            {
                Detail = new WebViewPage();
                //Esconder a master
                IsPresented = false;
            });
        }
Exemple #2
0
        void Construct(ContentPage page, ICommand restore, Command <Page> setRoot)
        {
            safeLimits = new Label {
                Text = "nothing"
            };
            var grid = new Grid
            {
                VerticalOptions   = LayoutOptions.Fill,
                HorizontalOptions = LayoutOptions.Fill,
            };

            grid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Star
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            var safeLimitsTop = new Label
            {
                Text              = "top",
                BackgroundColor   = Color.Pink,
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.Start,
                InputTransparent  = true
            };

            grid.Children.Add(safeLimitsTop);
            Grid.SetRow(safeLimitsTop, 0);
            var safeLimitsBottom = new Label
            {
                Text              = "bottom",
                BackgroundColor   = Color.Pink,
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.End,
                InputTransparent  = true
            };

            grid.Children.Add(safeLimitsBottom);
            Grid.SetRow(safeLimitsBottom, 2);

            var content = new ScrollView
            {
                Content = new StackLayout
                {
                    VerticalOptions   = LayoutOptions.Fill,
                    HorizontalOptions = LayoutOptions.Fill,
                    Children          =
                    {
                        safeLimits,
                        new Button
                        {
                            Text    = "Set Content as root",
                            Command = new Command(() =>
                            {
                                var pageSafe = new SafeAreaPageiOS(restore,setRoot);
                                setRoot.Execute(pageSafe);
                            })
                        },
                        new Button
                        {
                            Text    = "Set NavigationPage as root",
                            Command = new Command(() =>
                            {
                                var pageSafe = new SafeAreaPageiOS(restore,setRoot);
                                setRoot.Execute(new NavigationPage(pageSafe));
                            })
                        },
                        new Button
                        {
                            Text    = "Set TabbedPage as root",
                            Command = new Command(() =>
                            {
                                var pageSafe    = new SafeAreaPageiOS(restore, setRoot);
                                var pageNotSafe = new SafeAreaPageiOS(restore,setRoot);
                                pageNotSafe.On <iOS>().SetUseSafeArea(false);
                                pageNotSafe.Title = "Not Using Safe Area";
                                var tabbedPage    = new TabbedPage();
                                tabbedPage.Children.Add(pageSafe);
                                tabbedPage.Children.Add(pageNotSafe);
                                setRoot.Execute(tabbedPage);
                            })
                        },
                        new Button
                        {
                            Text    = "Set TabbedPage and NavigationPage as root",
                            Command = new Command(() =>
                            {
                                var pageSafe    = new SafeAreaPageiOS(restore, setRoot);
                                var pageNotSafe = new SafeAreaPageiOS(restore,setRoot);
                                pageNotSafe.On <iOS>().SetUseSafeArea(false);
                                pageNotSafe.Title = "Not Using Safe Area";
                                var tabbedPage    = new TabbedPage();
                                tabbedPage.Children.Add(new NavigationPage(pageSafe)
                                {
                                    Title = pageSafe.Title
                                });
                                tabbedPage.Children.Add(new NavigationPage(pageNotSafe)
                                {
                                    Title = pageNotSafe.Title
                                });
                                setRoot.Execute(tabbedPage);
                            })
                        },
                        new Button
                        {
                            Text    = "Set CarouselPage as root",
                            Command = new Command(() =>
                            {
                                var pageSafe    = new SafeAreaPageiOS(restore, setRoot);
                                var pageNotSafe = new SafeAreaPageiOS(restore,setRoot);
                                pageNotSafe.On <iOS>().SetUseSafeArea(false);
                                pageNotSafe.Title = "Not Using Safe Area";
                                var carouselPage  = new CarouselPage();
                                carouselPage.Children.Add(pageSafe);
                                carouselPage.Children.Add(pageNotSafe);
                                setRoot.Execute(carouselPage);
                            })
                        },
                        new Button
                        {
                            Text    = "Toggle use safe area",
                            Command = new Command(() => On <iOS>().SetUseSafeArea(!On <iOS>().UsingSafeArea()))
                        },
                        new Button
                        {
                            Text    = "ListViewPage with safe area",
                            Command = new Command(() => {
                                var pageLIST = new ListViewPage("1",restore);
                                pageLIST.On <iOS>().SetUseSafeArea(true);
                                setRoot.Execute(pageLIST);
                            })
                        },         new Button
                        {
                            Text    = "ListViewPage with no safe area",
                            Command = new Command(() => {
                                var pageLIST = new ListViewPage("1",restore);
                                setRoot.Execute(pageLIST);
                            }),
                        },         new Button
                        {
                            Text    = "ListViewPageGrouping with no safe area",
                            Command = new Command(() => {
                                var pageLIST = GetGroupedListView(restore);
                                (pageLIST.Content as ListView).Header = new Button {
                                    Text = "Go back To gallery",Command                               = restore
                                };
                                setRoot.Execute(pageLIST);
                            })
                        },         new Button
                        {
                            Text    = "ListViewPageGrouping using SafeAreaInsets",
                            Command = new Command(() => {
                                var pageLIST              = GetGroupedListView(restore);
                                pageLIST.PropertyChanged += (sender,e) => {
                                    if (e.PropertyName == "SafeAreaInsets")
                                    {
                                        var safeAreaInsets = pageLIST.On <iOS>().SafeAreaInsets();
                                        //we always want to pad the top when using grouping
                                        pageLIST.Padding = new Thickness(0,safeAreaInsets.Top, 0, 0);
                                    }
                                };
                                setRoot.Execute(pageLIST);
                            })
                        },
                        new Button
                        {
                            Text    = "ListViewPageGrouping with safe area",
                            Command = new Command(() => {
                                var pageLIST = GetGroupedListView(restore);
                                pageLIST.On <iOS>().SetUseSafeArea(true);
                                setRoot.Execute(pageLIST);
                            })
                        },
                        new Button
                        {
                            Text    = "TableView+TextCell with safe area",
                            Command = new Command(() => {
                                var pageTable = new TableViewPage(restore);
                                pageTable.On <iOS>().SetUseSafeArea(true);
                                setRoot.Execute(pageTable);
                            })
                        },
                        new Button
                        {
                            Text    = "TableView+TextCell with no safe area",
                            Command = new Command(() => {
                                var pageTable = new TableViewPage(restore);
                                setRoot.Execute(pageTable);
                            })
                        },
                        new Button
                        {
                            Text    = "Back To Gallery",
                            Command = restore
                        },
                    }
                }
            };

            grid.Children.Add(content);
            Grid.SetRow(content, 1);

            page.Content = grid;
        }
        private void TrocaTelaCommand()
        {
            var pageActivity = new ActivityIndicatorPage();

            GoActivityIndicator = new Command(() =>
            {
                MessagingCenter.Send <ActivityIndicatorPage>(pageActivity, "GoActivity");
            });

            var pageProgressBar = new ProgressBarPage();

            GoProgressBar = new Command(() =>
            {
                MessagingCenter.Send <ProgressBarPage>(pageProgressBar, "GoProgressBar");
            });

            var pageBoxView = new BoxViewPage();

            GoBoxView = new Command(() =>
            {
                MessagingCenter.Send <BoxViewPage>(pageBoxView, "GoBoxView");
            });

            var pageLabel = new LabelPage();

            GoLabel = new Command(() =>
            {
                MessagingCenter.Send <LabelPage>(pageLabel, "GoLabel");
            });

            var pageButton = new ButtonPage();

            GoButton = new Command(() =>
            {
                MessagingCenter.Send <ButtonPage>(pageButton, "GoButton");
            });

            var pageEntryEditor = new EntryEditorPage();

            GoEntryEditor = new Command(() =>
            {
                MessagingCenter.Send <EntryEditorPage>(pageEntryEditor, "GoEntryEditor");
            });

            var pageDatePicker = new DatePickerPage();

            GoDatePicker = new Command(() =>
            {
                MessagingCenter.Send <DatePickerPage>(pageDatePicker, "GoDatePicker");
            });

            var pageTimePicker = new TimePickerPage();

            GoTimePicker = new Command(() =>
            {
                MessagingCenter.Send <TimePickerPage>(pageTimePicker, "GoTimePicker");
            });

            var pagePickerPage = new PickerPage();

            GoPickerPage = new Command(() =>
            {
                MessagingCenter.Send <PickerPage>(pagePickerPage, "GoPickerPage");
            });

            var pageSearchBar = new SearchBarPage();

            GoSearchPage = new Command(() =>
            {
                MessagingCenter.Send <SearchBarPage>(pageSearchBar, "GoSearchPage");
            });

            var pageSliderStepper = new SliderStepperPage();

            GoSliderStepper = new Command(() =>
            {
                MessagingCenter.Send <SliderStepperPage>(pageSliderStepper, "GoSliderStepper");
            });

            var pageSwitch = new SwitchPage();

            GoSwitch = new Command(() =>
            {
                MessagingCenter.Send <SwitchPage>(pageSwitch, "GoSwitch");
            });

            var imagePage = new ImagePage();

            GoImagePage = new Command(() =>
            {
                MessagingCenter.Send <ImagePage>(imagePage, "GoImagePage");
            });

            var listView = new ListViewPage();

            GoListView = new Command(() =>
            {
                MessagingCenter.Send <ListViewPage>(listView, "GoListView");
            });

            var tablePage = new TableViewPage();

            GoTableViewPage = new Command(() =>
            {
                MessagingCenter.Send <TableViewPage>(tablePage, "GoTableViewPage");
            });

            var webView = new WebViewPage();

            GoWebView = new Command(() =>
            {
                MessagingCenter.Send <WebViewPage>(webView, "GoWebView");
            });
        }