/// <summary> /// Reads local resources for display of tile and toast /// </summary> /// <returns>The object containing lcoal strings</returns> private void LoadLocalizedRes() { IsolatedStorageFileStream stream = null; try { var fileStore = IsolatedStorageFile.GetUserStoreForApplication(); if (fileStore.FileExists(FileSystem.ResourceFile)) { var serializer = new XmlSerializer(typeof(LocalizedResources)); stream = fileStore.OpenFile(FileSystem.ResourceFile, System.IO.FileMode.Open); Resources = (LocalizedResources)serializer.Deserialize(stream); } else { Resources.BdayTileLabel = "Birthday"; Resources.BdayTodayMsg = "'s birthday Today. Tap to send him a message"; Resources.UpdateBdayReminder = "Update birthday reminders"; } } finally { if (stream != null) { stream.Close(); } } }
/// <summary> /// Updates the resource with current language to be used by Agent /// </summary> private static void UpdateLocalizedRes() { IsolatedStorageFileStream stream = null; try { var fileStore = IsolatedStorageFile.GetUserStoreForApplication(); if (fileStore.FileExists(FileSystem.ResourceFile)) { return; } stream = fileStore.OpenFile(FileSystem.ResourceFile, System.IO.FileMode.Create); var serializer = new XmlSerializer(typeof(LocalizedResources)); var resource = new LocalizedResources { BdayTileLabel = AppResources.BirthdayLabel, BdayTodayMsg = AppResources.BirthdayReminderMessage, UpdateBdayReminder = AppResources.UpdateBdayRemindr }; serializer.Serialize(stream, resource); } finally { if (stream != null) { stream.Close(); } } }