有没有办法打开WP7上的照片的picturehub应用程序?

时间:2012-01-22 12:04:58

标签: windows-phone-7 launcher

在我当前的应用程序中,我想使用XNA MediaLibrary类将图像保存到用户的图片集中文件夹 - 这很容易......

但是,我想在PictureHub中打开该图片 - 特别是这样用户就可以轻松地分享该照片了。

有没有人知道这样做?到目前为止,我看起来并没有发现任何东西 - 我尝试过MediaPlayerLauncher(但失败了 - 它真的是为音乐/视频而设计的。)

3 个答案:

答案 0 :(得分:2)

实际上你可以通过两种方式实现同​​样的目标,

  1. 使用photoChooser任务

  2. 在您的应用程序中使用Image控件

  3. 1.PhotoChooserTask:

    使用Microsoft.Phone.Tasks;使用此名称空间

    PhotoChooserTask objPhotoChooser = new PhotoChooserTask();
    objPhotoChooser.Completed += new EventHandler<PhotoResult>(PhotoChooserCompleted);
    objPhotoChooser.Show();
    
    private void PhotoChooserCompleted(object sender, PhotoResult e) 
        { 
            if (e.TaskResult == TaskResult.OK) 
            { 
                var img = new BitmapImage(); 
                img.SetSource(e.ChosenPhoto); 
            } 
        } 
    

    您可以使用Cameracapture任务为您的应用程序添加实时图片共享。

    2.在您的应用页面中使用的图像控制

    您必须在应用程序页面中使用Image控件来完成相同的操作。

    page.xaml看起来像

    <Image x:Name = "imagecontrol" width ="300" height = "300" Stretch = "Fill">
    

    添加这些名称空间

    using Microsoft.Xna.Framework.Media;
    using System.Windows.Media.Imaging;
    
    此代码后面的

    在适当的hanlder

    中的xaml.cs文件中
    MediaLibrary ml = new MediaLibrary();
    
    if (ml.Pictures.Count > 0)
    {
         System.IO.Stream sm = ml.Pictures[0].GetImage();
         BitmapImage bmp = new BitmapImage();
         bmp.SetSource(sm);
         imagecontrol.Source = bmp;
    }
    

    这始终在MediaLibrary中设置第一张图片,根据您的要求更改此代码。

答案 1 :(得分:0)

以上回答是从您的应用程序访问照片。

但您的想法是当用户点击图片中心环境中的可用选项时,从图片中心启动应用程序。

为此,您必须创建并声明应用程序作为图片中心扩展程序应用程序,这可以通过described in the following link

的方式实现

或者链接在这里

http://msdn.microsoft.com/en-us/library/hh202966%28v=vs.92%29.aspx

答案 2 :(得分:0)

好的......这已经打开了足够长的时间。

Mango 7.1 / 7.5级别的答案似乎是一个明确的“不”

相关问题