Skip to content

Instantly share code, notes, and snippets.

public class UnixDateTimeConverter : DateTimeConverterBase
{
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType != JsonToken.Integer)
{
throw new Exception(
String.Format("Unexpected token parsing date. Expected Integer, got {0}.",
reader.TokenType));
}
@GSonofNun
GSonofNun / Update Primary Tile
Created August 23, 2014 20:00
Method to update primary tile.
private static void UpdateTile()
{
var updater = TileUpdateManager.CreateTileUpdaterForApplication();
if (updater == null)
{
return;
}
updater.EnableNotificationQueue(true);
updater.Clear();
public static void AddOrUpdate(this IsolatedStorageSettings settings, string key, object value)
{
if (settings.Contains(key))
{
settings[key] = value;
}
else
{
settings.Add(key, value);
}
private void Grid_Hold(object sender, System.Windows.Input.GestureEventArgs e)
{
Grid g = (Grid)sender;
// This throws an error because you can't pass a Grid as a Control in the first parameter
VisualStateManager.GoToState(g, "Context", true);
}
public async Task ObjectToFile(Object obj, string fileName, string path = null)
{
string json = await Task.Factory.StartNew(() => JsonConvert.SerializeObject(obj));
StorageFolder sf = null;
if (path != null)
{
sf = await ApplicationData.Current.LocalFolder.GetFolderAsync(path);
}