Browse Source

微课发版

master
张剑 1 year ago
parent
commit
b6e7f22318

+ 2
- 2
.editorconfig View File

@@ -10,7 +10,7 @@ resharper_xaml_binding_without_context_not_resolved_highlighting = none
10 10
 resharper_xaml_binding_with_context_not_resolved_highlighting = none
11 11
 
12 12
 # ReSharper properties
13
-resharper_csharp_max_line_length = 100
13
+resharper_csharp_max_line_length = 400
14 14
 resharper_csharp_wrap_arguments_style = chop_if_long
15 15
 resharper_csharp_wrap_before_binary_opsign = true
16 16
 resharper_csharp_wrap_before_declaration_lpar = true
@@ -116,4 +116,4 @@ csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
116 116
 csharp_style_throw_expression = true:suggestion
117 117
 csharp_style_var_elsewhere = true:silent
118 118
 csharp_style_var_for_built_in_types = true:silent
119
-csharp_style_var_when_type_is_apparent = true:silent
119
+csharp_style_var_when_type_is_apparent = true:silent

+ 1
- 1
XHWK.WKTool/App.xaml.cs View File

@@ -195,7 +195,7 @@ namespace XHWK.WKTool
195 195
         /// <summary>
196 196
         /// 画板模型
197 197
         /// </summary>
198
-        public static List<Model_DrawData> PageDrawList = null;
198
+        public static List<Model_DrawData> PageDrawList = new List<Model_DrawData>();
199 199
 
200 200
         #endregion 微课数据记录
201 201
 

+ 7
- 11
XHWK.WKTool/MainWindow.xaml View File

@@ -806,14 +806,13 @@
806 806
                                         </Grid>
807 807
                                     </ScrollViewer>
808 808
                                     <Image
809
-                                        x:Name="imgPlayerLeft"
809
+                                        x:Name="ImgPlayerLeft"
810 810
                                         Width="172"
811 811
                                         Height="124"
812 812
                                         Margin="10,7,10,10"
813 813
                                         HorizontalAlignment="Left"
814 814
                                         VerticalAlignment="Top"
815 815
                                         RenderTransformOrigin="0.5,0.5"
816
-                                        Source="./Images/microLessonSystem_17.png"
817 816
                                         Visibility="Collapsed">
818 817
                                         <Image.RenderTransform>
819 818
                                             <ScaleTransform ScaleX="-1" />
@@ -829,35 +828,32 @@
829 828
                                         HorizontalAlignment="Right"
830 829
                                         VerticalAlignment="Top"
831 830
                                         RenderTransformOrigin="0.5,0.5"
832
-                                        Source="./Images/microLessonSystem_17.png"
833 831
                                         Visibility="Collapsed">
834 832
                                         <Image.RenderTransform>
835 833
                                             <ScaleTransform ScaleX="-1" />
836 834
                                         </Image.RenderTransform>
837 835
                                     </Image>
838 836
                                     <Image
839
-                                        x:Name="imgPlayerLeftUnder"
837
+                                        x:Name="ImgPlayerLeftUnder"
840 838
                                         Width="172"
841 839
                                         Height="124"
842 840
                                         Margin="10,7,10,10"
843 841
                                         HorizontalAlignment="Left"
844 842
                                         VerticalAlignment="Bottom"
845 843
                                         RenderTransformOrigin="0.5,0.5"
846
-                                        Source="./Images/microLessonSystem_17.png"
847 844
                                         Visibility="Collapsed">
848 845
                                         <Image.RenderTransform>
849 846
                                             <ScaleTransform ScaleX="-1" />
850 847
                                         </Image.RenderTransform>
851 848
                                     </Image>
852 849
                                     <Image
853
-                                        x:Name="imgPlayerRightUnder"
850
+                                        x:Name="ImgPlayerRightUnder"
854 851
                                         Width="172"
855 852
                                         Height="124"
856 853
                                         Margin="10,7,26,10"
857 854
                                         HorizontalAlignment="Right"
858 855
                                         VerticalAlignment="Bottom"
859 856
                                         RenderTransformOrigin="0.5,0.5"
860
-                                        Source="./Images/microLessonSystem_17.png"
861 857
                                         Visibility="Collapsed">
862 858
                                         <Image.RenderTransform>
863 859
                                             <ScaleTransform ScaleX="-1" />
@@ -1139,7 +1135,7 @@
1139 1135
                                     FontSize="12"
