1

我需要在我的应用程序中从 Windows 手机的目录中拍照,所以当我点击这个子 Windows 中的文本时,我添加了一个子 Windows 我添加了一个按钮,然后我打电话

公共部分类AnnotationControl:ChildWindow {

    public ObservableCollection<string> cercle { get; set; }
    public AnnotationControl()
    {
        InitializeComponent();


    }



    private void ChildWindow_Closing_1(object sender, System.ComponentModel.CancelEventArgs e)
    {

    }

    private void btnsave_Click_1(object sender, RoutedEventArgs e)
    {
                   this.DialogResult = true;
    }



    private void btnCancel_Click_1(object sender, RoutedEventArgs e)
    {
        this.DialogResult = true;
    }



    private void browse_Click(object sender, RoutedEventArgs e)
    {
PhotoChooserTask objPhotoChooser = new PhotoChooserTask();
                 objPhotoChooser.Completed += new EventHandler<PhotoResult>(PhotoChooseCall);
                 objPhotoChooser.Show(); 
    }

但是当我单击按钮选择图片时,应用程序崩溃了“Application_UnhandledException”,请有人知道

4

1 回答 1

0

使用这可能会有所帮助

    private void changeImage(object sender, RoutedEventArgs e)
    {

        PhotoChooserTask photoChooserTask = new PhotoChooserTask();
        photoChooserTask.Completed += new EventHandler<PhotoResult>(photoChooserTask_Completed);
        photoChooserTask.Show();
    }
void photoChooserTask_Completed(object sender, PhotoResult e)
    {
        if (e.TaskResult == TaskResult.OK)
        {

            System.Windows.Media.Imaging.BitmapImage bmp = new System.Windows.Media.Imaging.BitmapImage();
            bmp.SetSource(e.ChosenPhoto);

            imageTapped.Source = bmp;

        }
    }
于 2013-05-06T12:26:27.717 回答