public void Load(Uri uri) { this.uri = uri; delay.Stop(); if (!done_reading) { Close(); } done_reading = false; area_prepared = false; damage = Gdk.Rectangle.Zero; using (ImageFile img = ImageFile.Create(uri)) { orientation = Accelerometer.GetViewOrientation(img.Orientation); try { PixbufOrientation thumb_orientation = Accelerometer.GetViewOrientation(PixbufOrientation.TopLeft); thumb = new Gdk.Pixbuf(ThumbnailGenerator.ThumbnailPath(uri)); thumb = PixbufUtils.TransformOrientation(thumb, thumb_orientation); if (FSpot.ColorManagement.IsEnabled && !thumb.HasAlpha) { if (img.GetProfile() == null) { FSpot.ColorManagement.PhotoImageView.Transform = FSpot.ColorManagement.StandartTransform(); } else { FSpot.ColorManagement.PhotoImageView.Transform = FSpot.ColorManagement.CreateTransform(thumb, img.GetProfile()); } } else { FSpot.ColorManagement.PhotoImageView.Transform = null; } } catch (System.Exception e) { //FSpot.ThumbnailGenerator.Default.Request (uri.ToString (), 0, 256, 256); if (!(e is GLib.GException)) { System.Console.WriteLine(e.ToString()); } } System.IO.Stream nstream = img.PixbufStream(); if (nstream == null) { FileLoad(img); return; } else { stream = new StreamWrapper(nstream); } loader = new Gdk.PixbufLoader(); loader.AreaPrepared += ap; loader.AreaUpdated += au; loader.Closed += ev; if (AreaPrepared != null && thumb != null) { pixbuf = thumb; AreaPrepared(this, new AreaPreparedArgs(true)); } ThumbnailGenerator.Default.PushBlock(); //AsyncIORead (null); if (nstream is IOChannel) { ((IOChannel)nstream).DataReady += IOChannelRead; } else { delay.Start(); } } }