public MainViewModel() { _images = new ImageFiles(); _images.CollectionChanged += (sender, e) => { CheckCanConvert(); CheckCanClear(); }; ImageTypes = new[] { ImageFormat.Jpeg, ImageFormat.Png, ImageFormat.Tiff, ImageFormat.Gif, ImageFormat.Bmp, }; DefaultSizes = new object[] { 640, 800, 1024, 1280, "Custom" }; _errors = new Dictionary <string, List <string> >(); _addImagesCommand = new RelayCommand(param => AddImages()); _removeImagesCommand = new RelayCommand(param => { var selectedItems = ((IEnumerable <object>)param).Cast <ImageFile>().ToList(); RemoveImages(selectedItems); }); _changeOutputCommand = new RelayCommand(param => ChangeOutput()); _clearCommand = new RelayCommand(param => Clear()); _outputPath = Directory.GetCurrentDirectory(); }
public ConversionProgress(ImageFiles images, bool changeFormat, ImageFormat convertTo, int quality, bool changeSize, int size, bool resizeSmaller, bool overwrite, string outputPath) { _images = images; _outputPath = outputPath; _statusText = new StringBuilder(); _cancelCommand = new RelayCommand(param => Cancel()); _openFolderCommand = new RelayCommand(param => OpenFolder()); _log = new FileLog(); if (changeSize) { _sizeConverter = new ImageSizeConverter(size, resizeSmaller); } if (changeFormat && convertTo.Equals(ImageFormat.Jpeg)) { _storage = new JpgImageStorage(outputPath, quality, overwrite); } else { _storage = new DefaultImageStorage(outputPath, changeFormat ? convertTo : null, overwrite); } }