JOHN JOHNNNY

JOHN JOHNNNY

  • NA
  • 190
  • 140.8k

How to read json file locally in c#

Jan 15 2015 12:18 PM

Hi

I am developing wp8 devotional app my questions are

1. How can i write a code to read the json/text file for each day's devotional locally

This is my code below

xaml

<ScrollViewer>
<TextBlock x:Name="textblock" TextWrapping="Wrap" Foreground="White"/>
</ScrollViewer>

xaml.cs

protected override void OnNavigatedTo(NavigationEventArgs e)
{

AddDevotions();
int index = DateTime.Now.DayOfYear;
textblock.Text = devotions[index];
}

List<String> devotions = new List<string>();
private void AddDevotions()
{

devotions.Add("4 Faith works miracles");
devotions.Add("5 Faith works miracles");
devotions.Add("6 Faith works miracles");
devotions.Add("7 Faith works miracles");
devotions.Add("8 Faith works miracles");
devotions.Add("9 Faith works miracles");
devotions.Add("10 Faith works miracles");



// add 366 days
}

Thank you in advance and reply soon


Answers (3)