Reputation: 1096
First i want to store the current time when the user launch my app. Then after that when the user launch my app again then i also get the current time and compare the current time with previously stored time and check whether the time difference becomes "one day" or not. Because if the time difference becomes "one day" then i will do something in my app. I know something like that:
DateTime.Now
how to convert this in milliseconds????? But i don't understand how can i reach my goal by that. Now How can i do that in Windows Phone???
Upvotes: 0
Views: 68
Reputation: 415
When launching the app,save it in isolated storage.
private IsolatedStorageSettings appSettings =IsolatedStorageSettings.ApplicationSettings;
appSettings.Add("lastOrderTime", DateTime.Now);
The below code shows how to retieve data from isolated storage.
if (appSettings.TryGetValue<DateTime>("lastOrderTime", out lastOrderDateTime))
{
DateTime Currenttime = DateTime.Now;
if (Currenttime.Day == lastOrderDateTime.Day)
{
///Your logic here when matches the same day
}
else
{
///Your logic here ; maybe you save again to isolated storage
}
}
Upvotes: 1