private async void PINOk(object sender, RoutedEventArgs e) { bool result = await _imgurhelper.Login(Box_PIN.Text); if (!result) { return; } DoubleAnimation fadePanelOut = Animations.FadeOut; fadePanelOut.Completed += delegate { DoubleAnimation fadeBtnIn = Animations.FadeIn; fadeBtnIn.Completed += delegate { Panel_PIN.Visibility = Visibility.Collapsed; }; Btn_SignOut.Visibility = Visibility.Visible; Btn_SignOut.BeginAnimation(OpacityProperty, fadeBtnIn); Btn_ViewPics.Visibility = Visibility.Visible; Btn_ViewPics.BeginAnimation(OpacityProperty, fadeBtnIn); }; Panel_PIN.BeginAnimation(OpacityProperty, fadePanelOut); if (_imgurhelper.User != null) { Label_Account.Content = string.Format(str.imgurAccSignedIn, _imgurhelper.User); Btn_SignIn.Visibility = Visibility.Collapsed; Btn_SignOut.Visibility = Visibility.Visible; Btn_ViewPics.Visibility = Visibility.Visible; } Box_PIN.Clear(); }
private void SignOut(object sender, RoutedEventArgs e) { DoubleAnimation fadeBtnOut = Animations.FadeOut; Btn_ViewPics.BeginAnimation(OpacityProperty, fadeBtnOut); fadeBtnOut.Completed += delegate { FileIO.DeleteToken(); DoubleAnimation fadeBtnIn = Animations.FadeIn; Btn_ViewPics.BeginAnimation(OpacityProperty, fadeBtnIn); fadeBtnIn.Completed += delegate { Btn_SignOut.Visibility = Visibility.Collapsed; Btn_ViewPics.Visibility = Visibility.Collapsed; Label_Account.Content = "Imgur Account"; }; Btn_SignIn.Visibility = Visibility.Visible; Btn_SignIn.BeginAnimation(OpacityProperty, fadeBtnIn); }; Btn_SignOut.BeginAnimation(OpacityProperty, fadeBtnOut); }