private void AddImage(bool broken, bool placeholder, bool round = false)
        {
            ImageExBase newImage = null;

            if (round)
            {
                #pragma warning disable CS0618 // Type or member is obsolete
                newImage = new RoundImageEx
                {
                };
                #pragma warning restore CS0618 // Type or member is obsolete

                if (resources?.ContainsKey("RoundStyle") == true)
                {
                    newImage.Style = resources["RoundStyle"] as Style;
                }
            }
            else
            {
                newImage = new ImageEx();

                if (resources?.ContainsKey("RectangleStyle") == true)
                {
                    newImage.Style = resources["RectangleStyle"] as Style;
                }
            }

            newImage.Source = broken ? photos[imageIndex].Thumbnail + "broken" : photos[imageIndex].Thumbnail;

            if (placeholder)
            {
                newImage.PlaceholderSource = new BitmapImage(new Uri("ms-appx:///Assets/Photos/ImageExPlaceholder.jpg"));
            }

            container?.Children?.Add(newImage);

            // Move to next image
            imageIndex++;
            if (imageIndex >= photos.Count)
            {
                imageIndex = 0;
            }
        }
Exemplo n.º 2
0
        private void AddImage(bool broken, bool placeholder, bool round = false)
        {
            ImageExBase newImage = null;

            if (round)
            {
                newImage = new RoundImageEx
                {
                    Height       = 200,
                    Width        = 200,
                    CornerRadius = 999
                };
            }
            else
            {
                newImage = new ImageEx();
            }

            newImage.IsCacheEnabled      = true;
            newImage.Stretch             = Stretch.UniformToFill;
            newImage.Source              = broken ? photos[imageIndex].Thumbnail + "broken" : photos[imageIndex].Thumbnail;
            newImage.HorizontalAlignment = HorizontalAlignment.Center;
            newImage.VerticalAlignment   = VerticalAlignment.Center;
            newImage.MaxWidth            = 300;
            newImage.Background          = new SolidColorBrush(Colors.Transparent);
            newImage.Foreground          = new SolidColorBrush(Colors.White);

            if (placeholder)
            {
                newImage.PlaceholderSource  = new BitmapImage(new Uri("ms-appx:///Assets/Photos/ImageExPlaceholder.jpg"));
                newImage.PlaceholderStretch = Stretch.UniformToFill;
            }

            Container.Children.Add(newImage);

            // Move to next image
            imageIndex++;
            if (imageIndex >= photos.Count)
            {
                imageIndex = 0;
            }
        }