Example #1
0
 /// <summary>
 /// 保存数据
 /// </summary>
 private void SaveData()
 {
     //判断是否过天
     if (!CheckDate())
     {
         //保存数据
         KeyData_Today.SaveKeyData();
         KeyData_Total.SaveKeyData();
         KeyData_DailyData.SaveKeyData();
     }
     //更新label
     uiLabel_lastSave.Text = "上次更新时间为:" + DateTime.Now.ToString("MM月dd日HH时mm分ss秒");
     //记录日志
     if (ConfigureData.configure.IsLog)
     {
         LogHelper.Info("保存记录");
     }
 }
Example #2
0
        /// <summary>
        /// 判断是否过天
        /// </summary>
        private bool CheckDate()
        {
            //如果记录的天数已经过了,清空并重新记录。
            if (KeyData_Today.todayData.Date != DateTime.Now.ToString("yyyy-MM-dd"))
            {
                //先更新总数据和每日数据
                KeyData_Total.UpdateData();
                KeyData_DailyData.UpdateData();
                //保存并重置当天数据
                KeyData_Today.ResetCount();
                //保存数据
                KeyData_Today.SaveKeyData();
                KeyData_Total.SaveKeyData();
                KeyData_DailyData.SaveKeyData();

                return(true);
            }
            return(false);
        }