Example #1
0
		public void CorruptImageSetUriSourceProperty ()
		{
			BitmapImage bitmap = new BitmapImage ();
			bitmap.SetValue (BitmapImage.UriSourceProperty, corruptImage);
		}
Example #2
0
		public void BadUriSetUriSourceProperty ()
		{
			BitmapImage bitmap = new BitmapImage ();
			bitmap.SetValue (BitmapImage.UriSourceProperty, badUri);
		}
Example #3
0
		public void BadUriSetUriSourceProperty ()
		{
			BitmapImage bitmap = new BitmapImage ();
			bitmap.ImageFailed += delegate { /* do nothing */ };
			bitmap.SetValue (BitmapImage.UriSourceProperty, badUri);
		}
		/// <summary>
		/// Returns the bitmap image brush associated with the icon href for the point feature.
		/// </summary>
		/// <param name="IconHref">Value used to obtain image from remote server via HTTP or key for image dictionary.</param>
		/// <returns>
		/// A bitmap image brush or null if not found.
		/// </returns>
        private ImageBrush GetIconImage(string IconHref)
		{
			Uri imageUri = KmlLayer.GetUri(IconHref, _baseUri);

			// If the imageUri is OK then use it. Otherwise return null
			// so that a SimpleMarkerSymbol is created.
			if (imageUri != null
#if SILVERLIGHT
				&& (imageUri.Scheme == "http" || imageUri.Scheme == "https")
#endif
)
			{
				// Since this is accessing a remote server which may be down or otherwise inaccessible, use
				// exception handling to consume the error and fail quietly, falling through to fallback logic
				// and returning null otherwise.
				try
				{				
#if SILVERLIGHT
                    // Create bitmap image, set creation options to None so image creation is not delayed
                    // and use URI to get image.
					BitmapImage bi = new BitmapImage();
					bi.SetValue(BitmapImageKeyProperty, IconHref);	
                    bi.CreateOptions = BitmapCreateOptions.None;
					bi.UriSource = imageUri;
                    return new ImageBrush { ImageSource = bi };
#else					
					BitmapImage bi = new BitmapImage(imageUri);
					bi.SetValue(BitmapImageKeyProperty, IconHref);	
					return new ImageBrush { ImageSource = bi };
#endif
				}
				catch
				{
				}
			}

			return null;
		}
Example #5
0
		public void CorruptImageSetUriSourceProperty ()
		{
			BitmapImage bitmap = new BitmapImage ();
			bitmap.ImageFailed += delegate { /* do nothing */ };
			bitmap.SetValue (BitmapImage.UriSourceProperty, corruptImage);
		}