I have a main page which gets the information from a local xml file based on currentTime.
When the app starts, it checks the current time and based on that it gets the proper xml value and shows it in textblock. But it does noe update. I was thinking about putting a refresh button on page, but smarter heads suggest DispatchTimer or Timer. What should i use, and where should i put the code? I am extremely basic user, so please if you could be specific and give code examples, it would be highlig appreciated.
THANK YOU ALL 🙂 a small portion of my code.
var obj = filteredData.First();
TimeSpan currentTime = myDay.TimeOfDay;
string result = String.Empty;
string Prayer = String.Empty;
if (currentTime >= obj.Fajr && currentTime < obj.Sunrise)
{
result = "Fajr";
Prayer = obj.Fajr.ToString(@"hh\:mm");
}
else if (currentTime >= obj.Sunrise && currentTime < obj.Zohr)
{
result = "Sunrise";
Prayer = obj.Sunrise.ToString(@"hh\:mm");
}
textBlock3.Text = result;
textBlock4.Text = Prayer;
This might be better approached with a view-model and a background thread, so something like: