public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
#if WP8
if (value == null || string.IsNullOrEmpty(_resolutionSuffix))
{
return value;
}
var iconUrl = value.ToString().TrimStart('/');
if (iconUrl.Length > 0)
{
var resolutionAwareIconUrl = Path.ChangeExtension(iconUrl, _resolutionSuffix + Path.GetExtension(iconUrl));
var resolutionAwareIconUri = new Uri(resolutionAwareIconUrl, UriKind.Relative);
if (CheckIfUriExists)
{
var resouceStreamResult = Application.GetResourceStream(resolutionAwareIconUri);
if (resouceStreamResult != null && resouceStreamResult.Stream != null)
{
resouceStreamResult.Stream.Dispose();
return resolutionAwareIconUri;
}
}
else
{
return resolutionAwareIconUri;
}
}
return value;
#else
return value;
#endif
}