Я использовал nuget для загрузки WriteableBitmapEx в мой проект WP7
Я вижу, что он добавил две ссылки в мою references
папку моего проекта
Хотя я не могу найти способ добавить зависимость в свой класс. вот класс:
namespace Microsoft.Samples.CRUDSqlAzure.Phone.Converters
{
using System;
using System.Windows.Data;
using System.IO;
using System.Windows.Media.Imaging;
using System.Windows;
public class ImageByteConverter : IValueConverter
{
/// <summary>
/// Converts a Jpeg byte array into a WriteableBitmap
/// </summary>
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value == null)
return null;
byte[] val = (byte[])value;
MemoryStream ms = new MemoryStream(val);
return WriteableBitmapExtentions.DecodeJpeg(ms);
}
/// <summary>
/// Converts a WriteableBitmap into a Jpeg byte array.
/// </summary>
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value == null)
return null;
WriteableBitmap wb = (WriteableBitmap)value;
return wb.EncodeJpeg();
}
}
}