/// <summary>
        /// Fired when the media state changes
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MediaElement_CurrentStateChanged(object sender, RoutedEventArgs e)
        {
            // Check to hide the loading.
            if (m_youTubeVideo.CurrentState != MediaElementState.Opening)
            {
                // When we get to the state paused hide loading.
                if (!m_hasHiddenLoading)
                {
                    m_hasHiddenLoading = true;
                    m_host.HideLoading();
                    ui_storyContentRoot.Begin();
                }
            }

            // If we are playing request for the screen not to turn off.
            if (m_youTubeVideo.CurrentState == MediaElementState.Playing)
            {
                if (m_displayRequest == null)
                {
                    m_displayRequest = new DisplayRequest();
                    m_displayRequest.RequestActive();
                }
            }
            else
            {
                // If anything else happens and we have a current request remove it.
                if (m_displayRequest != null)
                {
                    m_displayRequest.RequestRelease();
                    m_displayRequest = null;
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Fired when the media state changes
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MediaElement_CurrentStateChanged(object sender, RoutedEventArgs e)
 {
     if (m_youTubeVideo.CurrentState != MediaElementState.Opening)
     {
         // When we get to the state paused hide loading.
         if (!m_hasHiddenLoading)
         {
             m_hasHiddenLoading = true;
             m_host.HideLoading();
             ui_storyContentRoot.Begin();
         }
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Hide the loading text when the markdown is done.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MarkdownBox_OnMarkdownReady(object sender, OnMarkdownReadyArgs e)
 {
     if (e.WasError)
     {
         m_host.ShowError();
         App.BaconMan.TelemetryMan.ReportUnExpectedEvent(this, "FailedToShowMarkdown", e.Exception);
     }
     else
     {
         // Hide loading
         m_host.HideLoading();
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Calls hide loading on the host if we haven't already.
        /// </summary>
        private void HideLoading()
        {
            // Make sure we haven't been called before.
            lock (m_host)
            {
                if (m_loadingHidden)
                {
                    return;
                }
                m_loadingHidden = true;
            }

            // Hide it.
            m_host.HideLoading();
        }
        /// <summary>
        /// When the image is loaded size the actual image
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Image_Loaded(object sender, RoutedEventArgs e)
        {
            // Ignore zoom changes and update the zoom factors
            m_ignoreZoomChanges = true;

            SetScrollerZoomFactors();

            m_ignoreZoomChanges = false;

            // Hide the loading screen
            m_host.HideLoading();

            // Show the image
            ui_storyContentRoot.Begin();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Callback when we get the image.
        /// </summary>
        /// <param name="response"></param>
        public async void OnRequestComplete(object sender, ImageManager.ImageManagerResponseEventArgs response)
        {
            // Remove the event
            ImageManager.ImageManagerRequest request = (ImageManager.ImageManagerRequest)sender;
            request.OnRequestComplete -= OnRequestComplete;

            // Jump back to the UI thread
            await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                if (!response.Success)
                {
                    App.BaconMan.TelemetryMan.ReportUnExpectedEvent(this, "BasicImageControlNoImageUrl");
                    m_host.ShowError();
                    return;
                }

                lock (m_host)
                {
                    if (m_isDestoryed)
                    {
                        // Get out of here if we should be destroyed.
                        return;
                    }

                    // Create a bitmap and set the source
                    BitmapImage bitImage = new BitmapImage();
                    bitImage.SetSource(response.ImageStream);

                    // Add the image to the UI
                    m_image        = new Image();
                    m_image.Source = bitImage;
                    ui_contentRoot.Children.Add(m_image);

                    // Setup the save image tap
                    m_image.RightTapped += ContentRoot_RightTapped;
                    m_image.Holding     += ContentRoot_Holding;

                    // Hide the loading screen
                    m_host.HideLoading();

                    // Show the image
                    ui_storyContentRoot.Begin();
                }
            });
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Hides the loading and fades in the video when it start playing.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnVideoCurrentStateChanged(object sender, RoutedEventArgs e)
        {
            lock (this)
            {
                // If we start playing and the loading UI isn't hidden do so.
                if (!m_loadingHidden && m_gifVideo.CurrentState == MediaElementState.Playing)
                {
                    m_host.HideLoading();
                    ui_storyContentRoot.Begin();
                    m_loadingHidden = true;
                }

                // Make sure if we are playing that we should be (that we are actually visible)
                if (!m_shouldBePlaying && m_gifVideo.CurrentState == MediaElementState.Playing)
                {
                    m_gifVideo.Pause();
                }
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Hide the loading text when the markdown is done.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MarkdownBox_OnMarkdownReady(object sender, EventArgs e)
 {
     // Hide loading
     m_host.HideLoading();
 }