private async void AddFile_Click(object sender, RoutedEventArgs e) { var picker = new Windows.Storage.Pickers.FileOpenPicker(); picker.ViewMode = Windows.Storage.Pickers.PickerViewMode.Thumbnail; picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.PicturesLibrary; picker.FileTypeFilter.Add(".mov"); var files = await picker.PickMultipleFilesAsync(); if (files.Count > 0) { foreach (var item in files) { HevcFile hevcFile = new HevcFile(); hevcFile.FileName = item.Name; hevcFile.FilePath = item.Path; hevcFile.IsFinished = false; hevcFile.Percentage = 0; hevcFile.Speed = 0; string temp = item.Path; hevcFile.TargetPath = temp.Insert(temp.Length - item.FileType.Length, "_done"); ViewModel.Files.Add(hevcFile); } } else { } this.dataGrid.ItemsSource = null; this.dataGrid.ItemsSource = ViewModel.Files; }
private void Add_Click(object sender, RoutedEventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Multiselect = true; if (openFileDialog.ShowDialog() == true) { foreach (var item in openFileDialog.FileNames) { HevcFile hevcFile = new HevcFile(); hevcFile.VInfo = new FFMpegCore.VideoInfo(item); hevcFile.FileName = hevcFile.VInfo.Name; hevcFile.FilePath = hevcFile.VInfo.FullName; hevcFile.IsFinished = false; string temp = hevcFile.FilePath; hevcFile.TargetPath = temp.Insert(temp.Length - hevcFile.VInfo.Extension.Length, "_done"); hevcFile.TargetPath = temp.Substring(0, temp.Length - hevcFile.VInfo.Extension.Length); hevcFile.TargetPath += ".mp4"; ViewModel.Files.Add(hevcFile); } } }
public ConverterListViewModel(HevcFile model = null) => Model = model ?? new HevcFile();