private void uiButton_endCheck_Click(object sender, EventArgs e) { isCheck = false; checkStep = -1; clearCheck(); //更新按键状态 uiButton_startCheck.Enabled = true; uiButton_endCheck.Enabled = false; uiButton_contiueCheck.Enabled = false; uiButton_stopCheck.Enabled = false; //更新XML文档 KeyData_Today.SaveKeyData(); }
/// <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("保存记录"); } }
/// <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); }