Browse Source

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

tags/录制修改前
耀 4 years ago
parent
commit
35cbbcb027

+ 23
- 2
XHWK.WKTool/PracticeWindow.xaml.cs View File

1
 using System;
1
 using System;
2
 using System.Collections.Generic;
2
 using System.Collections.Generic;
3
 using System.IO;
3
 using System.IO;
4
+using System.Threading;
4
 using System.Windows;
5
 using System.Windows;
5
 using System.Windows.Controls;
6
 using System.Windows.Controls;
6
 using System.Windows.Ink;
7
 using System.Windows.Ink;
388
             {
389
             {
389
                 APP.W_ScreenRecordingToolbarWindow.flg = 1;
390
                 APP.W_ScreenRecordingToolbarWindow.flg = 1;
390
             }
391
             }
391
-            blackboard_canvas.Strokes.Clear();
392
-            APP.W_ScreenRecordingToolbarWindow.ReturnPractice();
392
+            ReturnPractice();
393
             //Hide();
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 View File

581
         /// <param name="e"></param>
581
         /// <param name="e"></param>
582
         private void BtnBrush_Click(object sender, RoutedEventArgs e)
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
             string time = GetTimeStamp();
599
             string time = GetTimeStamp();
585
             string tempPath = AppDomain.CurrentDomain.BaseDirectory + "temp\\";
600
             string tempPath = AppDomain.CurrentDomain.BaseDirectory + "temp\\";
586
             if (!Directory.Exists(tempPath))
601
             if (!Directory.Exists(tempPath))
604
                     });
619
                     });
605
                     flg = 1;
620
                     flg = 1;
606
                     this.Owner = null;
621
                     this.Owner = null;
607
-                    APP.W_PracticeWindow.Hide();
622
+                    APP.W_PracticeWindow.ReturnPractice();
608
                 }
623
                 }
609
                 else if (flg == 10)
624
                 else if (flg == 10)
610
                 {
625
                 {
868
         /// <param name="e"></param>
883
         /// <param name="e"></param>
869
         private void BtnBlackPenTwo_Click(object sender, RoutedEventArgs e)
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
             string time = GetTimeStamp();
901
             string time = GetTimeStamp();
872
             string tempPath = AppDomain.CurrentDomain.BaseDirectory + "temp\\";
902
             string tempPath = AppDomain.CurrentDomain.BaseDirectory + "temp\\";
873
             if (!Directory.Exists(tempPath))
903
             if (!Directory.Exists(tempPath))
889
                     });
919
                     });
890
                     flg = 0;
920
                     flg = 0;
891
                     this.Owner = null;
921
                     this.Owner = null;
892
-                    APP.W_PracticeWindow.Hide();
922
+                    APP.W_PracticeWindow.ReturnPractice();
893
                 }
923
                 }
894
                 else if (flg == 11)
924
                 else if (flg == 11)
895
                 {
925
                 {
934
             }
964
             }
935
         }
965
         }
936
         /// <summary>
966
         /// <summary>
937
-        /// 鼠标右键按下事件
967
+        /// 鼠标右键按下事件 废弃
938
         /// </summary>
968
         /// </summary>
939
         /// <param name="sender"></param>
969
         /// <param name="sender"></param>
940
         /// <param name="e"></param>
970
         /// <param name="e"></param>
1058
             Hide();
1088
             Hide();
1059
         }
1089
         }
1060
         /// <summary>
1090
         /// <summary>
1061
-        /// 批注退出
1091
+        /// 批注退出 废弃
1062
         /// </summary>
1092
         /// </summary>
1063
         public void ReturnPractice()
1093
         public void ReturnPractice()
1064
         {
1094
         {
1088
             //Thread.Sleep(300);
1118
             //Thread.Sleep(300);
1089
             //APP.W_PracticeWindow.Hide();
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…
Cancel
Save