Silverlight – Otevření obrázku do WriteableBitmap

Pokud potřebujete otevřít obrázek v prostředí Silverlight do WriteableBitmap můžete použít následují kód:

StreamResourceInfo sri = Application.GetResourceStream(new Uri("/NazevSilverlightProjektu;component/Images/06072011306.jpg", UriKind.Relative));
BitmapImage src = new BitmapImage();
src.SetSource(sri.Stream);
WriteableBitmap wb = new WriteableBitmap(src);

Obrázek bude přitom uložen v ..\NazevSilverlightProjektu\NazevSilverlightProjektu\Images\
Timto způsobem otevřete stream ze souboru (obrázku) a naplníte jím WriteableBitmap.
Nejříve jsem zkoušel postup:

Uri uri = new Uri("Images/Texture.jpg", UriKind.Relative);
BitmapImage imageSource = new BitmapImage(uri);
WriteableBitmap bitmap = new WriteableBitmap(imageSource); // EXCEPTION

ten ale skončil vyjímkou Null reference.

Posted in Nezařazené
2 Comments » for Silverlight – Otevření obrázku do WriteableBitmap
  1. Dylan napsal:

    that when we have FilterDescriptprs or pagination it will prtogaape to the final SQL query, not we fetch all data from database but then apply filters, is it true?for example in your code above think following method in DomainService public IQueryable GetItems() { return this.ObjectContext.Items; } So if we use this in client side with a datagrid and if we apply filterdescriptors, is that final SQL to the database contains those in where clause or is it fetching all and filtering done at the DomainService?For ex: if we have DomainService method as follows public IQueryable GetAppUsages() { List usage = new List(); for (int i = 0; i < 100; i++) { usage.Add(new AppUsage() { UsageId = i, AppName = "App Name " + i, UserName = "User " + i , CategoryId = i % 5 }); }Which doesn't deal with database at all and if we apply FilterDescriptor for CategoryId still it works, so my question is how to we capture these filterDescriptors at DomainService level and optimize final SQL query by using them if currently filtering done after fetching all records from the database.Thanks return usage.AsQueryable(); }

  2. senuke services napsal:

    It’s truly a nice and helpful piece of info. I am satisfied that you just shared this helpful info with us. Please stay us informed like this. Thanks for sharing.

Napsat komentář

Vaše emailová adresa nebude zveřejněna.

Můžete používat následující HTML značky a atributy: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

PROCEDURE dataconsul.add_counter does not exist