|
@@ -56,10 +56,7 @@ namespace XHWK.WKTool
|
56
|
56
|
/// 状态
|
57
|
57
|
/// </summary>
|
58
|
58
|
private State _state = State.End;
|
59
|
|
- /// <summary>
|
60
|
|
- /// 计时用
|
61
|
|
- /// </summary>
|
62
|
|
- private TimeSpan _timeSpan = new TimeSpan(0, 0, 0, 0, 0);
|
|
59
|
+
|
63
|
60
|
private KeyboardHookCommon k_hook;
|
64
|
61
|
/// <summary>
|
65
|
62
|
/// 🖊状态 0红色 1蓝色 10红色批注内 11蓝色批注内
|
|
@@ -145,11 +142,11 @@ namespace XHWK.WKTool
|
145
|
142
|
{
|
146
|
143
|
t = new DispatcherTimer();
|
147
|
144
|
t.Tick += OnTimer;
|
148
|
|
- t.Interval = new TimeSpan(0, 0, 0, 1);
|
|
145
|
+ t.Interval = new TimeSpan(0, 0, 0,0, 300);
|
149
|
146
|
t.IsEnabled = true;
|
150
|
147
|
t.Start();
|
151
|
148
|
}
|
152
|
|
- t.Interval = new TimeSpan(0, 0, 0, 1);
|
|
149
|
+ t.Interval = new TimeSpan(0, 0, 0, 0,300);
|
153
|
150
|
//Stack();
|
154
|
151
|
//ImgRecordingScreen.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar25.png"));
|
155
|
152
|
//BtnRecordingScreen_Click(null, null);
|
|
@@ -199,6 +196,11 @@ namespace XHWK.WKTool
|
199
|
196
|
|
200
|
197
|
#region 事件
|
201
|
198
|
/// <summary>
|
|
199
|
+ /// 记录上次执行时间
|
|
200
|
+ /// </summary>
|
|
201
|
+ private DateTime Recorddt = DateTime.Now;
|
|
202
|
+ DateTime SRTime = Convert.ToDateTime("2020-01-01 00:00:00");
|
|
203
|
+ /// <summary>
|
202
|
204
|
/// 时钟回调
|
203
|
205
|
/// </summary>
|
204
|
206
|
/// <param name="sender"></param>
|
|
@@ -209,7 +211,14 @@ namespace XHWK.WKTool
|
209
|
211
|
{
|
210
|
212
|
case State.Start:
|
211
|
213
|
{
|
212
|
|
- _timeSpan += new TimeSpan(0, 0, 0, 1);
|
|
214
|
+ DateTime dt = DateTime.Now;
|
|
215
|
+ TimeSpan ts = dt.Subtract(Recorddt);//时间差
|
|
216
|
+ double tsmi = ts.TotalMilliseconds;
|
|
217
|
+ if (tsmi > 500.0)
|
|
218
|
+ {
|
|
219
|
+ Recorddt = Recorddt.AddMilliseconds(500);
|
|
220
|
+ SRTime = SRTime.AddMilliseconds(500);
|
|
221
|
+ }
|
213
|
222
|
}
|
214
|
223
|
break;
|
215
|
224
|
|
|
@@ -220,16 +229,31 @@ namespace XHWK.WKTool
|
220
|
229
|
|
221
|
230
|
case State.End:
|
222
|
231
|
{
|
223
|
|
- _timeSpan = new TimeSpan();
|
224
|
|
- //_timeSpan = new TimeSpan(0, 23, 12, 45, 54);
|
|
232
|
+ SRTime = Convert.ToDateTime("2020-01-01 00:00:00");
|
|
233
|
+ //_timeSpan = new TimeSpan();
|
|
234
|
+ ////_timeSpan = new TimeSpan(0, 23, 12, 45, 54);
|
225
|
235
|
}
|
226
|
236
|
break;
|
227
|
237
|
}
|
228
|
238
|
|
229
|
|
- string time = string.Format("{0:D2}:{1:D2}",/* _timeSpan.Hours,*/ _timeSpan.Minutes, _timeSpan.Seconds);
|
|
239
|
+ //string time = string.Format("{0:D2}:{1:D2}",/* _timeSpan.Hours,*/ _timeSpan.Minutes, _timeSpan.Seconds);
|
230
|
240
|
//char[] times = time.ToCharArray();
|
231
|
|
- txbTime.Text = time;
|
|
241
|
+ if (SRTime.Hour > 0)
|
|
242
|
+ {
|
|
243
|
+ //Dispatcher.Invoke(() =>
|
|
244
|
+ //{
|
|
245
|
+ txbTime.Text = SRTime.ToString("HH:mm:ss");
|
|
246
|
+ //});
|
|
247
|
+ }
|
|
248
|
+ else
|
|
249
|
+ {
|
|
250
|
+ //Dispatcher.Invoke(() =>
|
|
251
|
+ //{
|
|
252
|
+ txbTime.Text = SRTime.ToString("mm:ss");
|
|
253
|
+ //});
|
|
254
|
+ }
|
232
|
255
|
}
|
|
256
|
+
|
233
|
257
|
/// <summary>
|
234
|
258
|
/// 开始
|
235
|
259
|
/// </summary>
|
|
@@ -237,6 +261,7 @@ namespace XHWK.WKTool
|
237
|
261
|
/// <param name="e"></param>
|
238
|
262
|
private void Stack()
|
239
|
263
|
{
|
|
264
|
+ Recorddt = DateTime.Now;
|
240
|
265
|
_state = State.Start;
|
241
|
266
|
}
|
242
|
267
|
/// <summary>
|
|
@@ -556,7 +581,7 @@ namespace XHWK.WKTool
|
556
|
581
|
{
|
557
|
582
|
try
|
558
|
583
|
{
|
559
|
|
- if (_timeSpan.Minutes > 0 || _timeSpan.Seconds > 3)
|
|
584
|
+ if (SRTime.Hour > 0 || SRTime.Minute > 0 || SRTime.Second > 3)
|
560
|
585
|
{
|
561
|
586
|
try
|
562
|
587
|
{
|