private async void SelectorOption_Tapped(object sender, System.EventArgs e) { if (!(sender is View view)) { return; } var index = Grid.GetColumn(view); SelectorButton.TranslateTo(index * view.Width, 0, AnimationDuration, Easing.CubicInOut).FireAndForget(); await SelectorButtonLabel.FadeTo(0, AnimationDuration / 2); SelectorButtonLabel.Text = index == 1 ? "New" : "Existing"; await SelectorButtonLabel.FadeTo(1, AnimationDuration / 2); var revealForm = index == 0 ? LoginForm : SignupForm; var hideForm = revealForm == LoginForm ? SignupForm : LoginForm; var direction = revealForm == LoginForm ? 1 : -1; await Task.WhenAll( hideForm.TranslateTo(direction * 200, 0, AnimationDuration, Easing.SinOut), hideForm.FadeTo(0, AnimationDuration)); hideForm.IsVisible = false; revealForm.TranslationX = -direction * 200; revealForm.IsVisible = true; await Task.WhenAll( revealForm.TranslateTo(0, 0, AnimationDuration, Easing.SinOut), revealForm.FadeTo(1, AnimationDuration)); }
private async void SelectorOption_Tapped(object sender, EventArgs e) { if (!(sender is View view)) { return; } var index = Grid.GetColumn(view); // var nextIndex = index == 0 ? 1 : 0; SelectorButon.TranslateTo(index * view.Width, 0, AnimationDuration, Easing.CubicInOut).FireAndForget(); await SelectorButtonLabel.FadeTo(0, AnimationDuration / 2); SelectorButtonLabel.Text = index == 1 ? "New" : "Existing"; await SelectorButtonLabel.FadeTo(1, AnimationDuration / 2); var revealRegScreen = index == 0 ? RegisteredDeviceScreen : DeviceRegistrationScreen; var hideScreen = revealRegScreen == RegisteredDeviceScreen ? DeviceRegistrationScreen : RegisteredDeviceScreen; var revealDevices = index == 0 ? RegistedDevices : UnRegistedDevices; var hideDevices = revealDevices == RegistedDevices ? UnRegistedDevices : RegistedDevices; var direction = revealRegScreen == RegisteredDeviceScreen ? -1 : 1; Device.BeginInvokeOnMainThread(async() => { await Task.WhenAll(hideScreen.TranslateTo(direction * 100, 0, AnimationDuration, Easing.SinOut), hideScreen.FadeTo(0, AnimationDuration)); await Task.WhenAll(hideDevices.TranslateTo(direction * 100, 0, AnimationDuration, Easing.SinOut), hideDevices.FadeTo(0, AnimationDuration)); hideScreen.IsVisible = false; hideDevices.IsVisible = false; revealRegScreen.TranslationX = -direction * 100;//Screen start at position x = 0 revealDevices.TranslationX = -direction * 100; revealRegScreen.IsVisible = true; revealDevices.IsVisible = true; await Task.WhenAll(revealRegScreen.TranslateTo(0, 0, AnimationDuration, Easing.SinOut), revealRegScreen.FadeTo(1, AnimationDuration)); await Task.WhenAll(revealDevices.TranslateTo(0, 0, AnimationDuration, Easing.SinOut), revealDevices.FadeTo(1, AnimationDuration)); }); }