我想做一个类 Photo 我可以在哪里提交方法,因为我会在很多页面中多次使用这些方法。那么如何在参数中发送我的图像?
我现在有 :
PhotoChooserTask selectPhoto = null;
private void chooseLogoButton_Click(object sender, RoutedEventArgs e)
{
selectPhoto = new PhotoChooserTask();
selectPhoto.Completed += new EventHandler<PhotoResult>(selectPhoto_Completed);
selectPhoto.Show();
}
void selectPhoto_Completed(object sender, PhotoResult e)
{
if (e.TaskResult == TaskResult.OK)
{
MessageBox.Show(e.ChosenPhoto.Length.ToString());
//Code to display the photo on the page in an image control named myImage.
System.Windows.Media.Imaging.BitmapImage bmp = new System.Windows.Media.Imaging.BitmapImage();
bmp.SetSource(e.ChosenPhoto);
logoQrCodeImage.Source = bmp;
}
}
我做了一张班级照片:
public class Photo
{
PhotoChooserTask selectPhoto = null;
public void chooseLogo()
{
selectPhoto = new PhotoChooserTask();
selectPhoto.Completed += new EventHandler<PhotoResult>(selectPhoto_Completed);
selectPhoto.Show();
}
void selectPhoto_Completed(object sender, PhotoResult e)
{
if (e.TaskResult == TaskResult.OK)
{
MessageBox.Show(e.ChosenPhoto.Length.ToString());
//Code to display the photo on the page in an image control named myImage.
System.Windows.Media.Imaging.BitmapImage bmp = new System.Windows.Media.Imaging.BitmapImage();
bmp.SetSource(e.ChosenPhoto);
logoQrCodeImage.Source = bmp; //ERROR
}
}
}