无法找到 ChooserEventArgs 类

发布于 2024-11-05 06:33:51 字数 457 浏览 0 评论 0原文

我想打开 Windows Phone 7 相机,拍一张快照,然后操作该照片。但问题是,当我尝试覆盖 OnChooserReturn 函数时,当我想捕获从我使用的相机返回的内容时,它也会给我错误没有找到合适的方法来覆盖这:

ChooserEventArgs<PhotoResult> args = new ChooserEventArgs<PhotoResult>()

它给了我错误找不到类型或命名空间名称'ChooserEventArgs'(您是否缺少using指令或程序集引用?)尽管我正在使用这两个指令

using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;

问题是什么我该如何解决这些问题?

I want to open windows phone 7 camera, take a snap and then manipulate that picture. But the problem is when I try to override the OnChooserReturn function it gives me the error no suitable method found to override also when I want to capture what returns from the camera I use this :

ChooserEventArgs<PhotoResult> args = new ChooserEventArgs<PhotoResult>()

It gives me the error The type or namespace name 'ChooserEventArgs' could not be found (are you missing a using directive or an assembly reference?) although I am using these two directives

using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;

What is the problem and how can I solve these issues?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

妳是的陽光 2024-11-12 06:33:51

听起来您正在尝试使用旧的 SDK,或者至少是基于过时的 SDK 的指南。要让手机启动相机,然后使用 CameraCaptureTask 引用捕获的图像。您将需要以下使用语句:

using Microsoft.Phone.Tasks;
using System.Windows.Media.Imaging;

在代码中的某个位置(可能是在按钮单击事件中),您执行此操作来启动相机:

CameraCaptureTask cct = new CameraCaptureTask();
cct.Completed += new EventHandler<PhotoResult>(cct_Completed);
cct.Show();

然后像这样处理已完成的事件(假设您有一个名为 image 的图像控件):

void cct_Completed(object sender, PhotoResult e)
{
    if (e.TaskResult == TaskResult.OK)
    {
        BitmapImage bimg = new BitmapImage();
        bimg.SetSource(e.ChosenPhoto);
        this.image.Source = bimg;
    }            
}

此处的文档: http://msdn。 microsoft.com/en-us/library/microsoft.phone.tasks.cameracapturetask(v=VS.92).aspx

It sounds like you are trying to use an old SDK or at least a guide based on an outdated SDK. To have the phone launch the Camera and then to reference the captured image you use the CameraCaptureTask. You will need the following Using statements:

using Microsoft.Phone.Tasks;
using System.Windows.Media.Imaging;

Somewhere in your code (presumably in a button click event) you do this to launch the camera:

CameraCaptureTask cct = new CameraCaptureTask();
cct.Completed += new EventHandler<PhotoResult>(cct_Completed);
cct.Show();

Then you handle the completed event like this (assuming you have an Image control named image):

void cct_Completed(object sender, PhotoResult e)
{
    if (e.TaskResult == TaskResult.OK)
    {
        BitmapImage bimg = new BitmapImage();
        bimg.SetSource(e.ChosenPhoto);
        this.image.Source = bimg;
    }            
}

Documentation Here: http://msdn.microsoft.com/en-us/library/microsoft.phone.tasks.cameracapturetask(v=VS.92).aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文