mirror of
https://github.com/farcasclaudiu/myfriendsaround.git
synced 2026-06-29 15:01:45 +03:00
push notification helper library
http://windowsteamblog.com/windows_phone/b/wpdev/archive/2011/01/14/windows-push-notification-server-side-helper-library.aspx http://create.msdn.com/en-us/education/catalog/article/pnhelp-wp7
This commit is contained in:
+27
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
+39
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user