Windows phone 7 在windows Phone中,获取两个时差

Windows phone 7 在windows Phone中,获取两个时差,windows-phone-7,windows-phone-8,windows-phone,Windows Phone 7,Windows Phone 8,Windows Phone,首先,我想存储用户启动我的应用程序的当前时间。然后,当用户再次启动我的应用程序时,我也会获取当前时间,并将当前时间与以前存储的时间进行比较,检查时差是否变为“一天”。因为如果时差变为“一天”,那么我会在我的应用程序中做一些事情。 我知道这样的事情: DateTime.Now 如何在毫秒内转换此值????? 但我不明白我怎样才能达到我的目标。 现在我如何在Windows Phone中做到这一点?启动应用程序时,请将其保存在独立存储中 private IsolatedStorageSettin

首先,我想存储用户启动我的应用程序的当前时间。然后,当用户再次启动我的应用程序时,我也会获取当前时间,并将当前时间与以前存储的时间进行比较,检查时差是否变为“一天”。因为如果时差变为“一天”,那么我会在我的应用程序中做一些事情。 我知道这样的事情:

DateTime.Now
如何在毫秒内转换此值????? 但我不明白我怎样才能达到我的目标。
现在我如何在Windows Phone中做到这一点?

启动应用程序时,请将其保存在独立存储中

 private  IsolatedStorageSettings appSettings =IsolatedStorageSettings.ApplicationSettings;
         appSettings.Add("lastOrderTime", DateTime.Now);
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
                }
            }
下面的代码显示了如何从独立存储中重新筛选数据

 private  IsolatedStorageSettings appSettings =IsolatedStorageSettings.ApplicationSettings;
         appSettings.Add("lastOrderTime", DateTime.Now);
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
                }
            }
if(appSettings.TryGetValue(“lastOrderTime”,out lastOrderDateTime))
{
DateTime Currenttime=DateTime.Now;
如果(Currenttime.Day==lastOrderDateTime.Day)
{
///你的逻辑在同一天匹配时出现在这里
}
其他的
{
///这里是您的逻辑;也许您可以再次保存到隔离存储
}
}

时差应为1天。因此,我需要将时间转换为毫秒,然后取两个时间(当前时间和以前保存的时间)的差。如果差等于1天,那么我会做一些事情@拉梅什