public ImageTranscodeViewModel() { OkCommand = new Command(async () => { CancellableOperationProgressView progress = new CancellableOperationProgressView(); ImageTranscodeProgressViewModel vm = new ImageTranscodeProgressViewModel(this); progress.DataContext = vm; Task task = vm.startTranscodeAsync(); progress.Show(); OnClosingRequest(); await task; MiscUtils.insertIntoHistoryCollection(Settings.Default.ImageTranscodeOutputDirectoryHistory, 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; } }); OutputPathHistory = Settings.Default.ImageTranscodeOutputDirectoryHistory; OutputFormatCollectionView = new ListCollectionView(outFormats); JpegRotationCollectionView = new ListCollectionView(Enum.GetNames(typeof(Rotation))); PngInterlacingCollectionView = new ListCollectionView(Enum.GetNames(typeof(PngInterlaceOption))); TiffCompressionCollectionView = new ListCollectionView(Enum.GetNames(typeof(TiffCompressOption))); setDefaults(); }
public ImageTranscodeViewModel() { OkCommand = new Command(async() => { CancellableOperationProgressView progress = new CancellableOperationProgressView(); ImageTranscodeProgressViewModel vm = new ImageTranscodeProgressViewModel(this); progress.DataContext = vm; Task task = vm.startTranscodeAsync(); progress.Show(); OnClosingRequest(); await task; MiscUtils.insertIntoHistoryCollection(Settings.Default.ImageTranscodeOutputDirectoryHistory, 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; } }); OutputPathHistory = Settings.Default.ImageTranscodeOutputDirectoryHistory; OutputFormatCollectionView = new ListCollectionView(outFormats); JpegRotationCollectionView = new ListCollectionView(Enum.GetNames(typeof(Rotation))); PngInterlacingCollectionView = new ListCollectionView(Enum.GetNames(typeof(PngInterlaceOption))); TiffCompressionCollectionView = new ListCollectionView(Enum.GetNames(typeof(TiffCompressOption))); setDefaults(); }