|
@@ -346,21 +346,34 @@ namespace XHWK.WKTool
|
346
|
346
|
/// <param name="e"></param>
|
347
|
347
|
private void RbnOpen_Click(object sender, RoutedEventArgs e)
|
348
|
348
|
{
|
349
|
|
- //UCCamera win = new UCCamera();
|
350
|
|
- ////win.Topmost = true;
|
351
|
|
- //win.ShowDialog();
|
|
349
|
+ if (!IsRbnOpen)
|
|
350
|
+ {
|
|
351
|
+ #region 防止连击
|
|
352
|
+ if (IsPressButton)
|
|
353
|
+ {
|
|
354
|
+ return;
|
|
355
|
+ }
|
|
356
|
+ else
|
|
357
|
+ {
|
|
358
|
+ IsPressButton = true;
|
|
359
|
+ new Thread(new ThreadStart(new Action(() =>
|
|
360
|
+ {
|
|
361
|
+ //Dispatcher.Invoke(new Action(() => { rbnTurnOff.IsEnabled = false; }));
|
352
|
362
|
|
|
363
|
+ Thread.Sleep(500);
|
|
364
|
+ //Dispatcher.Invoke(new Action(() => { rbnTurnOff.IsEnabled = true; }));
|
353
|
365
|
|
|
366
|
+ IsPressButton = false;
|
|
367
|
+ }))).Start();
|
|
368
|
+ }
|
|
369
|
+ #endregion
|
354
|
370
|
|
355
|
|
- //wfhCamera.Visibility = Visibility.Visible;
|
356
|
|
- //CameraHelper.IsDisplay = true;
|
357
|
|
- //CameraHelper.SourcePlayer = player;
|
358
|
|
- CameraHelper.UpdateCameraDevices();
|
|
371
|
+ CameraHelper.UpdateCameraDevices();
|
359
|
372
|
if (CameraHelper.CameraDevices.Count > 0)
|
360
|
373
|
{
|
361
|
374
|
CameraHelper.SetCameraDevice(0);
|
362
|
375
|
RbnOpen = new List<string>();
|
363
|
|
- times = new System.Timers.Timer(100)//初始值为300
|
|
376
|
+ times = new System.Timers.Timer(200)//初始值为300
|
364
|
377
|
{
|
365
|
378
|
AutoReset = true//设置是否执行System.Timers.Timer.Elapsed事件
|
366
|
379
|
};//设置执行一次(false)还是一直执行(true)
|
|
@@ -372,6 +385,7 @@ namespace XHWK.WKTool
|
372
|
385
|
string imgPath = FileToolsCommon.GetFileAbsolutePath("Temp/imgplayer");
|
373
|
386
|
FileToolsCommon.CreateDirectory(imgPath);
|
374
|
387
|
}
|
|
388
|
+ }
|
375
|
389
|
}
|
376
|
390
|
|
377
|
391
|
private int I = 9999;
|
|
@@ -451,13 +465,35 @@ namespace XHWK.WKTool
|
451
|
465
|
/// <param name="e"></param>
|
452
|
466
|
private void RbnTurnOff_Click(object sender, RoutedEventArgs e)
|
453
|
467
|
{
|
454
|
|
- IsRbnOpen = false;
|
|
468
|
+ if(IsRbnOpen)
|
|
469
|
+ {
|
|
470
|
+ #region 防止连击
|
|
471
|
+ if (IsPressButton)
|
|
472
|
+ {
|
|
473
|
+ return;
|
|
474
|
+ }
|
|
475
|
+ else
|
|
476
|
+ {
|
|
477
|
+ IsPressButton = true;
|
|
478
|
+ new Thread(new ThreadStart(new Action(() =>
|
|
479
|
+ {
|
|
480
|
+ //Dispatcher.Invoke(new Action(() => { rbnOpen.IsEnabled = false; }));
|
|
481
|
+
|
|
482
|
+ Thread.Sleep(500);
|
|
483
|
+ //Dispatcher.Invoke(new Action(() => { rbnOpen.IsEnabled = true; }));
|
|
484
|
+
|
|
485
|
+ IsPressButton = false;
|
|
486
|
+ }))).Start();
|
|
487
|
+ }
|
|
488
|
+ #endregion
|
|
489
|
+ IsRbnOpen = false;
|
455
|
490
|
imgPlayerRight.Visibility = Visibility.Collapsed;
|
456
|
491
|
imgPlayerLeft.Visibility = Visibility.Collapsed;
|
457
|
492
|
imgPlayerRightUnder.Visibility = Visibility.Collapsed;
|
458
|
493
|
imgPlayerLeftUnder.Visibility = Visibility.Collapsed;
|
459
|
494
|
CameraHelper.CloseDevice();
|
460
|
495
|
I = 9999;
|
|
496
|
+ }
|
461
|
497
|
}
|
462
|
498
|
#endregion
|
463
|
499
|
#endregion
|