public static void LoadIcon(this Gtk.Image image, string iconId, Gtk.IconSize size) { AnimatedImageInfo ainfo = animatedImages.Select(a => (AnimatedImageInfo)a.Target).FirstOrDefault(a => a != null && a.Image == image); if (ainfo != null) { if (ainfo.AnimatedIcon.AnimationSpec == iconId) { return; } UnregisterImageAnimation(ainfo); } if (IsAnimation(iconId, size)) { var anim = GetAnimatedIcon(iconId); ainfo = new AnimatedImageInfo(image, anim); ainfo.Animation = anim.StartAnimation(delegate(Xwt.Drawing.Image pix) { image.Pixbuf = pix.ToPixbuf(); }); animatedImages.Add(new WeakReference(ainfo)); } else { image.SetFromStock(iconId, size); } }
public static void LoadIcon(this Gtk.Image image, string iconId, Gtk.IconSize size) { AnimatedImageInfo ainfo = animatedImages.Select(a => (AnimatedImageInfo)a.Target).FirstOrDefault(a => a != null && a.Image == image); if (ainfo != null) { if (ainfo.AnimatedIcon.AnimationSpec == iconId) { return; } UnregisterImageAnimation(ainfo); } //if (IsAnimation (iconId, size)) { // var anim = GetAnimatedIcon (iconId); // ainfo = new AnimatedImageInfo (image, anim); // ainfo.Animation = anim.StartAnimation (delegate (Gdk.Pixbuf pix) { // image.Pixbuf = pix; // }); // animatedImages.Add (new WeakReference (ainfo)); //} else // image.Pixbuf = GetPixbuf (iconId, size); }
static void UnregisterImageAnimation(AnimatedImageInfo ainfo) { ainfo.Dispose(); animatedImages.RemoveAll(a => (AnimatedImageInfo)a.Target == ainfo); }
static void UnregisterImageAnimation (AnimatedImageInfo ainfo) { ainfo.Dispose (); animatedImages.RemoveAll (a => (AnimatedImageInfo)a.Target == ainfo); }
public static void LoadIcon (this Gtk.Image image, string iconId, Gtk.IconSize size) { AnimatedImageInfo ainfo = animatedImages.Select (a => (AnimatedImageInfo) a.Target).FirstOrDefault (a => a != null && a.Image == image); if (ainfo != null) { if (ainfo.AnimatedIcon.AnimationSpec == iconId) return; UnregisterImageAnimation (ainfo); } if (IsAnimation (iconId, size)) { var anim = GetAnimatedIcon (iconId); ainfo = new AnimatedImageInfo (image, anim); ainfo.Animation = anim.StartAnimation (delegate (Xwt.Drawing.Image pix) { image.Pixbuf = pix.ToPixbuf (); }); animatedImages.Add (new WeakReference (ainfo)); } else image.SetFromStock (iconId, size); }