/// <summary> /// Handles the Loaded event of the UserControl control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> void UserControl_Loaded(object sender, RoutedEventArgs e) { // Create ChannelAdd Buttons foreach (var channel in new ChannelLoadHelper().AvailableChannels) { // Insert each item at index 0 of the wrap panel ChannelAddControl control = new ChannelAddControl(); control.ChannelConfiguration = channel; ChannelAddWrapPannel.Children.Insert(0, control); } GenieTransition transition = Resources["GenieTransition"] as GenieTransition; transitionContainer.Transition = transition; transitionContainer.TransitionCompleted += TransitionCompleted_Handler; if (HasConfiguredChannels) { AnimateChannelAddWrapPanel(null); } OnPropertyChanged("HasConfiguredChannels"); }
/// <summary> /// Handles the Click event of the ChannelAddWrapPannel control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> void ChannelAddWrapPannel_Click(object sender, RoutedEventArgs e) { ChannelAddControl channelAddControl = e.Source as ChannelAddControl; if (!ChannelAddWrapAnimated) { AnimateChannelAddWrapPanel(channelAddControl); } else { OnChannelAddAnimationComplete(channelAddControl); } e.Handled = true; }
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(); }); }
protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); foreach (var channel in new ChannelLoadHelper().AvailableChannels) { // Insert each item at index 0 of the wrap panel ChannelAddControl control = new ChannelAddControl(); control.ChannelConfiguration = channel; ChannelAddWrapPannel.Children.Insert(0, control); } }
/// <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"); }