Пример #1
0
        public void LoadImage(String imageUrl, String pageUrl, UIElement insertBefore = null, bool handlePinch = true, bool showViewerLink = true, String loadingText = null, String errorText = null)
        {
            ImageLoaderItem imageItem = new ImageLoaderItem();

            Uri uri = new Uri(imageUrl);
            string filename = System.IO.Path.GetFileName(uri.LocalPath);

            imageItem.LoadingManager = this;
            imageItem.ImageUrl = imageUrl;
            imageItem.ImageFileName = filename;
            imageItem.PageUrl = pageUrl;
            imageItem.HandlePinch = handlePinch;
            imageItem.ShowViewerLink = showViewerLink;
            imageItem.FontColor = FontColor;
            imageItem.FontSize = FontSize;
            imageItem.MaxImageHeight = CalculateMaxImageHeight();
            imageItem.MaxImageWidth = CalculateMaxImageWidth();
            imageItem.NavigationService = Page.NavigationService;

            imageItem.IsOffline = IsOffline;
            imageItem.OfflineID = OfflineID;

            imageItem.ShowButtons = ShowButtons;
            imageItem.CacheImage = CacheImage;
            imageItem.IsClub = IsClub;

            if (loadingText != null)
            {
                imageItem.LoadingText = loadingText;
            }

            if (errorText != null)
            {
                imageItem.ErrorText = errorText;
            }

            int controlIndex = -1;

            if (insertBefore != null)
            {
                controlIndex = DisplayPanel.Children.IndexOf(insertBefore);
            }
            else
            {
                controlIndex = DisplayPanel.Children.Count;
            }

            Items.Add(imageItem);

            DisplayPanel.Children.Insert(controlIndex, imageItem.ImagePanel);

            AddToQueue(imageItem);
        }
Пример #2
0
        public void LoadMoreImages(ImageLoaderItem imageItemToLoad, int imageCount)
        {
            int startIndex = Items.IndexOf(imageItemToLoad);

            if(startIndex >= 0)
            {
                int endIndex = startIndex + imageCount - 1;

                if(endIndex > (Items.Count - 1))
                {
                    endIndex = Items.Count - 1;
                }

                if (_lowMemory)
                {
                    RecycleMemoryForNewImage(startIndex, endIndex, imageCount);
                }

                for (int i = startIndex; i <= endIndex; i++)
                {
                    Items[i].IgnoreMemoryLimit = true;
                    AddToQueue(Items[i]);
                }
            }
        }
Пример #3
0
 public void AddToQueue(ImageLoaderItem imageItem)
 {
     if (imageItem != null)
     {
         imageItem.ShowLoading();
         _loadQueue.Enqueue(imageItem);
         DownloadNextInQueue();
     }
 }