コード例 #1
0
 public PhotoController(
     IMapper mapper,
     IPhotoFinder photoFinder
     )
 {
     this._mapper     = mapper;
     this.photoFinder = photoFinder;
 }
コード例 #2
0
 public BugReportController(IBugReportFinder bugReportFinder,
                            IBugReportRater bugReportRater,
                            IMapper mapper,
                            IUserFinder userFinder,
                            ICommentCreator commentCreator,
                            IBugReportCreator bugReportCreator,
                            IPhotoFinder photoFinder
                            )
 {
     this.userFinder       = userFinder;
     this.bugReportFinder  = bugReportFinder;
     this.bugReportRater   = bugReportRater;
     this.bugReportCreator = bugReportCreator;
     this._mapper          = mapper;
     this.commentCreator   = commentCreator;
     this.photoFinder      = photoFinder;
 }
コード例 #3
0
ファイル: Averager.cs プロジェクト: kalantyr/Art
        public Bitmap CreateSumImage(IPhotoFinder photoFinder)
        {
            if (photoFinder == null)
            {
                throw new ArgumentNullException("photoFinder");
            }

            var redMatrix   = new int[0, 0];
            var greenMatrix = new int[0, 0];
            var blueMatrix  = new int[0, 0];
            var size        = Size.Empty;
            var count       = 0;

            foreach (var photo in photoFinder.GetPhotos())
            {
                if (count == 0)
                {
                    size        = new Size(photo.Width, photo.Height);
                    redMatrix   = new int[size.Height, size.Width];
                    greenMatrix = new int[size.Height, size.Width];
                    blueMatrix  = new int[size.Height, size.Width];
                }

                if (size.Width != photo.Width || size.Height != photo.Height)
                {
                    throw new InvalidOperationException("Разный размер фотографий.");
                }

                Calculate(photo, size, redMatrix, greenMatrix, blueMatrix);

                photo.Dispose();

                count++;
            }

            if (count == 0)
            {
                throw new InvalidOperationException("Не найдено ни одной фотографии.");
            }

            return(GetResult(count, size, redMatrix, greenMatrix, blueMatrix));
        }