private static void SetIconFromImageSource(TaskbarIcon taskbarIcon, ImageSource imageSource) { // Copied from Hardcodet.Wpf.TaskbarNotification.Util.ToIcon Icon icon = null; if (imageSource != null) { Uri uri = new Uri(imageSource.ToString()); StreamResourceInfo streamInfo = Application.GetResourceStream(uri); if (streamInfo == null) { string msg = "The supplied image source '{0}' could not be resolved."; msg = String.Format(msg, imageSource); throw new ArgumentException(msg); } icon = new Icon(streamInfo.Stream, idealIconSize, idealIconSize); } taskbarIcon.Icon = icon; }
private static Drawing.Icon FromImageSource(ImageSource icon) { if (icon == null) { return null; } Uri iconUri = new Uri(icon.ToString()); return new Drawing.Icon(Application.GetContentStream(iconUri).Stream); }
//////////////////////////////////////////////////////////////////////////////// // draw a bitmap on a canvas from a file name public void draw_sprite(Canvas canvas, ImageSource image_file, int x, int y) { Image image = new Image { Source = new BitmapImage (new Uri (image_file.ToString ())), }; canvas.Children.Add (image); Canvas.SetLeft (image, x); Canvas.SetTop (image, y); }
private static Icon FromImageSource(ImageSource icon) { if (icon == null) { return null; } var iconUri = new Uri(icon.ToString()); return new Icon("." + iconUri.LocalPath); }
System.Drawing.Icon FromImageSource(ImageSource icon) { if (icon == null) { return null; } Uri iconUri = new Uri(icon.ToString()); return new System.Drawing.Icon(Application.GetResourceStream(iconUri).Stream); }
private static Icon FromImageSource(ImageSource icon) { if (icon == null) { return null; } Uri iconUri = new Uri(icon.ToString()); return new Icon(Application.GetResourceStream(iconUri).Stream); }