/// <summary> /// 导出为EXCEL /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void uiSymbolButton_exportExcel_Click(object sender, EventArgs e) { string str = KeyData_DailyData.ExportToExcel(); KeyData_Today.ExportToExcel(); KeyData_Total.ExportToExcel(); System.Diagnostics.Process.Start(Path.GetDirectoryName(str)); }
/// <summary> /// 按键跳转 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CheckKeyBordPage_KeyUp(object sender, KeyEventArgs e) { Console.WriteLine(e.KeyCode.ToString()); if (isCheck && isJump) { int i = KeyData_Today.FindKey(e.KeyCode.ToString()); if (i != -1) { checkStep = i; updatePage(); updateSite(); } } }
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); }
/// <summary> /// 格式化数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void uiSymbolButton_clear_Click(object sender, EventArgs e) { List <string> items = new List <string> { "仅格式化计数数据", "格式化所有数据(包括坐标)" }; int select = -1; if (this.ShowSelectDialog(ref select, items)) { if (select == 0)//仅格式化计数数据 { KeyData_DailyData.Reset(); KeyData_Today.ResetCount(); KeyData_Total.ResetCount(); } else if (select == 1)//格式化所有 { KeyData_DailyData.Reset(); KeyData_Today.Reset(); KeyData_Total.Reset(); } } }
/// <summary> /// 加载键盘数据 /// </summary> private void LoadKeyData() { KeyData_DailyData.LoadKeyData(); KeyData_Today.LoadKeyData(); KeyData_Total.LoadKeyData(); }
/// <summary> /// 键盘hook触发(键位抬起触发),相应变量递增 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void hook_KeyUp(object sender, KeyEventArgs e) { KeyData_Today.Increase(e.KeyCode.ToString()); }