TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
JOHN JOHNNNY
NA
190
139.7k
Help with JSON file reading
Jan 16 2015 9:33 AM
Hi
I have this jason file located in my Assets/Dec1.js how can i make it appear in my textblock
when i run it in the emulator it shows "This" instead of showing the content in the Assets/Dec1.js
Kindly help
see the code below
xaml
<ScrollViewer>
<TextBlock x:Name="textblock" TextWrapping="Wrap" Foreground="White"/>
</ScrollViewer>
xaml.cs
//JSON starts here
public string ReadJsonFile(string JsonfilePath)
{
string strText = "This";
using (StreamReader r = new StreamReader("Assets/Dec1.js"))
{
string json = r.ReadToEnd();
dynamic array = JsonConvert.DeserializeObject(json);
//... read text from json file
}
return strText;
}
//Daily Devotion starts here
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(ReadJsonFile("Assets/Dec1.js"));
devotions.Add(ReadJsonFile("Assets/Dec1.js"));
devotions.Add(ReadJsonFile("Assets/Dec1.js"));
}
Thank you in advance and reply soon
Reply
Answers (
18
)
Reading json file from folder
PDF Document Review and Commenting