• Window Phone 8 应用程序连接扩展图片中心,图片扩展,图片查看器


    WMAppManifest.xml

    <?xml version="1.0" encoding="utf-8"?>
    <Deployment xmlns="http://schemas.microsoft.com/windowsphone/2012/deployment" AppPlatformVersion="8.0">
      <DefaultLanguage xmlns="" code="zh-CN" />
      <App xmlns="" ProductID="{eb469a5c-e2dc-4dc6-ad58-153797faed43}" Title="PhoneAppPhotoExtensions" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="PhoneAppPhotoExtensions author" Description="Sample description" Publisher="PhoneAppPhotoExtensions" PublisherID="{429d1ed4-d204-4130-a105-6ce51ec208ab}">
        <IconPath IsRelative="true" IsResource="false">AssetsApplicationIcon.png</IconPath>
        <Capabilities>
          <Capability Name="ID_CAP_NETWORKING" />
          <Capability Name="ID_CAP_MEDIALIB_AUDIO" />
          <Capability Name="ID_CAP_MEDIALIB_PLAYBACK" />
          <Capability Name="ID_CAP_SENSORS" />
          <Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />
          <Capability Name="ID_CAP_MEDIALIB_PHOTO" />
        </Capabilities>
        <Tasks>
          <DefaultTask Name="_default" NavigationPage="MainPage.xaml" />
        </Tasks>
        <Tokens>
          <PrimaryToken TokenID="PhoneAppPhotoExtensionsToken" TaskName="_default">
            <TemplateFlip>
              <SmallImageURI IsRelative="true" IsResource="false">AssetsTilesFlipCycleTileSmall.png</SmallImageURI>
              <Count>0</Count>
              <BackgroundImageURI IsRelative="true" IsResource="false">AssetsTilesFlipCycleTileMedium.png</BackgroundImageURI>
              <Title>PhoneAppPhotoExtensions</Title>
              <BackContent>
              </BackContent>
              <BackBackgroundImageURI>
              </BackBackgroundImageURI>
              <BackTitle>
              </BackTitle>
              <DeviceLockImageURI>
              </DeviceLockImageURI>
              <HasLarge>
              </HasLarge>
            </TemplateFlip>
          </PrimaryToken>
        </Tokens>
        <Extensions>
          <Extension ExtensionName="Photos_Extra_Hub" ConsumerID="{5B04B775-356B-4AA0-AAF8-6491FFEA5632}" TaskID="_default" />
          <Extension ExtensionName="Photos_Extra_Viewer" ConsumerID="{5B04B775-356B-4AA0-AAF8-6491FFEA5632}" TaskID="_default" />
          <Extension ExtensionName="Photos_Extra_Share" ConsumerID="{5B04B775-356B-4AA0-AAF8-6491FFEA5632}" TaskID="_default" />
        </Extensions>
        <ScreenResolutions>
          <ScreenResolution Name="ID_RESOLUTION_WVGA" />
          <ScreenResolution Name="ID_RESOLUTION_WXGA" />
          <ScreenResolution Name="ID_RESOLUTION_HD720P" />
        </ScreenResolutions>
      </App>
    </Deployment>
                // Get a dictionary of query string keys and values.
                IDictionary<string, string> queryStrings = this.NavigationContext.QueryString;
    
                //<Extension ExtensionName="Photos_Extra_Viewer" ConsumerID="{5B04B775-356B-4AA0-AAF8-6491FFEA5632}" TaskID="_default" />
                // Ensure that there is at least one key in the query string, and check whether the "token" key is present.
                if (queryStrings.ContainsKey("token"))
                {
    
                    // Retrieve the picture from the media library using the token passed to the application.
                    MediaLibrary library = new MediaLibrary();
                    Picture picture = library.GetPictureFromToken(queryStrings["token"]);
    
    
                    // Create a WriteableBitmap object and add it to the Image control Source property.
                    BitmapImage bitmap = new BitmapImage();
                    bitmap.CreateOptions = BitmapCreateOptions.None;
                    bitmap.SetSource(picture.GetImage());
    
                    WriteableBitmap picLibraryImage = new WriteableBitmap(bitmap);
                    retrievePic.Source = picLibraryImage;
                }
                //<Extension ExtensionName="Photos_Extra_Share" ConsumerID="{5B04B775-356B-4AA0-AAF8-6491FFEA5632}" TaskID="_default" />
                if (queryStrings.ContainsKey("FileId"))
                {
                    // Retrieve the picture from the media library using the FileID
                    // passed to the application.
                    MediaLibrary library = new MediaLibrary();
                    Picture picture = library.GetPictureFromToken(queryStrings["FileId"]);
    
                    // Create a WriteableBitmap object and add it to the Image control Source property.
                    BitmapImage bitmap = new BitmapImage();
                    bitmap.CreateOptions = BitmapCreateOptions.None;
                    bitmap.SetSource(picture.GetImage());
    
                    WriteableBitmap picLibraryImage = new WriteableBitmap(bitmap);
                    retrievePic.Source = picLibraryImage;
                }

    http://msdn.microsoft.com/zh-cn/library/gg278408(v=vs.92).aspx#BKMK_Photos

    PhoneAppPhotoExtensions2013年10月12日164259.rar

  • 相关阅读:
    C#常用功能和通用模块开发资料
    常用工具&网址
    Web前端开发、常见问题及解决方法
    MQTT专题(Spring boot + maven整合MQTT、EMQ搭建MQTT服务器和客户端模拟工具)
    Spring常用注解
    ActiveMQ专题(服务器搭建、配置和项目应用)
    HTTP RESTful服务开发 spring boot+Maven +Swagger
    设计模式-命令模式
    设计模式-责任链模式
    设计模式—建造者模式(Builder)
  • 原文地址:https://www.cnblogs.com/grj1046/p/3365550.html
Copyright © 2020-2023  润新知