public ImageIdAndConstraint( DeviceAssetImages id, DeviceIconSizeConstraint constraint) { this._id = id; this._constraint = constraint; }
private void VerifyImage( Image image, DeviceAssetImages imageId, DeviceIconSizeConstraint constraint) { if (ImageFitsConstraint(image, constraint)) { this._images[imageId] = image; } else { this._imagesAreValid = false; } }
private bool LoadAndVerifyImage( DeviceAssetImages imageId, DeviceIconSizeConstraint constraint) { int index = (int)imageId; bool flag1 = false; if (index >= this._paths.Count) { this._imagesAreValid = false; } else { string path = this._paths[index]; if (path == null) { this._imagesAreValid = false; } else if (!this.IsPathValid(path)) { this._imagesAreValid = false; } else { Image tempImage = null; bool flag2 = false; try { Image.RemoveCache(path, 1024, 1024); tempImage = new Image(path, 1024, 1024); flag2 = tempImage.Load(); } catch (Exception ex) { this._imagesAreValid = false; } if (tempImage == null) { this._imagesAreValid = false; } else if (this._imagesAreValid) { if (flag2) { DeviceAssetImages tempImageId = imageId; DeviceIconSizeConstraint tempConstraint = constraint; tempImage.ImageLoadComplete += delegate { this.VerifyImage(tempImage, tempImageId, tempConstraint); this.DecrementAsynchronousLoadsRemaining(); }; flag1 = true; } else { this.VerifyImage(tempImage, imageId, constraint); } } } } return(flag1); }