/// <summary> /// Called when [validation finished handler]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> void OnValidationFinishedHandler(object sender, EventArgs e) { ChannelSetupControl control = sender as ChannelSetupControl; if (control.IsValidated) { if (!control.IsInEditModus) { ChannelConfigurationsListView.ItemsSource = ChannelConfigurations; } // Play Animation var frontItem = (FrameworkElement)transitionContainer.Items[1]; var backItem = (FrameworkElement)transitionContainer.Items[0]; FlipTransition transition = Resources["FlipTransition"] as FlipTransition; transition.Rotation = Direction.RightToLeft; transitionContainer.Transition = transition; transitionContainer.TransitionCompleted += OnTransitionCompleted; transitionContainer.ApplyTransition(frontItem, backItem); // Start recieve with default page size EventBroker.Publish(AppEvents.RequestReceive, ChannelsManager.Channels.First(c => c.Configuration.ChannelId == control.ChannelConfiguration.ChannelId)); } OnPropertyChanged("AllChannelConfigurations"); OnPropertyChanged("ChannelConfiguration"); }
/// <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) { if (ChannelSetupControlPanel.Children.Count == 0) { ChannelAddControl channelAddControl = e.Source as ChannelAddControl; // Setup Control ChannelSetupControl setupControl = new ChannelSetupControl(channelAddControl.ChannelConfiguration.Clone()); setupControl.IsInEditModus = false; setupControl.HorizontalAlignment = HorizontalAlignment.Center; setupControl.VerticalAlignment = VerticalAlignment.Center; setupControl.OnValidationFinished += OnValidationFinishedHandler; setupControl.OnCancel += OnCancelHandler; setupControl.RenderTransform = new TranslateTransform(0, 0); ChannelSetupControlPanel.Children.Add(setupControl); // Play Animation var firstItem = (FrameworkElement)transitionContainer.Items[0]; var secondItem = (FrameworkElement)transitionContainer.Items[1]; FlipTransition transition = Resources["FlipTransition"] as FlipTransition; transition.Rotation = Direction.RightToLeft; transitionContainer.Transition = transition; transitionContainer.TransitionCompleted -= OnTransitionCompleted; transitionContainer.ApplyTransition(firstItem, secondItem); } OnPropertyChanged("AllChannelConfigurations"); OnPropertyChanged("ChannelConfiguration"); e.Handled = true; }
/// <summary> /// Edits the channel. /// </summary> /// <param name="configuration">The configuration.</param> void EditChannel(ChannelConfiguration configuration) { if (configuration != null) { ChannelSetupControlPanel.Children.Clear(); // Setup Control ChannelSetupControl setupControl = new ChannelSetupControl(configuration.Clone()); setupControl.IsInEditModus = true; setupControl.Username = configuration.InputChannel.Authentication.Username; setupControl.HorizontalAlignment = HorizontalAlignment.Center; setupControl.VerticalAlignment = VerticalAlignment.Center; setupControl.OnValidationFinished += OnValidationFinishedHandler; setupControl.OnCancel += OnCancelHandler; setupControl.RenderTransform = new TranslateTransform(0, 0); ChannelSetupControlPanel.Children.Add(setupControl); // Play Animation var firstItem = (FrameworkElement)transitionContainer.Items[0]; var secondItem = (FrameworkElement)transitionContainer.Items[1]; FlipTransition transition = Resources["FlipTransition"] as FlipTransition; transition.Rotation = Direction.RightToLeft; transitionContainer.Transition = transition; transitionContainer.TransitionCompleted -= OnTransitionCompleted; transitionContainer.ApplyTransition(firstItem, secondItem); OnPropertyChanged("AllChannelConfigurations"); OnPropertyChanged("ChannelConfiguration"); } }