/// <summary> /// Updates the image to be displayed with a new layout. /// </summary> /// <param name="imageResource">The image resources that is to be displayed.</param> /// <param name="layout">The layout of the image.</param> public void Update(ImageResource imageResource, ImageLayout layout) { _imageResource = imageResource; _imageLayout = layout; // handle null images so that it is easier to write photo viewers if (Application != null && _imageResource != null) { ResourceId = Application.GetResourceId(new Resource(ImageResource.Name, ResourceType.Image)); PostCommand(new Commands.ViewSetResource(ViewId, ResourceId, (long)Layout)); } }
/// <summary> /// Tests equality between two resources /// </summary> /// <param name="obj">Must be an ImageResource.</param> /// <returns>true if the resources represent the same item; false otherwise.</returns> public override bool Equals(object obj) { ImageResource imageResource = obj as ImageResource; if (imageResource != null) { return(_resourceId == imageResource._resourceId); } else { return(false); } }
/// <summary> /// Creates an <see cref="ImageView"/> that displays an image. /// </summary> /// <param name="imageResource">An image retrieved from <see cref="Application.GetImageResource"/>.</param> /// <param name="imageLayout">A set of <see cref="ImageLayout"/> flags that controls the layout of the image.</param> public ImageView(ImageResource imageResource, ImageLayout imageLayout) { Update(imageResource, imageLayout); }
/// <summary> /// Sets the ImageResource property to the given value. /// </summary> /// <param name="imageResource">The image resources that is to be displayed.</param> public void Update(ImageResource imageResource) { Update(imageResource, _imageLayout); }
/// <summary> /// Creates an <see cref="ImageView"/> that displays an image. /// </summary> /// <param name="imageResource">An image retrieved from <see cref="Application.GetImageResource"/>.</param> public ImageView(ImageResource imageResource) : this(imageResource, 0) { }