/// <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 { });
        }
        /// <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();
        }
        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");
        }