[Windows Phone 7] developing a plug-in for sharing images (2)

Source: Internet
Author: User
In picture hub of WP7, select an image and click "…" when viewing the image. Menu, click share... A menu appears (this menu shows the list of applications that can share or process the selected image)

The following describes how to implement this one-click Sharing function: 1. Create a share picker XML file. 2. obtain and process images in your application. Program Create an XML file named "E0F0E49A-3EB1-4970-B780-45DA41EC7C28.xml". Note: Copy to output directory attributes are set Copy always . In this way, your application will appear in share... but how to process the selected image, in fact, from share... when you start your application, the image will be passed to your application through the navigation parameter "fileid. the following is an example of the image:
 protected override void onnavigatedto (navigationeventargs e) {// get a dictionary of query string keys and values. idictionary 
  
    querystrings = This. navigationcontext. querystring; // ensure that there is at least one key in the query string, and check // if the "fileid" Key is present. if (querystrings. containskey ("fileid") {// retrieve the picture from the local Zune media database using the fileid // passed to the application. medialibrary library = new medialibrary (); picture = library. getpicturefromtoken (querystrings ["fileid"]); // create a writeablebitmap object and add it to the image control source property. bitmapimage bitmap = new bitmapimage (); bitmap. setsource (picture. getimage (); writeablebitmap piclibraryimage = new writeablebitmap (Bitmap); retrievepic. source = piclibraryimage ;}}
  
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.