Esempio n. 1
0
        public void LoadPublicImages(IRestResponse response)
        {
            if (response.StatusCode == HttpStatusCode.OK)
            {
                PublicImagesContainer.Children.Clear();
                JArray responseImages = JArray.Parse(response.Content);
                for (int i = 0; i < responseImages.Count; i++)
                {
                    dynamic data  = JObject.Parse(responseImages[i].ToString());
                    Image   image = new Image
                    {
                        id              = data["id"],
                        ownerId         = data["ownerId"],
                        title           = data["title"],
                        protectionLevel = data["protectionLevel"],
                        password        = data["password"],
                        thumbnailUrl    = Settings.URL_TO_GALLERY_IMAGES + data["id"] + ".png",
                        fullImageUrl    = Settings.URL_TO_GALLERY_IMAGES + data["id"] + ".png",
                        authorName      = data["authorName"]
                    };

                    GalleryCard galleryCard = new GalleryCard(image);
                    galleryCard.ViewButtonClicked += ViewButton_Click;
                    PublicImagesContainer.Children.Add(galleryCard);
                }
            }
            else
            {
                MessageBox.Show("Could not load the images", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 2
0
        public void LoadMyImages(string response)
        {
            MyImagesContainer.Children.Clear();
            JArray responseImages = JArray.Parse(response);

            for (int i = 0; i < responseImages.Count; i++)
            {
                dynamic data  = JObject.Parse(responseImages[i].ToString());
                Image   image = new Image
                {
                    id              = data["id"],
                    ownerId         = data["ownerId"],
                    title           = data["title"],
                    protectionLevel = data["protectionLevel"],
                    password        = data["password"],
                    thumbnailUrl    = ServerService.instance.isOffline() ? data["thumbnailUrl"] : Settings.URL_TO_GALLERY_IMAGES + data["id"] + ".png",
                    fullImageUrl    = ServerService.instance.isOffline() ? data["thumbnailUrl"] : Settings.URL_TO_GALLERY_IMAGES + data["id"] + ".png",
                    authorName      = data["authorName"]
                };


                GalleryCard galleryCard = new GalleryCard(image);
                galleryCard.ViewButtonClicked += ViewButton_Click;
                MyImagesContainer.Children.Add(galleryCard);
            }
        }