This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void UpdateTile() | |
{ | |
var updater = TileUpdateManager.CreateTileUpdaterForApplication(); | |
if (updater == null) | |
{ | |
return; | |
} | |
updater.EnableNotificationQueue(true); | |
updater.Clear(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void AddOrUpdate(this IsolatedStorageSettings settings, string key, object value) | |
{ | |
if (settings.Contains(key)) | |
{ | |
settings[key] = value; | |
} | |
else | |
{ | |
settings.Add(key, value); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |