Преглед изворни кода

zhao:1笔增加防连击 2解决画笔关掉再打开闪一下

tags/录制修改前
耀 пре 4 година
родитељ
комит
35cbbcb027
2 измењених фајлова са 65 додато и 6 уклоњено
  1. 23
    2
      XHWK.WKTool/PracticeWindow.xaml.cs
  2. 42
    4
      XHWK.WKTool/ScreenRecordingToolbarWindow.xaml.cs

+ 23
- 2
XHWK.WKTool/PracticeWindow.xaml.cs Прегледај датотеку

@@ -1,6 +1,7 @@
1 1
 using System;
2 2
 using System.Collections.Generic;
3 3
 using System.IO;
4
+using System.Threading;
4 5
 using System.Windows;
5 6
 using System.Windows.Controls;
6 7
 using System.Windows.Ink;
@@ -388,10 +389,30 @@ namespace XHWK.WKTool
388 389
             {
389 390
                 APP.W_ScreenRecordingToolbarWindow.flg = 1;
390 391
             }
391
-            blackboard_canvas.Strokes.Clear();
392
-            APP.W_ScreenRecordingToolbarWindow.ReturnPractice();
392
+            ReturnPractice();
393 393
             //Hide();
394 394
         }
395
+        /// <summary>
396
+        /// 退出批注并清空画板
397
+        /// </summary>
398
+        public void ReturnPractice()
399
+        {
400
+            blackboard_canvas.Strokes.Clear();
401
+            new Thread(new ThreadStart(new Action(() =>
402
+            {
403
+                Dispatcher.Invoke(() =>
404
+                {
405
+                    APP.W_ScreenRecordingToolbarWindow.ModifyState();
406
+                });
407
+                flg = 0;
408
+                Thread.Sleep(500);
409
+                Dispatcher.Invoke(() =>
410
+                {
411
+                    this.Owner = null;
412
+                    APP.W_PracticeWindow.Hide();
413
+                });
414
+            }))).Start();
415
+        }
395 416
     }
396 417
 }
397 418
 

+ 42
- 4
XHWK.WKTool/ScreenRecordingToolbarWindow.xaml.cs Прегледај датотеку

@@ -581,6 +581,21 @@ namespace XHWK.WKTool
581 581
         /// <param name="e"></param>
582 582
         private void BtnBrush_Click(object sender, RoutedEventArgs e)
583 583
         {
584
+            #region 防止连击
585
+            if (IsPressButton)
586
+            {
587
+                return;
588
+            }
589
+            else
590
+            {
591
+                IsPressButton = true;
592
+                new Thread(new ThreadStart(new Action(() =>
593
+                {
594
+                    Thread.Sleep(500);
595
+                    IsPressButton = false;
596
+                }))).Start();
597
+            }
598
+            #endregion
584 599
             string time = GetTimeStamp();
585 600
             string tempPath = AppDomain.CurrentDomain.BaseDirectory + "temp\\";
586 601
             if (!Directory.Exists(tempPath))
@@ -604,7 +619,7 @@ namespace XHWK.WKTool
604 619
                     });
605 620
                     flg = 1;
606 621
                     this.Owner = null;
607
-                    APP.W_PracticeWindow.Hide();
622
+                    APP.W_PracticeWindow.ReturnPractice();
608 623
                 }
609 624
                 else if (flg == 10)
610 625
                 {
@@ -868,6 +883,21 @@ namespace XHWK.WKTool
868 883
         /// <param name="e"></param>
869 884
         private void BtnBlackPenTwo_Click(object sender, RoutedEventArgs e)
870 885
         {
886
+            #region 防止连击
887
+            if (IsPressButton)
888
+            {
889
+                return;
890
+            }
891
+            else
892
+            {
893
+                IsPressButton = true;
894
+                new Thread(new ThreadStart(new Action(() =>
895
+                {
896
+                    Thread.Sleep(500);
897
+                    IsPressButton = false;
898
+                }))).Start();
899
+            }
900
+            #endregion
871 901
             string time = GetTimeStamp();
872 902
             string tempPath = AppDomain.CurrentDomain.BaseDirectory + "temp\\";
873 903
             if (!Directory.Exists(tempPath))
@@ -889,7 +919,7 @@ namespace XHWK.WKTool
889 919
                     });
890 920
                     flg = 0;
891 921
                     this.Owner = null;
892
-                    APP.W_PracticeWindow.Hide();
922
+                    APP.W_PracticeWindow.ReturnPractice();
893 923
                 }
894 924
                 else if (flg == 11)
895 925
                 {
@@ -934,7 +964,7 @@ namespace XHWK.WKTool
934 964
             }
935 965
         }
936 966
         /// <summary>
937
-        /// 鼠标右键按下事件
967
+        /// 鼠标右键按下事件 废弃
938 968
         /// </summary>
939 969
         /// <param name="sender"></param>
940 970
         /// <param name="e"></param>
@@ -1058,7 +1088,7 @@ namespace XHWK.WKTool
1058 1088
             Hide();
1059 1089
         }
1060 1090
         /// <summary>
1061
-        /// 批注退出
1091
+        /// 批注退出 废弃
1062 1092
         /// </summary>
1063 1093
         public void ReturnPractice()
1064 1094
         {
@@ -1088,5 +1118,13 @@ namespace XHWK.WKTool
1088 1118
             //Thread.Sleep(300);
1089 1119
             //APP.W_PracticeWindow.Hide();
1090 1120
         }
1121
+        /// <summary>
1122
+        /// 修改笔状态
1123
+        /// </summary>
1124
+        public void ModifyState()
1125
+        {
1126
+            borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
1127
+            borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
1128
+        }
1091 1129
     }
1092 1130
 }

Loading…
Откажи
Сачувај