using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using C4IT.Logging; using WpfAnimatedGif; using static C4IT.Logging.cLogManager; namespace FasdDesktopUi.Basics.UserControls { public partial class PauseCaseOverlay : UserControl { public event EventHandler OnPauseEnd; public PauseCaseOverlay() { InitializeComponent(); } private async void EndPause() { try { var imageSource = new BitmapImage(); imageSource.BeginInit(); imageSource.UriSource = new Uri("pack://application:,,,/Resources/F4SD_logo_forward.gif"); ImageBehavior.SetAnimatedSource(HeroGif, imageSource); await Task.Delay(900); if (OnPauseEnd != null) OnPauseEnd?.Invoke(this, new EventArgs()); } catch (Exception E) { LogException(E); } } private void PlayButton_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { EndPause(); } private void StackPanel_TouchDown(object sender, TouchEventArgs e) { EndPause(); } private void UserControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { if (this.Visibility == Visibility.Visible) { var imageSource = new BitmapImage(); imageSource.BeginInit(); imageSource.UriSource = new Uri("pack://application:,,,/Resources/F4SD_logo_reverse.gif"); ImageBehavior.SetAnimatedSource(HeroGif, imageSource); } } } }