Exemple #1
0
        async Task <View> CreateDevicePicker()
        {
            var result = new Stack(RepeatDirection.Horizontal).Margin(left: 5).Height(100.Percent());

            foreach (var platform in GetStandardDevices())
            {
                var button = await result.Add(CreateButton(platform.Platform == DevicePlatform.Windows ? "Windows.png" :
                                                           platform.Platform == DevicePlatform.Android ? "Android.png" : "IOS.png")
                                              .Background(color : platform.Platform == DevicePlatform.Windows ? SELECTED : "#666")
                                              .Height(100.Percent()));

                button.Tapped
                .Handle(async() =>
                {
                    result.AllChildren.Except(button).Do(x => x.Background("#666"));
                    button.Background(SELECTED);
                    await UIRuntime.RenderRoot.SetCssClass(platform.RootCss);
                    CssEngine.Platform = platform.Platform;

                    await Nav.FullRefresh();
                });
            }

            return(result);
        }