public OverlayEffectBase(OverlayEffectTypeEnum effectType, OverlayEffectEntranceAnimationTypeEnum entrance, OverlayEffectVisibleAnimationTypeEnum visible, OverlayEffectExitAnimationTypeEnum exit, double duration, int horizontal, int vertical) { this.EffectType = effectType; this.EntranceAnimation = entrance; this.VisibleAnimation = visible; this.ExitAnimation = exit; this.Duration = duration; this.Horizontal = horizontal; this.Vertical = vertical; }
private void OverlayTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { this.ImageGrid.Visibility = Visibility.Collapsed; this.TextGrid.Visibility = Visibility.Collapsed; this.YouTubeGrid.Visibility = Visibility.Collapsed; this.VideoGrid.Visibility = Visibility.Collapsed; this.WebPageGrid.Visibility = Visibility.Collapsed; this.HTMLGrid.Visibility = Visibility.Collapsed; this.AdditionalOptionsGrid.Visibility = Visibility.Collapsed; if (this.TypeComboBox.SelectedIndex >= 0) { OverlayEffectTypeEnum overlayType = EnumHelper.GetEnumValueFromString <OverlayEffectTypeEnum>((string)this.TypeComboBox.SelectedItem); if (overlayType == OverlayEffectTypeEnum.Image) { this.ImageGrid.Visibility = Visibility.Visible; } else if (overlayType == OverlayEffectTypeEnum.Text) { this.TextGrid.Visibility = Visibility.Visible; } else if (overlayType == OverlayEffectTypeEnum.YouTube) { this.YouTubeGrid.Visibility = Visibility.Visible; } else if (overlayType == OverlayEffectTypeEnum.Video) { this.VideoGrid.Visibility = Visibility.Visible; } else if (overlayType == OverlayEffectTypeEnum.WebPage) { this.WebPageGrid.Visibility = Visibility.Visible; } else if (overlayType == OverlayEffectTypeEnum.HTML) { this.HTMLGrid.Visibility = Visibility.Visible; } this.AdditionalOptionsGrid.Visibility = Visibility.Visible; } }
public override ActionBase GetAction() { double duration; if (double.TryParse(this.DurationTextBox.Text, out duration) && duration > 0 && this.EntranceAnimationComboBox.SelectedIndex >= 0 && this.VisibleAnimationComboBox.SelectedIndex >= 0 && this.ExitAnimationComboBox.SelectedIndex >= 0) { OverlayEffectEntranceAnimationTypeEnum entrance = EnumHelper.GetEnumValueFromString <OverlayEffectEntranceAnimationTypeEnum>((string)this.EntranceAnimationComboBox.SelectedItem); OverlayEffectVisibleAnimationTypeEnum animation = EnumHelper.GetEnumValueFromString <OverlayEffectVisibleAnimationTypeEnum>((string)this.VisibleAnimationComboBox.SelectedItem); OverlayEffectExitAnimationTypeEnum exit = EnumHelper.GetEnumValueFromString <OverlayEffectExitAnimationTypeEnum>((string)this.ExitAnimationComboBox.SelectedItem); int horizontal = 0; int vertical = 0; if (this.PositionSimpleAdvancedToggleButton.IsChecked.GetValueOrDefault()) { horizontal = (int)this.HorizontalSlider.Value; vertical = (int)this.VerticalSlider.Value; } else { if (this.IsSimplePositionButtonSelected(this.TopLeftPositionButton)) { horizontal = 25; vertical = 25; } else if (this.IsSimplePositionButtonSelected(this.TopPositionButton)) { horizontal = 50; vertical = 25; } else if (this.IsSimplePositionButtonSelected(this.TopRightPositionButton)) { horizontal = 75; vertical = 25; } else if (this.IsSimplePositionButtonSelected(this.LeftPositionButton)) { horizontal = 25; vertical = 50; } else if (this.IsSimplePositionButtonSelected(this.CenterPositionButton)) { horizontal = 50; vertical = 50; } else if (this.IsSimplePositionButtonSelected(this.RightPositionButton)) { horizontal = 75; vertical = 50; } else if (this.IsSimplePositionButtonSelected(this.BottomLeftPositionButton)) { horizontal = 25; vertical = 75; } else if (this.IsSimplePositionButtonSelected(this.BottomPositionButton)) { horizontal = 50; vertical = 75; } else if (this.IsSimplePositionButtonSelected(this.BottomRightPositionButton)) { horizontal = 75; vertical = 75; } } OverlayEffectTypeEnum type = EnumHelper.GetEnumValueFromString <OverlayEffectTypeEnum>((string)this.TypeComboBox.SelectedItem); if (type == OverlayEffectTypeEnum.Image) { if (!string.IsNullOrEmpty(this.ImageFilePathTextBox.Text)) { int width; int height; if (int.TryParse(this.ImageWidthTextBox.Text, out width) && width > 0 && int.TryParse(this.ImageHeightTextBox.Text, out height) && height > 0) { return(new OverlayAction(new OverlayImageEffect(this.ImageFilePathTextBox.Text, width, height, entrance, animation, exit, duration, horizontal, vertical))); } } } else if (type == OverlayEffectTypeEnum.Text) { if (!string.IsNullOrEmpty(this.TextTextBox.Text) && !string.IsNullOrEmpty(this.FontColorComboBox.Text)) { string color = this.FontColorComboBox.Text; if (ColorSchemes.ColorSchemeDictionary.ContainsKey(color)) { color = ColorSchemes.ColorSchemeDictionary[color]; } if (int.TryParse(this.FontSizeComboBox.Text, out int size) && size > 0) { return(new OverlayAction(new OverlayTextEffect(this.TextTextBox.Text, color, size, entrance, animation, exit, duration, horizontal, vertical))); } } } else if (type == OverlayEffectTypeEnum.YouTube) { if (!string.IsNullOrEmpty(this.YoutubeVideoIDTextBox.Text)) { string videoID = this.YoutubeVideoIDTextBox.Text; videoID = videoID.Replace("https://www.youtube.com/watch?v=", ""); videoID = videoID.Replace("https://youtu.be/", ""); if (videoID.Contains("&")) { videoID = videoID.Substring(0, videoID.IndexOf("&")); } if (int.TryParse(this.YoutubeStartTimeTextBox.Text, out int startTime)) { int width; int height; if (int.TryParse(this.YoutubeWidthTextBox.Text, out width) && width > 0 && int.TryParse(this.YoutubeHeightTextBox.Text, out height) && height > 0) { return(new OverlayAction(new OverlayYoutubeEffect(videoID, startTime, width, height, entrance, animation, exit, duration, horizontal, vertical))); } } } } else if (type == OverlayEffectTypeEnum.Video) { if (!string.IsNullOrEmpty(this.VideoFilePathTextBox.Text)) { int width; int height; if (int.TryParse(this.VideoWidthTextBox.Text, out width) && width > 0 && int.TryParse(this.VideoHeightTextBox.Text, out height) && height > 0) { return(new OverlayAction(new OverlayVideoEffect(this.VideoFilePathTextBox.Text, width, height, entrance, animation, exit, duration, horizontal, vertical))); } } } else if (type == OverlayEffectTypeEnum.WebPage) { if (!string.IsNullOrEmpty(this.WebPageFilePathTextBox.Text)) { int width; int height; if (int.TryParse(this.WebPageWidthTextBox.Text, out width) && width > 0 && int.TryParse(this.WebPageHeightTextBox.Text, out height) && height > 0) { return(new OverlayAction(new OverlayWebPageEffect(this.WebPageFilePathTextBox.Text, width, height, entrance, animation, exit, duration, horizontal, vertical))); } } } else if (type == OverlayEffectTypeEnum.HTML) { if (!string.IsNullOrEmpty(this.HTMLTextBox.Text)) { return(new OverlayAction(new OverlayHTMLEffect(this.HTMLTextBox.Text, entrance, animation, exit, duration, horizontal, vertical))); } } } return(null); }