public static AnimationClock AnimatePenner( DependencyObject element, DependencyProperty prop, PennerDoubleAnimation.Equations type, double to, int durationMS, EventHandler callbackFunc) { return(Animator.AnimatePenner(element, prop, type, new double?(), to, durationMS, callbackFunc)); }
/// <summary> /// Animates the logo. /// </summary> private void AnimateOpenedLogo() { PennerDoubleAnimation.Equations equation = PennerDoubleAnimation.Equations.QuintEaseOut; double from = Canvas.GetTop(Inbox2SetupOpenedLogoCanvas); double to = Canvas.GetTop(Inbox2SetupOpenedLogoCanvas) - 320; int durationMS = 1200; Animator.AnimatePenner(Inbox2SetupOpenedLogoCanvas, OpacityProperty, equation, Inbox2SetupOpenedLogoCanvas.Opacity, 1, durationMS, delegate { }); Animator.AnimatePenner(Inbox2SetupOpenedLogoCanvas, Canvas.TopProperty, equation, from, to, durationMS, delegate { }); }
public PennerDoubleAnimation( PennerDoubleAnimation.Equations type, double from, double to, Duration duration) { this.Equation = type; this.From = from; this.To = to; this.Duration = duration; }
public static AnimationClock AnimatePenner( DependencyObject element, DependencyProperty prop, PennerDoubleAnimation.Equations type, double?from, double to, int durationMS, EventHandler callbackFunc) { double defaultValue = double.IsNaN((double)element?.GetValue(prop)) ? 0.0 : (double)element.GetValue(prop); PennerDoubleAnimation pennerDoubleAnimation = new PennerDoubleAnimation(type, from.GetValueOrDefault(defaultValue), to); return(Animator.Animate(element, prop, (AnimationTimeline)pennerDoubleAnimation, durationMS, new double?(), new double?(), callbackFunc)); }
/// <summary> /// Animates the closed logo. /// </summary> private void AnimateClosedLogo() { Canvas.SetTop(Inbox2SetupClosedLogoCanvas, Canvas.GetTop(Inbox2SetupOpenedLogoCanvas)); PennerDoubleAnimation.Equations equation = PennerDoubleAnimation.Equations.QuintEaseOut; int durationMS = 1000; // Hide Opened Logo Animator.AnimatePenner(Inbox2SetupOpenedLogoCanvas, OpacityProperty, equation, Inbox2SetupOpenedLogoCanvas.Opacity, 0, durationMS, delegate { Inbox2SetupOpenedLogoCanvas.Visibility = Visibility.Hidden; }); // Show Closed Logo Animator.AnimatePenner(Inbox2SetupClosedLogoCanvas, OpacityProperty, equation, 0, 1, durationMS, delegate { Animator.AnimatePenner(Inbox2SetupClosedImage, WidthProperty, equation, Inbox2SetupClosedImage.Width, Inbox2SetupClosedImage.Width / 2, durationMS, delegate { }); Animator.AnimatePenner(Inbox2SetupClosedImage, HeightProperty, equation, Inbox2SetupClosedImage.Height, Inbox2SetupClosedImage.Height / 2, durationMS, delegate { Animator.AnimatePenner(ChannelConfigurationAddStackPanel, OpacityProperty, equation, null, 0, durationMS, delegate { ChannelConfigurationAddStackPanel.Visibility = Visibility.Hidden; }); Animator.AnimatePenner(Inbox2SetupClosedLogoCanvas, Canvas.LeftProperty, equation, null, 0, durationMS, delegate { ChannelSetupFinishStackPanel.Visibility = System.Windows.Visibility.Visible; }); }); }); OnPropertyChanged("ChannelConfiguration"); // Setup form to complete setup. ChannelsManager.Channels[0].Configuration.IsDefault = true; DefaultEmailAddressComboBox.SelectedIndex = 0; if (ChannelsManager.Channels.Count <= 1 || ChannelsManager.Channels.Select(s => s.Configuration).Where(c => c.Charasteristics.SupportsEmail).Count() == 0) { DefaultEmailAddressTextBlock.Visibility = Visibility.Collapsed; DefaultEmailAddressComboBox.Visibility = Visibility.Collapsed; } var address = ChannelsManager.GetDefaultSourceAddress(); if (address.ToString().Contains("@")) { string[] parts = address.ToString().Split('@'); DisplayNameTextBox.Text = char.ToUpper(parts[0][0]) + parts[0].Substring(1); } else { DisplayNameTextBox.Text = address.DisplayName; } DisplayNameTextBox.Focus(); }
/// <summary> /// Starts a PennerDoubleAnimation. /// </summary> /// <param name="element">The DependencyObject containing the property to be animated.</param> /// <param name="prop">The DependencyProperty to animate.</param> /// <param name="type">The PennerDoubleAnimation.Equations easing equation to use.</param> /// <param name="from">Optional start value.</param> /// <param name="to">The target value.</param> /// <param name="durationMS">Duration of the animation, in milliseconds.</param> /// <param name="callbackFunc">Optional method to be called when animation completes.</param> /// <returns>The AnimationClock used to control the animation.</returns> public static AnimationClock AnimatePenner( DependencyObject element, DependencyProperty prop, PennerDoubleAnimation.Equations type, double?from, double to, int durationMS, EventHandler callbackFunc) { double defaultFrom = double.IsNaN((double)element.GetValue(prop)) ? 0 : (double)element.GetValue(prop); PennerDoubleAnimation anim = new PennerDoubleAnimation(type, from.GetValueOrDefault(defaultFrom), to); return(Animate(element, prop, anim, durationMS, null, null, callbackFunc)); }
private void AnimateChannelAddWrapPanel(ChannelAddControl channelAddControl) { PennerDoubleAnimation.Equations equation = PennerDoubleAnimation.Equations.QuintEaseOut; double from = Canvas.GetLeft(ChannelConfigurationAddStackPanel); double to = 0; int durationMS = 1000; Animator.AnimatePenner(ChannelConfigurationAddStackPanel, Canvas.LeftProperty, equation, from, to, durationMS, delegate { ChannelAddWrapAnimated = true; if (channelAddControl != null) { OnChannelAddAnimationComplete(channelAddControl); } AnimateOpenedLogo(); }); }
/// <summary> /// Called when [channel add animation complete]. /// </summary> /// <param name="channelAddControl">The channel add control.</param> private void OnChannelAddAnimationComplete(ChannelAddControl channelAddControl) { if (transitionContainer.Items.Count == 0) { // Set Canvas Top if (channelAddControl.ChannelConfiguration.DisplayStyle == DisplayStyle.Other) { Canvas.SetTop(ChannelSetupStackPanel, 0); } else { Canvas.SetTop(ChannelSetupStackPanel, 110); } // Tranisition Settings transitionContainer.Opacity = 0; // Setup Control ChannelSetupControl setupControl = new ChannelSetupControl(channelAddControl.ChannelConfiguration.Clone()); setupControl.IsInEditModus = false; setupControl.OnValidationFinished += OnValidationFinishedHandler; setupControl.OnCancel += OnCancelHandler; setupControl.RenderTransform = new TranslateTransform(0, 0); setupControl.OnFormLayoutUpdated += delegate { // Set Canvas Top if (setupControl.ChannelConfiguration.DisplayStyle == DisplayStyle.Other || setupControl.IsManuallyCustomized) { Canvas.SetTop(ChannelSetupStackPanel, 0); } else { Canvas.SetTop(ChannelSetupStackPanel, 110); } }; transitionContainer.Items.Add(setupControl); // Empty Control Control emptyControl = new Control(); emptyControl.HorizontalAlignment = HorizontalAlignment.Stretch; emptyControl.VerticalAlignment = VerticalAlignment.Bottom; emptyControl.RenderTransform = new TranslateTransform(0, 0); transitionContainer.Items.Add(emptyControl); // NOTE: This is a workaround to get the focus // correctly on the SetupControl. This way the command binding // on the CheckCredentials button is triggerd correctly. emptyControl.Focus(); setupControl.Focus(); // Animate Opacity Tween PennerDoubleAnimation.Equations equation = PennerDoubleAnimation.Equations.QuintEaseOut; int durationMS = 750; Animator.AnimatePenner(transitionContainer, OpacityProperty, equation, transitionContainer.Opacity, 1, durationMS, delegate { }); } OnPropertyChanged("HasConfiguredChannels"); }
public PennerDoubleAnimation(PennerDoubleAnimation.Equations type, double from, double to) { this.Equation = type; this.From = from; this.To = to; }