public LoginPage() { BackgroundColor = Color.FromRgb(57, 57, 57); isPhone = Device.Idiom == TargetIdiom.Phone; var logo = new Image { Source = "hexagon.png", VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, IsTappable = true }; logo.Tapped += (s, e) => { System.Diagnostics.Debug.WriteLine("Show Backup"); var hiddenUsersPage = new HiddenUsersPage(HiddenViewType.BackupLog); Navigation.Push(hiddenUsersPage); }; if (isPhone) { logo.WidthRequest = 175; logo.HeightRequest = 175; } else { logo.WidthRequest = 250; logo.HeightRequest = 250; } var winPrizeLabel = new Label { Text = "Win a Xamarin Prize", XAlign = TextAlignment.Center, YAlign = TextAlignment.Center, TextColor = Color.White, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Center, HeightRequest = 100, IsTappable = true }; winPrizeLabel.Tapped += (s, e) => { System.Diagnostics.Debug.WriteLine("Show Sync"); var hiddenUsersPage = new HiddenUsersPage(HiddenViewType.SyncView); Navigation.Push(hiddenUsersPage); }; if (isPhone) { Device.OnPlatform(iOS: () => winPrizeLabel.Font = Font.FontForSize("HelveticaNeue-UltraLight", 30)); Device.OnPlatform(Android: () => winPrizeLabel.Font = Font.FontForSize("HelveticaNeue-Light", 30)); } else { Device.OnPlatform(iOS: () => winPrizeLabel.Font = Font.FontForSize("HelveticaNeue-UltraLight", 50)); Device.OnPlatform(Android: () => winPrizeLabel.Font = Font.FontForSize("Roboto-Light", 50)); } StackLayout form = MakeForm(); form.VerticalOptions = LayoutOptions.FillAndExpand; var formView = new ContentView { Content = form, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; var spinButton = new Button { Text = "Spin", BackgroundColor = Color.Gray, TextColor = Color.White, WidthRequest = 100, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center }; spinButton.Activated += (s, e) => { var handler = SpinButtonPressed; if (handler != null) { string name = nameEntry.Text ?? ""; string email = emailEntry.Text ?? ""; string company = companyEntry.Text ?? ""; bool completedChallenge = false; var args = new SpinButtonPressedArgs(name, email, company, completedChallenge); handler(this, args); } }; var spinButtonView = new ContentView { Content = spinButton, WidthRequest = 250, HeightRequest = 150 }; var mainLayout = new StackLayout { Spacing = 20 }; mainLayout.Add(logo); mainLayout.Add(winPrizeLabel); mainLayout.Add(formView); mainLayout.Add(spinButtonView); var scollView = new ScrollView { Content = mainLayout }; Content = new BackgroundImageContainer("blurredbackground.png") { Content = scollView }; }
void SetupPage(PrizeType prize) { BackgroundImage = "youwinbackground.png"; var youWonLabel = new Label { Text = "You Won!", TextColor = Color.White, XAlign = TextAlignment.Center, YAlign = TextAlignment.Center, VerticalOptions = LayoutOptions.CenterAndExpand }; Device.OnPlatform(iOS: () => youWonLabel.Font = Font.FontForSize("HelveticaNeue-UltraLight", 50)); var prizeImage = new Image { VerticalOptions = LayoutOptions.FillAndExpand, HeightRequest = 200 }; if (prize == PrizeType.Monkey) { prizeImage.Source = "monkeystuff.png"; } else { prizeImage.Source = "tshirt.png"; } var enjoyPrizeLabel = new Label { TextColor = Color.White, XAlign = TextAlignment.Center, YAlign = TextAlignment.Center, VerticalOptions = LayoutOptions.CenterAndExpand }; if (prize == PrizeType.Monkey) { enjoyPrizeLabel.Text = "Enjoy your new Xamarin Monkey!"; } else { enjoyPrizeLabel.Text = "Enjoy your new Xamarin t-shirt!"; } Device.OnPlatform(iOS: () => enjoyPrizeLabel.Font = Font.FontForSize("HelveticaNeue-UltraLight", 35)); var doneButton = new Button { Text = "Done", BackgroundColor = Color.Gray, TextColor = Color.White, WidthRequest = 100, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center }; var doneButtonContainer = new ContentView { HeightRequest = 125, Content = doneButton }; doneButton.Activated += (s, e) => { Console.WriteLine("Tapped!!"); var handler = DoneButtonPressed; if (handler != null) { handler(this, EventArgs.Empty); } }; var layout = new StackLayout { youWonLabel, prizeImage, enjoyPrizeLabel, doneButtonContainer }; Content = new BackgroundImageContainer("youwinbackground.png") { Content = layout }; }