/// <summary>
        /// Loads the Texture and meta data of a Photo into this thumbnail
        /// </summary>
        /// <param name="photoDownloaded">Already downloaded photo data</param>
        public void Initialize(PhotoDownloaded photoDownloaded)
        {
            photoDownloadedData = photoDownloaded;

            var photoSize = new Vector2(Mathf.Min(photoDownloaded.Texture.width, imageSize.x),
                                        Mathf.Min(photoDownloaded.Texture.height, imageSize.y));

            photoThumbnail.sprite = Sprite.Create(photoDownloadedData.Texture as Texture2D, new Rect(0, 0, photoSize.x, photoSize.y), new Vector2(0.5f, 0.5f));
            photoLabel.text       = photoDownloadedData.MetaData.Title;
        }
        private PhotoThumbController AddPhotoToGallery(PhotoDownloaded photo, int column = 0, int row = 0)
        {
            var startingPosition = new Vector3(-590f, 195f, 0f);
            var pos        = startingPosition + new Vector3(column * 260f, row * -260f, 0f);
            var gameObject = photoPanelsPool.BorrowObject(galleryPanel.transform);

            gameObject.GetComponent <RectTransform>().localPosition = pos;
            var photoPanel = gameObject.GetComponent <PhotoThumbController>();

            photoPanel.Initialize(photo);

            photoPanel.thumbClicked += photoView.OpenPanel;

            return(photoPanel);
        }
        /// <summary>
        /// Activates the photo view window with given photo and its info
        /// </summary>
        /// <param name="photoDownloaded">Already downloaded photo data</param>
        public void OpenPanel(PhotoDownloaded photoDownloaded)
        {
            // if the panel is already open we don't consider the click on another photo underneath it
            if (PanelOpen)
            {
                return;
            }

            var photoSize = new Vector2(Mathf.Min(photoDownloaded.Texture.width, imageSize.x),
                                        Mathf.Min(photoDownloaded.Texture.height, imageSize.y));

            photoImage.sprite     = Sprite.Create(photoDownloaded.Texture as Texture2D, new Rect(0, 0, photoSize.x, photoSize.y), new Vector2(0.5f, 0.5f));
            photoTitle.text       = photoDownloaded.MetaData.Title;
            photoDescription.text = string.Format("ID: {0}\nServer: {1}\nFarm: {2}\nSecret: {3}",
                                                  photoDownloaded.MetaData.Id, photoDownloaded.MetaData.ServerId, photoDownloaded.MetaData.Farm, photoDownloaded.MetaData.Secret);

            gameObject.SetActive(true);
        }