Ejemplo n.º 1
0
        public override void Execute(object parameter)
        {
            DateTime   startTime = DateTime.Now;
            ResizeWork resize    = GetResizeWork();

            resize.TargetFileName = ViewModel.GetResizeFileName(resize);
            resize.Execute(ViewModel.ImageFile, ViewModel.TargetDirectory);

            ViewModel.ElapsedTime = DateTime.Now.Subtract(startTime);
        }
Ejemplo n.º 2
0
        protected ResizeWork GetResizeWork()
        {
            var resize = new ResizeWork()
            {
                KeepAspectRatio = ViewModel.KeepAspectRatio,
                Optimize        = ViewModel.OptimizeTarget,
                Quality         = ViewModel.TargetQuality,
                Height          = ViewModel.TargetHeight,
                Width           = ViewModel.TargetWidth,
                //SpaceAlternative = '_',
                TargetExtension = ViewModel.TargetExtension,
                //TargetFileName = ViewModel.ResizeFileName
            };

            return(resize);
        }
Ejemplo n.º 3
0
        public string GetResizeFileName(ResizeWork resizeWork)
        {
            if (ImageFile == null)
            {
                return(string.Empty);
            }

            if (resizeWork.Width == resizeWork.Height)
            {
                return(string.Format("{0}-{1}",
                                     Path.GetFileNameWithoutExtension(ImageFile.Name),
                                     resizeWork.Height));
            }
            else
            {
                return(string.Format("{0}-{1}x{2}",
                                     Path.GetFileNameWithoutExtension(ImageFile.Name),
                                     resizeWork.Width,
                                     resizeWork.Height));
            }
        }
Ejemplo n.º 4
0
        public override void Execute(object parameter)
        {
            ResizeWork resize = GetResizeWork();

            ViewModel.ResizeWorks.Add(resize);
        }