private async void NextButton_Clicked(object sender, EventArgs e) { await Task.WhenAll(GiftTop.FadeTo(0, 1000), GiftTop.TranslateTo(0, -100, 1000)); await TooEarlyPanel.FadeTo(0, 1000); await((App)App.Current).Navigation.PushAsync(new RedemptionPage()); }
protected override async void OnAppearing() { base.OnAppearing(); //Set up panel state await Task.Delay(1000); TooEarlyPanel.Opacity = 0; TooEarlyPanel.IsVisible = true; await TooEarlyPanel.FadeTo(1, 500); // Undo possible navigation to next page await Task.WhenAll(GiftTop.TranslateTo(0, 0, 500), GiftTop.FadeTo(1, 500)); if (DateTime.Now < ChristmasDate && !SkipCountdown) { //Set up countdown timer Device.StartTimer( TimeSpan.FromSeconds(1), () => { TimeSpan timeTillChristmas = ChristmasDate - DateTime.Now; if (timeTillChristmas > TimeSpan.Zero) { Device.BeginInvokeOnMainThread( () => TimerLabel.Text = $"{timeTillChristmas.Days}d {timeTillChristmas.Hours}h {timeTillChristmas.Minutes}m {timeTillChristmas.Seconds}s" ); return(true); } else { Device.BeginInvokeOnMainThread(() => { TimerLabel.Text = "0d 0h 0m 0s"; NextButton.IsVisible = true; NextButton.InputTransparent = false; Task.WhenAll( TooEarlyLabel1.FadeTo(0, 2000), TooEarlyLabel2.FadeTo(0, 2000), TimerLabel.TranslateTo(0, 50, 4000), TimerLabel.ScaleTo(2, 4000), NextButton.FadeTo(1, 4000) ); }); return(false); } } ); } else { NextButton.Opacity = 1; NextButton.InputTransparent = false; } //Set up gift box hints string?response = await _networkService.GetGiftHints(); if (String.IsNullOrWhiteSpace(response)) { return; } // Update local cache Settings.GiftHintsV2 = response; InitHints(Settings.GiftHintsV2); await _pinkieService.UpdateEventsFromRemote(); Accelerometer.ShakeDetected += Accelerometer_ShakeDetected; try { if (!Accelerometer.IsMonitoring) { Accelerometer.Start(_sensorSpeed); } } catch (Exception ex) { Debug.WriteLine($"Unable to start listening to Accelerometer: {ex}"); } }