Esempio n. 1
0
        private async Task SetBackground()
        {
            if (AnyListenSettings.Instance.Config.ApplicationDesign.ApplicationBackground == null || !AnyListenSettings.Instance.Config.ApplicationDesign.ApplicationBackground.IsAvailable)
            {
                BackgroundImage.Source = null;
                BackgroundMediaElement.Visibility = Visibility.Collapsed;
                return;
            }

            if (AnyListenSettings.Instance.Config.ApplicationDesign.ApplicationBackground.IsAnimated)
            {
                BackgroundImage.Source = null;
                BackgroundMediaElement.Visibility = Visibility.Visible;
                BackgroundMediaElement.Source =
                    AnyListenSettings.Instance.Config.ApplicationDesign.ApplicationBackground.GetBackground();
                BackgroundMediaElement.Play();
            }
            else
            {
                BackgroundMediaElement.Source = null;
                BackgroundMediaElement.Visibility = Visibility.Collapsed;
                BackgroundImage.Visibility = Visibility.Visible;
                BackgroundImage.Source = await Task.Run(() =>
                {
                    var img =
                        new BitmapImage(
                            AnyListenSettings.Instance.Config.ApplicationDesign.ApplicationBackground.GetBackground());
                    img.Freeze();
                    return img;
                });
            }
        }
 private void BackgroundMediaElement_MediaEnded(object sender, RoutedEventArgs e)
 {
     if (_initialized)
     {
         BackgroundMediaElement.Position = TimeSpan.Zero;
         BackgroundMediaElement.Play();
     }
 }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            Initialize();

            BackgroundMediaElement.Source = new Uri("/Assets/Video/oceantrip-small.mp4", UriKind.Relative);

            if (BackgroundMediaElement.Visibility == Visibility.Visible)
            {
                BackgroundMediaElement.Position = TimeSpan.Zero;
                BackgroundMediaElement.Play();
            }
        }
 private void FilteredImage_Tap(object sender, System.Windows.Input.GestureEventArgs e)
 {
     if (BackgroundMediaElement.Visibility == Visibility.Collapsed)
     {
         BackgroundMediaElement.Position = TimeSpan.Zero;
         BackgroundMediaElement.Play();
         BackgroundMediaElement.Visibility = Visibility.Visible;
     }
     else
     {
         BackgroundMediaElement.Stop();
         BackgroundMediaElement.Visibility = Visibility.Collapsed;
     }
 }