public VideoTranscodeViewModel() { OutputPathHistory = Settings.Default.TranscodeOutputDirectoryHistory; OkCommand = new Command(async() => { CancellableOperationProgressView progress = new CancellableOperationProgressView(); VideoTranscodeProgressViewModel vm = new VideoTranscodeProgressViewModel(this); progress.DataContext = vm; vm.WindowIcon = IconUri; Task task = vm.startTranscodeAsync(); progress.Show(); OnClosingRequest(); await task; MiscUtils.insertIntoHistoryCollection(Settings.Default.TranscodeOutputDirectoryHistory, OutputPath); }); DefaultsCommand = new Command(() => { setDefaults(); }); CancelCommand = new Command(() => { OnClosingRequest(); }); DirectoryPickerCommand = new Command(() => { DirectoryPickerView directoryPicker = new DirectoryPickerView(); DirectoryPickerViewModel vm = (DirectoryPickerViewModel)directoryPicker.DataContext; vm.InfoString = "Select Transcode Output Path"; vm.SelectedPath = OutputPath; vm.PathHistory = OutputPathHistory; if (directoryPicker.ShowDialog() == true) { OutputPath = vm.SelectedPath; } }); SupportedAudioEncoders = new ListCollectionView(Enum.GetValues(typeof(AudioEncoders))); SupportedAudioEncoders.Filter = supportedAudioEncodersFilter; SupportedVideoEncoders = new ListCollectionView(Enum.GetValues(typeof(VideoEncoders))); SupportedVideoEncoders.Filter = supportedVideoEncodersFilter; Items = new List <VideoAudioPair>(); Title = "Transcode Video(s)"; IconUri = "/MediaViewer;component/Resources/Icons/videofile.ico"; setDefaults(); IsTimeRangeEnabled = false; StartTimeRange = 0; EndTimeRange = 0; }
public VideoTranscodeViewModel() { OutputPathHistory = Settings.Default.TranscodeOutputDirectoryHistory; OkCommand = new Command(async () => { CancellableOperationProgressView progress = new CancellableOperationProgressView(); VideoTranscodeProgressViewModel vm = new VideoTranscodeProgressViewModel(this); progress.DataContext = vm; vm.WindowIcon = IconUri; Task task = vm.startTranscodeAsync(); progress.Show(); OnClosingRequest(); await task; MiscUtils.insertIntoHistoryCollection(Settings.Default.TranscodeOutputDirectoryHistory, OutputPath); }); DefaultsCommand = new Command(() => { setDefaults(); }); CancelCommand = new Command(() => { OnClosingRequest(); }); DirectoryPickerCommand = new Command(() => { DirectoryPickerView directoryPicker = new DirectoryPickerView(); DirectoryPickerViewModel vm = (DirectoryPickerViewModel)directoryPicker.DataContext; vm.InfoString = "Select Transcode Output Path"; vm.SelectedPath = OutputPath; vm.PathHistory = OutputPathHistory; if (directoryPicker.ShowDialog() == true) { OutputPath = vm.SelectedPath; } }); SupportedAudioEncoders = new ListCollectionView(Enum.GetValues(typeof(AudioEncoders))); SupportedAudioEncoders.Filter = supportedAudioEncodersFilter; SupportedVideoEncoders = new ListCollectionView(Enum.GetValues(typeof(VideoEncoders))); SupportedVideoEncoders.Filter = supportedVideoEncodersFilter; Items = new List<VideoAudioPair>(); Title = "Transcode Video(s)"; IconUri = "/MediaViewer;component/Resources/Icons/videofile.ico"; setDefaults(); IsTimeRangeEnabled = false; StartTimeRange = 0; EndTimeRange = 0; }