1140 1136
                                     Text="摄像头: " />
1141 1137
                                 <RadioButton
1142
-                                    x:Name="rbnOpen"
1138
+                                    x:Name="RbnOpen"
1143 1139
                                     Margin="0,0,0,0"
1144 1140
                                     VerticalAlignment="Center"
1145 1141
                                     Click="RbnOpen_Click"
@@ -1148,7 +1144,7 @@
1148 1144
                                     FontSize="12"
1149 1145
                                     Style="{StaticResource RadBase}" />
1150 1146
                                 <RadioButton
1151
-                                    x:Name="rbnTurnOff"
1147
+                                    x:Name="RbnTurnOff"
1152 1148
                                     Margin="5,0,10,0"
1153 1149
                                     VerticalAlignment="Center"
1154 1150
                                     Click="RbnTurnOff_Click"
@@ -1638,7 +1634,7 @@
1638 1634
                                     <Grid Grid.Column="2">
1639 1635
                                         <!--  保存  -->
1640 1636
                                         <Button
1641
-                                            x:Name="btnSave"
1637
+                                            x:Name="BtnSave"
1642 1638
                                             Width="76"
1643 1639
                                             Height="30"
1644 1640
                                             HorizontalAlignment="Stretch"
@@ -1663,7 +1659,7 @@
1663 1659
                                             Text="设备"
1664 1660
                                             Visibility="Hidden" />
1665 1661
                                         <TextBlock
1666
-                                            x:Name="txbNotConnecteds"
1662
+                                            x:Name="TxbNotConnecteds"
1667 1663
                                             Margin="30,30,0,0"
1668 1664
                                             FontSize="14"
1669 1665
                                             Foreground="#333333"

+ 912
- 1912
XHWK.WKTool/MainWindow.xaml.cs
File diff suppressed because it is too large
View File


+ 2
- 2
XHWK.WKTool/MessageWindow.xaml View File

@@ -8,7 +8,7 @@
8 8
     Width="446"
9 9
     Height="188"
10 10
     d:DesignHeight="250"
11
-    AllowsTransparency="True"
11
+    AllowsTransparency="False"
12 12
     MouseMove="Window_MouseMove"
13 13
     ResizeMode="NoResize"
14 14
     ShowInTaskbar="False"
@@ -16,7 +16,7 @@
16 16
     Topmost="True"
17 17
     WindowStartupLocation="CenterScreen"
18 18
     WindowState="Normal"
19
-    WindowStyle="None"
19
+    WindowStyle="SingleBorderWindow"
20 20
     mc:Ignorable="d">
21 21
 
22 22
     <Border

+ 3
- 5
XHWK.WKTool/ScreenRecordingToolbarWindow.xaml.cs View File

@@ -399,8 +399,7 @@ namespace XHWK.WKTool
399 399
             }
400 400
 
401 401
             APP.W_XHMicroLessonSystemWindow.InitializeKeyDownEvent();
402
-
403
-            APP.W_XHMicroLessonSystemWindow.InitTQLPPen();
402
+            APP.W_XHMicroLessonSystemWindow.InitTqlpPen();
404 403
             APP.W_XHMicroLessonSystemWindow.Show();
405 404
             End();
406 405
             if (t != null)
@@ -461,8 +460,7 @@ namespace XHWK.WKTool
461 460
             }
462 461
 
463 462
             APP.W_XHMicroLessonSystemWindow.InitializeKeyDownEvent();
464
-
465
-            APP.W_XHMicroLessonSystemWindow.InitTQLPPen();
463
+            APP.W_XHMicroLessonSystemWindow.InitTqlpPen();
466 464
             APP.W_XHMicroLessonSystemWindow.Show();
467 465
 
468 466
             if (_state == State.Pause || _state == State.Start)
@@ -878,7 +876,7 @@ namespace XHWK.WKTool
878 876
 
879 877
             APP.W_XHMicroLessonSystemWindow.InitializeKeyDownEvent();
880 878
             //APP.W_XHMicroLessonSystemWindow.InitPen();
881
-            APP.W_XHMicroLessonSystemWindow.InitTQLPPen();
879
+            APP.W_XHMicroLessonSystemWindow.InitTqlpPen();
882 880
             APP.W_XHMicroLessonSystemWindow.Show();
883 881
 
