/// <summary> /// Scale all the assets in the listbox according to the slider 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; VideoPreviewTimeline videoPreview = preview as VideoPreviewTimeline; 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> /// 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; VideoPreviewTimeline preview = sender as VideoPreviewTimeline; 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; // }); this.AssetsList.GetChildControls <VideoPreviewTimeline>(). 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); } }
/// <summary> /// Called when [mouse wheel] event occures. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The <see cref="MouseWheelEventArgs"/> instance containing the event data.</param> private void OnMouseWheel(object sender, MouseWheelEventArgs args) { if (this.Model.IsActive) { Point point = args.GetPosition(this); if ((point.X >= 0 && point.X <= this.ActualWidth) && (point.Y >= 0 && point.Y <= this.ActualHeight)) { VideoPreviewTimeline preview = this.currentAsset as VideoPreviewTimeline; if (preview == null || !preview.IsFullScreen) { double delta = args.Delta; if (delta > 0) { if (this.ZoomSlider.Value + ShiftScaleMargin <= 1) { this.ZoomSlider.Value += ShiftScaleMargin; } else if (this.ZoomSlider.Value != 1) { this.ZoomSlider.Value = 1; } } else if (delta < 0) { if (this.ZoomSlider.Value - ShiftScaleMargin >= 0) { this.ZoomSlider.Value -= ShiftScaleMargin; } else if (this.ZoomSlider.Value != 0) { this.ZoomSlider.Value = 0; } } } } } }
/// <summary> /// Adds the asset to timeline. /// </summary> private void AddAssetToTimeline() { Asset selectedAsset = this.AssetsList.SelectedItem as Asset; if (selectedAsset != null && !(selectedAsset is FolderAsset)) { if (selectedAsset is VideoAsset) { // VideoPreview preview = this.AssetsList.GetChildControls<VideoPreview>().Where(x => x.Asset == selectedAsset).Single(); VideoPreviewTimeline preview = this.AssetsList.GetChildControls <VideoPreviewTimeline>().Where(x => x.Asset == selectedAsset).Single(); VideoAsset videoAsset = selectedAsset as VideoAsset; VideoAssetInOut videoAssetInOut = new VideoAssetInOut(videoAsset) { InPosition = preview.InPosition.TotalSeconds, OutPosition = preview.OutPosition.TotalSeconds }; this.Model.AddAssetToTimeline(videoAssetInOut); } else { this.Model.AddAssetToTimeline(selectedAsset); } } }