Esempio n. 1
0
        /// <summary>
        /// Handles the Changed event of the FullScreen control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void FullScreen_Changed(object sender, EventArgs e)
        {
            VideoPreview preview = sender as VideoPreview;

            if (preview != null)
            {
                // Check if there is any other VideoPreview which is in full screen mode. If yes then bring it to normal mode.
                this.AssetsList.GetChildControls <VideoPreview>().
                Where(x => x.IsFullScreen && x != preview).ToList().
                ForEach(y =>
                {
                    y.Scale(this.currentAssetSize);
                    y.IsFullScreen = false;
                });

                if (preview.IsFullScreen)
                {
                    preview.Scale(this.GetAssetFullScreenSize);
                }
                else
                {
                    preview.Scale(this.currentAssetSize);
                    preview.IsFullScreen = false;
                }

                // Update the layout so that the row heigts of the element can be calulated.
                this.AssetsList.UpdateLayout();

                // Set the offset of the scrollbar.
                this.SetScrollerOffset(preview.Asset);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Scales all the assest previews of the view according to the current scale value.
        /// </summary>
        private void UpdateZoom()
        {
            if (this.ZoomSlider != null)
            {
                IList <AssetPreview> previews = this.AssetsList.GetChildControls <AssetPreview>();

                foreach (AssetPreview preview in previews)
                {
                    VideoPreview videoPreview = preview as VideoPreview;

                    if (videoPreview != null && videoPreview.IsFullScreen)
                    {
                        if (this.lstSizeChanging)
                        {
                            preview.Scale(this.GetAssetFullScreenSize);
                        }
                        else
                        {
                            videoPreview.IsFullScreen = false;
                            preview.Scale(this.currentAssetSize);
                        }
                    }
                    else
                    {
                        preview.Scale(this.currentAssetSize);
                    }
                }
            }
        }
        /// <summary>
        /// Change the preview image of the asset as asset is changed.
        /// </summary>
        /// <param name="d">The <see cref="DependencyObject"/>.</param>
        /// <param name="e">The <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> instance containing the event data.</param>
        private static void AssetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            VideoPreview preview = d as VideoPreview;

            if (preview != null && preview.thumbnailService != null)
            {
                Uri frameUri = new Uri(preview.thumbnailService.GetThumbnailSource(preview.Asset), UriKind.RelativeOrAbsolute);
                preview.FramePreviewImage.Source = new BitmapImage(frameUri);
            }
        }