Silverlight, C #: detect when there are no more images

I have a list of consecutive images that need to be loaded in order when the user clicks "Next". The next page is determined by adding one to the number at the end of the URL, for example: http://twoimages.com/image_1to http://twoimages.com/image_2. I want to be able to detect when there are no more images to upload. I could use the event, but it only fires after it has failed and finished working with the rest of the code.

public void LoadImage(string ImageUrl)
{
    BitmapImage bmpImage;
    if (this.SilverlightImage.Source is BitmapImage)
    {
        bmpImage = this.SilverlightImage.Source as BitmapImage;
    }
    else
    {
        bmpImage = new BitmapImage();
        bmpImage.DownloadProgress += new EventHandler<DownloadProgressEventArgs>(bitmapImage_DownloadProgress);
    }

    bmpImage.UriSource = new Uri(ImageUrl, UriKind.RelativeOrAbsolute);

    if (this.SilverlightImage.Source == null)
    {
        this.SilverlightImage.Source = bmpImage;    
    }
}

I would like to be able to detect when there are no more images to upload, and not even try to upload an image that does not exist.

Thank,

Aaron

+3
source share
3

, ... , BitmapSource, , , Hack

0

, - , , , URI , , , , , (, , , ), , . ( Silverlight), , .

, , - : , , /, , 'd be running.

, , - , - , , , , . , , , , , , , , . , , , , ( WCF , ). .

0

- " ". XML ashx, xml. - , WCF.

URL- XML, LoadImage, "", ( ".", ).

, , , , , , , .

, , ClientHTTP HttpWebRequest, "HEAD" . , cookie.

0

Source: https://habr.com/ru/post/1781511/


All Articles