884 882
             new Thread(new ThreadStart(new Action(() =>

+ 14
- 8
XHWK.WKTool/Utils/pen/TQLPen/PenEvents.cs View File

@@ -331,17 +331,22 @@ namespace XHWK.WKTool
331 331
                 }
332 332
                 else if (dot.type == DotType.PEN_DOWN)
333 333
                 {
334
-                    APP.W_XHMicroLessonSystemWindow.TQLDown();
334
+                    APP.W_XHMicroLessonSystemWindow.TqlDown();
335 335
                 }
336 336
                 else if (dot.type == DotType.PEN_UP)
337 337
                 {
338
-                    APP.W_XHMicroLessonSystemWindow.TQLUp();
338
+                    APP.W_XHMicroLessonSystemWindow.TqlUp();
339 339
                 }
340 340
                 else if (dot.type == DotType.PEN_MOVE)
341 341
                 {
342 342
                     double CX = (double)dot.x + (double)dot.fx / 100.00;
343 343
                     double CY = (double)dot.y + (double)dot.fy / 100.00;
344
-                    APP.W_XHMicroLessonSystemWindow.TQLPenWrite(CX, CY, dot.force);
344
+                    APP.W_XHMicroLessonSystemWindow.TqlPenWrite
345
+                    (
346
+                        CX,
347
+                        CY,
348
+                        dot.force
349
+                    );
345 350
                     //form.AddLog("x:" + (dot.x + dot.fx / 100f).ToString() + ", " + "y:" + (dot.y + dot.fy / 100f).ToString());
346 351
                 }
347 352
             }
@@ -364,7 +369,12 @@ namespace XHWK.WKTool
364 369
                 {
365 370
                     double CX = (double)dot.x + (double)dot.fx / 100.00;
366 371
                     double CY = (double)dot.y + (double)dot.fy / 100.00;
367
-                    APP.W_PracticeWindow.TqlPenWrite(CX, CY, dot.force);
372
+                    APP.W_PracticeWindow.TqlPenWrite
373
+                    (
374
+                        CX,
375
+                        CY,
376
+                        dot.force
377
+                    );
368 378
                     //form.AddLog("x:" + (dot.x + dot.fx / 100f).ToString() + ", " + "y:" + (dot.y + dot.fy / 100f).ToString());
369 379
                 }
370 380
             }
@@ -375,7 +385,6 @@ namespace XHWK.WKTool
375 385
             //    //form.AddLog("Dot_S:" + this.S.ToString() + ", " + "Dot_O:" + this.O.ToString() + ", " + "Dot_B:" + this.B.ToString() + ", " + "Dot_P:" + this.P.ToString());
376 386
             //}
377 387
 
378
-
379 388
             //if (dot.type == DotType.PEN_HOVER) return;
380 389
             //if (this.S != dot.sectionId || this.O != dot.ownerId || this.B != dot.noteId || this.P != dot.pageId)
381 390
             //{
@@ -386,14 +395,11 @@ namespace XHWK.WKTool
386 395
             //{
387 396
             //    //form.AddLog("x:" + (dot.x + dot.fx / 100f).ToString() + ", " + "y:" + (dot.y + dot.fy / 100f).ToString());
388 397
             //}
389
-
390
-
391 398
             ///*  if (dot.type == DotType.PEN_DOWN || dot.type == DotType.PEN_MOVE || dot.type == DotType.PEN_UP)
392 399
             //  {
393 400
             //      form.AddLog("Dot_type:" + dot.type.ToString() + ", " + "Dot_force:" + dot.force.ToString());
394 401
             //  } */
395 402
 
396
-
397 403
             ////if (DrawingBox.DrawType != 2) DrawingBox.DrawType = 1;
398 404
             ////form.Drawing(dot);
399 405
             //if (DrawIngend == true)

+ 25
- 19
XHWK.WKTool/system/CameraHelper.cs View File

