2011-03-28 21:22:11 +03:00
parent a4c09735f0
commit 00f97e41d6
130 changed files with 13440 additions and 0 deletions
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
namespace WindowsPhone.Recipes.Push.Server.Resources.Converters
{
/// <summary>
/// Converts null to default tile image.
/// </summary>
public class NullTileImageConverter : IValueConverter
{
/// <value>Default tile image resource relative path.</value>
private static readonly Uri DefaultTileImage = new Uri("/Resources/TileImages/Null.jpg", UriKind.Relative);
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return value ?? DefaultTileImage;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotSupportedException();
}
}
}
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.IO;
namespace WindowsPhone.Recipes.Push.Server.Resources.Converters
{
/// <summary>
/// Image file name to image file name with relevant path.
/// </summary>
public class UserFileImageConverter : IValueConverter
{
/// <value>Default tile image resource relative path.</value>
private static readonly Uri DefaultTileImage = new Uri("/Resources/TileImages/Null.jpg", UriKind.Relative);
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
Uri imageUri = DefaultTileImage;
string fileName = value as string;
if (value != null)
{
string imageFullPath = Path.Combine(@"Resources\TileImages\Numbers", (string)value);
if (File.Exists(imageFullPath))
{
imageUri = new Uri(@"\" + imageFullPath, UriKind.Relative);
}
}
return imageUri;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotSupportedException();
}
}
}