private async void SelectedVideo_Drop(object sender, DragEventArgs e) { if (e.DataView.Contains(StandardDataFormats.StorageItems)) { var items = await e.DataView.GetStorageItemsAsync(); if (items.Count > 0) { var file = items[0] as StorageFile; if (file.ContentType == "video/mp4" || file.ContentType == "video/x-matroska") { _videoFile = file; selectedVideoFileTextBlock.Text = _videoFile.DisplayName; _video = await MediaClip.CreateFromFileAsync(_videoFile); SetTimeSliders(_video.OriginalDuration); GenerateButtonEnable(); var enc = _video.GetVideoEncodingProperties(); Resolutions = new SavingResolutionsCollection(enc); saveResolutionSelector.ItemsSource = Resolutions; saveResolutionSelector.SelectedIndex = 0; AllowToWatchVideoBeforeGenerating(true); } } } GenerateButtonEnable(); }
private async void addVideoButton_Click(object sender, RoutedEventArgs e) { StorageFile file; IReadOnlyList <StorageFile> files; files = await LoadFile("single", ".mp4"); if (files.Count != 0) { file = files[0]; if (file.ContentType == "video/mp4") { _videoFile = file; selectedVideoFileTextBlock.Text = _videoFile.DisplayName; _video = await MediaClip.CreateFromFileAsync(_videoFile); SetTimeSliders(_video.OriginalDuration); GenerateButtonEnable(); var enc = _video.GetVideoEncodingProperties(); Resolutions = new SavingResolutionsCollection(enc); saveResolutionSelector.ItemsSource = Resolutions; saveResolutionSelector.SelectedIndex = 0; AllowToWatchVideoBeforeGenerating(true); } } }