@@ -14,10 +14,9 @@
14 14
     {
15 15
         private static List<FilterInfo> _cameraDevices;
16 16
         private static VideoCaptureDevice _div;
17
-        private static VideoSourcePlayer _sourcePlayer = new VideoSourcePlayer();
17
+        private static readonly VideoSourcePlayer SourcePlayer = new VideoSourcePlayer();
18 18
 
19 19
         //指示_isDisplay设置为true后,是否设置了其他的sourcePlayer,若未设置则_isDisplay重设为false
20
-        private static bool _isSet;
21 20
 
22 21
         private static Dispatcher _dispatcher;
23 22
         public static Action<BitmapImage> imageCallback;
@@ -36,6 +35,7 @@
36 35
         /// </summary>
37 36
         public static void UpdateCameraDevices()
38 37
         {
38
+            // ReSharper disable once CollectionNeverUpdated.Local
39 39
             var devs = new FilterInfoCollection(FilterCategory.VideoInputDevice); //获取摄像头列表
40 40
             List<FilterInfo> allCamera = new List<FilterInfo>();
41 41
             foreach (FilterInfo dev in devs)
@@ -70,27 +70,27 @@
70 70
             // 设定初始视频设备
71 71
             _div = new VideoCaptureDevice(_cameraDevices[index].MonikerString);
72 72
             _div.NewFrame += _div_NewFrame;
73
-            _sourcePlayer.VideoSource = _div;
73
+            SourcePlayer.VideoSource = _div;
74 74
             _div.Start();
75
-            _sourcePlayer.Start();
75
+            SourcePlayer.Start();
76 76
             return true;
77 77
         }
78 78
 
79 79
         private static void _div_NewFrame(object sender, AForge.Video.NewFrameEventArgs eventArgs)
80 80
         {
81
-            _dispatcher.Invoke
81
+            _dispatcher?.Invoke
82 82
             (
83 83
                 () =>
84 84
                 {
85
-                    MemoryStream ms = new MemoryStream();
86
-                    eventArgs.Frame.Save(ms, ImageFormat.Bmp);
87
-                    BitmapImage image = new BitmapImage();
88
-                    image.BeginInit();
89
-                    image.StreamSource = new MemoryStream(ms.GetBuffer());
90
-                    ms.Close();
91
-                    ms.Dispose();
92
-                    image.EndInit();
93
-                    imageCallback?.Invoke(image);
85
+                    using (MemoryStream ms = new MemoryStream())
86
+                    {
87
+                        eventArgs.Frame.Save(ms, ImageFormat.Bmp);
88
+                        BitmapImage image = new BitmapImage { CacheOption = BitmapCacheOption.OnLoad };
89
+                        image.BeginInit();
90
+                        image.StreamSource = new MemoryStream(ms.GetBuffer());
91
+                        image.EndInit();
92
+                        imageCallback?.Invoke(image);
93
+                    }
94 94
                 }
95 95
             );
96 96
         }
@@ -103,7 +103,7 @@
103 103
         /// <returns>如果保存成功,则返回完整路径,否则为 null</returns>
104 104
         public static string CaptureImage(string filePath, string fileName = null)
105 105
         {
106
-            if (_sourcePlayer.VideoSource == null)
106
+            if (SourcePlayer.VideoSource == null)
107 107
             {
108 108
                 return null;
109 109
             }
@@ -113,7 +113,7 @@
113 113
             }
114 114
             try
115 115
             {
116
-                Image bitmap = _sourcePlayer.GetCurrentVideoFrame();
116
+                Image bitmap = SourcePlayer.GetCurrentVideoFrame();
117 117
                 if (bitmap != null)
118 118
                 {
119 119
                     if (fileName == null)
@@ -146,11 +146,17 @@
146 146
         /// </summary>
147 147
         public static void CloseDevice()
148 148
         {
149
-            if (_div != null && _div.IsRunning)
149
+            if (_div != null)
150 150
             {
151 151
                 _div.NewFrame -= _div_NewFrame;
152
-                _sourcePlayer.Stop();
153
-                _div.SignalToStop();
152
+                if (SourcePlayer.IsRunning)
153
+                {
154
+                    SourcePlayer.Stop();
155
+                }
156
+                if (_div.IsRunning)
157
+                {
158
+                    _div.SignalToStop();
159
+                }
154 160
                 _div = null;
155 161
             }
156 162
         }

+ 1
- 1
星火微课/星火微课-正式.iss View File

@@ -3,7 +3,7 @@
3 3
 
4 4
 #define MyAppName "星火微课"  
5 5
 #define MyAppDir "xhwk"
6
-#define MyAppVersion "3.2.7"
6
+#define MyAppVersion "3.9.0"
7 7
 #define MyAppPublisher "河南星火燎原软件科技有限公司"
8 8
 #define MyAppURL "http://www.xhkjedu.com/"
9 9
 #define MySourcePath "D:\Project\CSharp\xhwkclient\XHWK.WKTool\bin\x86\Debug\"

Loading…
Cancel
Save