void OnSpinButtonPressed(object sender, SpinButtonPressedArgs eventArgs) { user.Name = eventArgs.Name; user.Email = eventArgs.Email; user.Company = eventArgs.Company; user.CompletedAzureChallenge = eventArgs.CompletedAzureChallenge; var slotsPage = new SlotsPage { Title = "Slots" }; navigation.Push(slotsPage); slotsPage.SpinFinished += OnSpinFinished; }
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 }; }