zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    HTML学习笔记
    "IIS无法启动"问题解决方法
    NET访问MySQl数据库中文乱码解决
    珍爱生命,远离肥胖,远离过劳死
    Bcp 命令注意事项
    阿里云万郁香:多样付费选择构筑成本最优的弹性体验
    性能提升40%!阿里云神龙大数据加速引擎获TPCxBB世界排名第一
    阿里云王志坤:强劲可靠、无处不在的云,为创新保驾护航
    发现新视界——视觉计算将如何改变生产方式
    Soul运维总监尤首智:企业如何从0到1建设云上运维体系
  • 原文地址:https://www.cnblogs.com/grj1046/p/3365550.html
Copyright © 2011-2022 走看看