diff --git a/Bin/Debug/MyTimeClock/MyTimeClock.exe b/Bin/Debug/MyTimeClock/MyTimeClock.exe index 025e493..69c7683 100644 Binary files a/Bin/Debug/MyTimeClock/MyTimeClock.exe and b/Bin/Debug/MyTimeClock/MyTimeClock.exe differ diff --git a/Bin/Debug/MyTimeClock/RaUI.dll b/Bin/Debug/MyTimeClock/RaUI.dll index 92cb771..783fd18 100644 Binary files a/Bin/Debug/MyTimeClock/RaUI.dll and b/Bin/Debug/MyTimeClock/RaUI.dll differ diff --git a/Bin/Debug/MyTimeClock/RaUI.xml b/Bin/Debug/MyTimeClock/RaUI.xml index 7197df0..d709408 100644 --- a/Bin/Debug/MyTimeClock/RaUI.xml +++ b/Bin/Debug/MyTimeClock/RaUI.xml @@ -15040,6 +15040,13 @@ 超时时间 + + + + + 超时时间 + 重试次数 + 以post方式获取网页源码 @@ -15075,6 +15082,11 @@ + + + 重试次数 + + 头信息 diff --git a/Bin/Debug/MyTimeClock/TimeClock.dll b/Bin/Debug/MyTimeClock/TimeClock.dll index 51a52d1..7326e80 100644 Binary files a/Bin/Debug/MyTimeClock/TimeClock.dll and b/Bin/Debug/MyTimeClock/TimeClock.dll differ diff --git a/Bin/Debug/MyTimeClock/UserDb/TimeTip.dat b/Bin/Debug/MyTimeClock/UserDb/TimeTip.dat index 4316382..893a625 100644 Binary files a/Bin/Debug/MyTimeClock/UserDb/TimeTip.dat and b/Bin/Debug/MyTimeClock/UserDb/TimeTip.dat differ diff --git a/Bin/Debug/MyTimeClock/UserDb/Win.dat b/Bin/Debug/MyTimeClock/UserDb/Win.dat index 134d03d..5e225a0 100644 --- a/Bin/Debug/MyTimeClock/UserDb/Win.dat +++ b/Bin/Debug/MyTimeClock/UserDb/Win.dat @@ -1,2 +1,2 @@ [TimeClock] -hwnd=6239280 +hwnd=5651228 diff --git a/Bin/Debug/MyTimeClock/cUpdate.dat b/Bin/Debug/MyTimeClock/cUpdate.dat index 1437059..c4bd959 100644 --- a/Bin/Debug/MyTimeClock/cUpdate.dat +++ b/Bin/Debug/MyTimeClock/cUpdate.dat @@ -1,3 +1,3 @@ - + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 21f0972..8445133 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,11 @@ -## :date:2025-08-23 星期六更新 +## :date:2025-11-13 星期四更新 + +### TimeClock V1.0.2511.1301 +本版本作为备份,即将将定时软件从分级升级为秒级,以防万一,故此备份。 +- :100:[改进]定时功能调整为System.Timers.Timer timer。 +- :100:[改进]RyTimeClock需要传窗体参数。 + +## :date:2025-08-23 星期六更新 ### TimeClock V1.0.2508.2301 - :x:[删除]删除对XPTable控件的依赖,界面列表控件全面使用ObjectListView。 diff --git a/Source/MyTimeClock/MyTimeClock/Frmmain.Designer.cs b/Source/MyTimeClock/MyTimeClock/Frmmain.Designer.cs index 0790d2d..12245fe 100644 --- a/Source/MyTimeClock/MyTimeClock/Frmmain.Designer.cs +++ b/Source/MyTimeClock/MyTimeClock/Frmmain.Designer.cs @@ -42,7 +42,7 @@ this.LblName = new System.Windows.Forms.Label(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.LblState = new System.Windows.Forms.Label(); - this.ryTimeClock1 = new TimeClock.RyTimeClock(); + this.ryTimeClock1 = new TimeClock.RyTimeClock(this); this.LblVer = new System.Windows.Forms.Label(); this.contextMenuStrip1.SuspendLayout(); this.SuspendLayout(); diff --git a/Source/MyTimeClock/TimeClock/Properties/AssemblyInfo.cs b/Source/MyTimeClock/TimeClock/Properties/AssemblyInfo.cs index e083ccf..f16977f 100644 --- a/Source/MyTimeClock/TimeClock/Properties/AssemblyInfo.cs +++ b/Source/MyTimeClock/TimeClock/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.2508.2301")] -[assembly: AssemblyFileVersion("1.0.2508.2301")] \ No newline at end of file +[assembly: AssemblyVersion("1.0.2511.1301")] +[assembly: AssemblyFileVersion("1.0.2511.1301")] \ No newline at end of file diff --git a/Source/MyTimeClock/TimeClock/RyTimeClock.Designer.cs b/Source/MyTimeClock/TimeClock/RyTimeClock.Designer.cs index ebaa26b..bbdb8e3 100644 --- a/Source/MyTimeClock/TimeClock/RyTimeClock.Designer.cs +++ b/Source/MyTimeClock/TimeClock/RyTimeClock.Designer.cs @@ -28,18 +28,9 @@ /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - this.timer1 = new System.Windows.Forms.Timer(this.components); - // - // timer1 - // - this.timer1.Interval = 1000; - this.timer1.Tick += new System.EventHandler(this.Timer1_Tick); } #endregion - - private System.Windows.Forms.Timer timer1; } } diff --git a/Source/MyTimeClock/TimeClock/RyTimeClock.cs b/Source/MyTimeClock/TimeClock/RyTimeClock.cs index 3102e01..dbde1de 100644 --- a/Source/MyTimeClock/TimeClock/RyTimeClock.cs +++ b/Source/MyTimeClock/TimeClock/RyTimeClock.cs @@ -37,10 +37,10 @@ namespace TimeClock [Description("是否开启提醒功能")] public bool Enabled { - get {return timer1.Enabled; } + get {return timer.Enabled; } set { - if (timer1.Enabled != value && !GetIsDesignMode()) + if (timer.Enabled != value && !GetIsDesignMode()) { UpdateTipTime(); UpdateTipTime_start(false); @@ -64,7 +64,7 @@ namespace TimeClock } } first_start = false; - timer1.Enabled = value; + timer.Enabled = value; } } } @@ -335,9 +335,14 @@ namespace TimeClock } bool first_start = true; DateTime Last_CloseTime = DateTime.Now; - public RyTimeClock() + private Form _parentForm; + System.Timers.Timer timer = new System.Timers.Timer(1000); + public RyTimeClock(Form parentForm) { InitializeComponent(); + _parentForm = parentForm; + timer.SynchronizingObject = parentForm; + timer.Elapsed += TimeElapsed; if (!GetIsDesignMode()) { TimeClock.Itrycn_Db.CreateTable(); @@ -367,74 +372,15 @@ namespace TimeClock } } } - DateTime lastRunTime = DateTime.Now.AddDays(-1); - bool last_fullscreen = false; - bool last_idle = false; - /// - /// 计算工作信息 - /// - /// - private void CalcWorkInfo(DateTime dt_now) - { - var idle = ryCommon.RySystem.GetLastInputTime() / 1000; - DateTime dt_now2 = dt_now.AddSeconds(-dt_now.Second).AddMilliseconds(-dt_now.Millisecond); - int stype = 0; - if (idle>=60) - { - stype = 0; - } - else { stype = 1; } - DataProvider mydb = new DataProvider(); - IDbInterface db = TimeClock.Itrycn_Db.CreateDataProvider(TimeClock.Itrycn_Db.dataType); - if (db.ConnDb(TimeClock.Itrycn_Db.WorkInfo_ConnStr) == 1) - { - RyQuickSQL mySQL = new RyQuickSQL("WorkInfo"); - mySQL.AddField("StartTime", dt_now2.AddMinutes(-1)); - mySQL.AddField("EndTime", dt_now2); - mySQL.AddField("stype", stype); - mySQL.AddField("totalSecond", 60); - db.ExecuteNonQuery(mySQL.GetInsertSQL()); - } - db.Free(); - } - /// - /// 时间循环一轮是否结束,结束后才能开始下一轮 - /// - bool TimeComplete = true; - /// - /// 开始休息时间 - /// - DateTime dt_start_idle = DateTime.Now; - /// - /// 添加休息记录 - /// - /// - private void AddRestRecord(RestInfo info) - { - if(Itrycn_Db.list_rest.Count>1000) - { - Itrycn_Db.list_rest.RemoveAt(0); - } - Itrycn_Db.list_rest.Add(info); - OnRestDataChanged?.Invoke(this, new EventArgs()); - } - /// - ///最近一次是否是休息状态 - /// - private bool last_IsRestNowing = Itrycn_Info.IsRestNowing; - /// - /// 最近一次开始休息的时间 - /// - private DateTime last_StartRestTime = DateTime.Now; - private void Timer1_Tick(object sender, EventArgs e) + private void TimeElapsed(object sender, System.Timers.ElapsedEventArgs e) { if (!TimeComplete) { return; } TimeComplete = false; DateTime dt_now = DateTime.Now; - if(last_IsRestNowing!= Itrycn_Info.IsRestNowing) + if (last_IsRestNowing != Itrycn_Info.IsRestNowing) { last_IsRestNowing = Itrycn_Info.IsRestNowing; - if(!last_IsRestNowing) + if (!last_IsRestNowing) { AddRestRecord(new RestInfo() { UserSecondTime = (DateTime.Now - last_StartRestTime).TotalSeconds.ToInt(), Mode = 3 }); } @@ -477,10 +423,10 @@ namespace TimeClock } if (Itrycn_Info.StopRestByIdle) { - var idle =ryCommon.RySystem.GetLastInputTime()/1000; - if(idle>=Itrycn_Info.IdleMinute*60)//闲置超过几分钟 + var idle = ryCommon.RySystem.GetLastInputTime() / 1000; + if (idle >= Itrycn_Info.IdleMinute * 60)//闲置超过几分钟 { - if(!last_idle) + if (!last_idle) { last_idle = true;//从非闲置状态切换到闲置状态 Itrycn_Info.IsStopCalcRestNowing = true; @@ -517,7 +463,7 @@ namespace TimeClock { Itrycn_Info.Timer_index--; var _time = Itrycn_Info.Timer_index; - if(_time==60)//提前一分钟 + if (_time == 60)//提前一分钟 { #region 提前一分钟提醒 if (Itrycn_Info.TipBeforeRest) @@ -536,27 +482,26 @@ namespace TimeClock } } } - catch{ - + catch + { + } if (!is_form_show) { - //System.IO.File.AppendAllText(Application.StartupPath + "\\Logs.txt", - //"\r\n" + DateTime.Now + "\t提前一分钟休息弹窗提醒"); DbOp.FrmBeforeRestTip frm = new DbOp.FrmBeforeRestTip(); frm.FormClosing += delegate (object sender2, FormClosingEventArgs e2) { - if(frm.IsDelay>0) + if (frm.IsDelay > 0) { - AddRestRecord(new RestInfo() { UserSecondTime = frm.IsDelay*60, Mode = 4 }); + AddRestRecord(new RestInfo() { UserSecondTime = frm.IsDelay * 60, Mode = 4 }); } else if (frm.IsDelay == -1) { - AddRestRecord(new RestInfo() { UserSecondTime =0, Mode = 2 }); + AddRestRecord(new RestInfo() { UserSecondTime = 0, Mode = 2 }); } }; frm.Show(); - frm.StartLoad(); + frm.StartLoad(); } } if (Itrycn_Info.SoundBeforeRest) @@ -565,7 +510,7 @@ namespace TimeClock } #endregion } - else if(_time<=0) + else if (_time <= 0) { #region 准时休息提醒 Itrycn_Info.IsRestNowing = true; @@ -597,17 +542,17 @@ namespace TimeClock } } } - if (dt_now.Second<20) + if (dt_now.Second < 20) { if (lastRunTime.AddSeconds(30) > dt_now) - { TimeComplete = true; return; } + { TimeComplete = true; return; } if (GetIsDesignMode()) { TimeComplete = true; return; } - lastRunTime = dt_now; + lastRunTime = dt_now; if (dt_now.Minute == 0)//整点报时 { if (Itrycn_Info.HourlyChime_On)//如果开启了整点报时 { - Thread th = new Thread(delegate() { Itrycn_Info.PlayHours(true); }); + Thread th = new Thread(delegate () { Itrycn_Info.PlayHours(true); }); th.Start(); } } @@ -634,7 +579,7 @@ namespace TimeClock string Pram = tStor.GetAttrValue("Pram"); bool sound_on = tStor.GetAttrValue("sound_on", true); string sound_path = tStor.GetAttrValue("sound", Itrycn_Info.SysDbFolder + @"\animation\sound\tip.wav"); - if (sound_path.Length == 0) { sound_path = Itrycn_Info.SysDbFolder + @"\animation\sound\tip.wav"; } + if (sound_path.Length == 0) { sound_path = Itrycn_Info.SysDbFolder + @"\animation\sound\tip.wav"; } sound_path = Itrycn_Info.GetRealPath(sound_path); bool gif_on = tStor.GetAttrValue("showpic_on", false); string gif_path = Itrycn_Info.GetRealPath(tStor.GetAttrValue("showpic", "")); @@ -650,7 +595,7 @@ namespace TimeClock case "Mute_Off"://取消静音 case "TimeSync"://时间同步 _run_file = Application.StartupPath + "\\RyLine.exe"; - if(!System.IO.File.Exists(_run_file)) + if (!System.IO.File.Exists(_run_file)) { _run_file = AppDomain.CurrentDomain.BaseDirectory.TrimEnd('\\') + "\\RyLine.exe"; } @@ -832,22 +777,85 @@ namespace TimeClock TipChanged(); } } - db.Free(); + db.Free(); #endregion - if(Itrycn_Info.CalcWorkInfo) + if (Itrycn_Info.CalcWorkInfo) { CalcWorkInfo(dt_now); } } - else if(dt_now.Second==40) + else if (dt_now.Second == 40) { - if(dt_now.Minute==0) + if (dt_now.Minute == 0) { UpdateTipTime(true); } } TimeComplete = true; } + DateTime lastRunTime = DateTime.Now.AddDays(-1); + bool last_fullscreen = false; + bool last_idle = false; + /// + /// 计算工作信息 + /// + /// + private void CalcWorkInfo(DateTime dt_now) + { + var idle = ryCommon.RySystem.GetLastInputTime() / 1000; + DateTime dt_now2 = dt_now.AddSeconds(-dt_now.Second).AddMilliseconds(-dt_now.Millisecond); + int stype = 0; + if (idle>=60) + { + stype = 0; + } + else { stype = 1; } + DataProvider mydb = new DataProvider(); + IDbInterface db = TimeClock.Itrycn_Db.CreateDataProvider(TimeClock.Itrycn_Db.dataType); + if (db.ConnDb(TimeClock.Itrycn_Db.WorkInfo_ConnStr) == 1) + { + RyQuickSQL mySQL = new RyQuickSQL("WorkInfo"); + mySQL.AddField("StartTime", dt_now2.AddMinutes(-1)); + mySQL.AddField("EndTime", dt_now2); + mySQL.AddField("stype", stype); + mySQL.AddField("totalSecond", 60); + db.ExecuteNonQuery(mySQL.GetInsertSQL()); + } + db.Free(); + } + /// + /// 时间循环一轮是否结束,结束后才能开始下一轮 + /// + bool TimeComplete = true; + /// + /// 开始休息时间 + /// + DateTime dt_start_idle = DateTime.Now; + /// + /// 添加休息记录 + /// + /// + private void AddRestRecord(RestInfo info) + { + if(Itrycn_Db.list_rest.Count>1000) + { + Itrycn_Db.list_rest.RemoveAt(0); + } + Itrycn_Db.list_rest.Add(info); + OnRestDataChanged?.Invoke(this, new EventArgs()); + } + /// + ///最近一次是否是休息状态 + /// + private bool last_IsRestNowing = Itrycn_Info.IsRestNowing; + /// + /// 最近一次开始休息的时间 + /// + private DateTime last_StartRestTime = DateTime.Now; + private void Timer1_Tick(object sender, EventArgs e) + { + + } } public class TimeInfo { diff --git a/Source/MyTimeClock/TimeClock/RyTimeClock.resx b/Source/MyTimeClock/TimeClock/RyTimeClock.resx index 252d75d..e5858cc 100644 --- a/Source/MyTimeClock/TimeClock/RyTimeClock.resx +++ b/Source/MyTimeClock/TimeClock/RyTimeClock.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 17, 55 - False diff --git a/Source/MyTimeClock/TimeClock/TimeClock.csproj b/Source/MyTimeClock/TimeClock/TimeClock.csproj index cae6371..feda39f 100644 --- a/Source/MyTimeClock/TimeClock/TimeClock.csproj +++ b/Source/MyTimeClock/TimeClock/TimeClock.csproj @@ -47,7 +47,9 @@ ..\..\..\..\睿元公用控件组\Bin\Release\CommonControls\.NET4\RaUI.dll - + + C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\System.dll +