Browse Source

防止连点

tags/录制修改前
zhangxueyang 4 years ago
parent
commit
91216aff6d

+ 2
- 2
XHWK.WKTool/App.config View File

@@ -33,8 +33,8 @@
33 33
     <!--上传每片大小 Mb-->
34 34
     <add key="UploadSliceLen" value="1" />
35 35
     <!--版本号-->
36
-    <add key="VersionCode" value="29" />
37
-    <add key="VersionName" value="1.2.8" />
36
+    <add key="VersionCode" value="30" />
37
+    <add key="VersionName" value="1.2.9" />
38 38
     <add key="ClientSettingsProvider.ServiceUri" value="" />
39 39
   </appSettings>
40 40
   <system.web>

+ 2
- 2
XHWK.WKTool/Properties/AssemblyInfo.cs View File

@@ -49,5 +49,5 @@ using System.Windows;
49 49
 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
50 50
 //通过使用 "*",如下所示:
51 51
 // [assembly: AssemblyVersion("1.0.*")]
52
-[assembly: AssemblyVersion("1.2.8.0")]
53
-[assembly: AssemblyFileVersion("1.2.8.0")]
52
+[assembly: AssemblyVersion("1.2.9.0")]
53
+[assembly: AssemblyFileVersion("1.2.9.0")]

+ 1
- 1
XHWK.WKTool/XHMicroLessonSystemWindow.xaml View File

@@ -255,7 +255,7 @@
255 255
                     <TextBlock x:Name="txbTime" Text="" FontSize="20" Foreground="#FFFFFF" Margin="20,20,0,0"/>
256 256
                 </StackPanel>
257 257
                 <StackPanel Grid.Row="1" HorizontalAlignment="Center">
258
-                    <TextBlock x:Name="txbType" Text="" FontSize="20" Foreground="#FFFFFF" Margin="0,25,0,0"/>
258
+                    <TextBlock x:Name="txbType" Text="" FontSize="20" Foreground="#FFFFFF" Margin="60,25,0,0"/>
259 259
                 </StackPanel>
260 260
                 <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,10,5">
261 261
                     <Button Cursor="Hand" x:Name="btnAdd" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Click="BtnAdd_Click" Margin="0,0,30,0">

+ 45
- 9
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs View File

@@ -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

Loading…
Cancel
Save