private void ShrinkFiles(IReadOnlyCollection<string> files)
        {
            Debug.Assert(files != null);
            Debug.Assert(files.Count > 0);

            var renamer = new RenamingService("{0} ({1}px)", _model.OverwriteOriginal, _model.RequestedSize);
            var shrinker = new ShrinkingService(renamer, _model.RequestedSize);

            _model.Busy = true;
            _model.Progress.Reset();
            _model.Progress.MaximumSteps = files.Count+1;
            _model.Progress.CurrentStep = 1;

            foreach (var file in files)
            {
                _model.Progress.AddMessage(file + " -> " + renamer.Rename(file));
                try
                {
                    shrinker.Shrink(file);
                }
                catch (Exception ex)
                {
                    _model.Progress.AddMessage("Error: " + ex.Message);
                }

                _model.Progress.CurrentStep++;
            }

            _model.Busy = false;
            _model.Progress.CurrentStep = 0;
        }
        public ShrinkingService(RenamingService renamer, int targetSize, int encoderQualityLevel = 85)
        {
            Debug.Assert(encoderQualityLevel >= 1 && encoderQualityLevel <= 100);
            Debug.Assert(targetSize > 0);

            _encoderQualityLevel = encoderQualityLevel;
            _targetSize = targetSize;
            _renamer = renamer;
        }