Browse Source

录屏中使用画笔录制无法结束的BUG

master
张剑 2 years ago
parent
commit
30e603570f

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

9
     <!--参数是否加密 0不加密 1加密-->
9
     <!--参数是否加密 0不加密 1加密-->
10
     <add key="IsParameterEncryption" value="0" />
10
     <add key="IsParameterEncryption" value="0" />
11
     <!--版本号-->
11
     <!--版本号-->
12
-    <add key="VersionCode" value="112" />
13
-    <add key="VersionName" value="3.2.3" />
12
+    <add key="VersionCode" value="113" />
13
+    <add key="VersionName" value="3.2.4" />
14
     <!--皮肤样式 0白 1蓝 2黑色 -->
14
     <!--皮肤样式 0白 1蓝 2黑色 -->
15
     <add key="SkinStyle" value="0" />
15
     <add key="SkinStyle" value="0" />
16
     <!--是否输出视频记录日志:0否-->
16
     <!--是否输出视频记录日志:0否-->

+ 0
- 2
XHWK.WKTool/App.xaml.cs View File

9
 using System.Linq;
9
 using System.Linq;
10
 using System.Reflection;
10
 using System.Reflection;
11
 using System.Security.Principal;
11
 using System.Security.Principal;
12
-using System.Threading;
13
 using System.Threading.Tasks;
12
 using System.Threading.Tasks;
14
 using System.Windows;
13
 using System.Windows;
15
-using System.Windows.Threading;
16
 
14
 
17
 using TStudyDigitalPen.HID;
15
 using TStudyDigitalPen.HID;
18
 
16
 

+ 8
- 25
XHWK.WKTool/AppUpdateWin.xaml View File

17
     WindowStartupLocation="CenterScreen"
17
     WindowStartupLocation="CenterScreen"
18
     WindowStyle="None"
18
     WindowStyle="None"
19
     mc:Ignorable="d">
19
     mc:Ignorable="d">
20
-    <Window.Effect>
21
-        <DropShadowEffect
22
-            BlurRadius="10"
23
-            Direction="80"
24
-            ShadowDepth="0"
25
-            Color="#eeeeee" />
26
-    </Window.Effect>
27
-    <Grid>
28
-        <Views:ZJClippingBorder
29
-            Margin="10"
30
-            Background="#fafafa"
31
-            CornerRadius="10">
32
-            <Border.Effect>
33
-                <DropShadowEffect
34
-                    BlurRadius="10"
35
-                    Opacity="1"
36
-                    ShadowDepth="0"
37
-                    Color="#cccccc" />
38
-            </Border.Effect>
39
-        </Views:ZJClippingBorder>
40
 
20
 
21
+    <Grid>
41
         <Views:ZJClippingBorder
22
         <Views:ZJClippingBorder
42
-            Margin="10"
23
+            Margin="0"
43
             Background="#fafafa"
24
             Background="#fafafa"
44
-            CornerRadius="10">
25
+            BorderBrush="#3f6fff"
26
+            BorderThickness="1"
27
+            CornerRadius="0">
45
 
28
 
46
             <Grid>
29
             <Grid>
47
                 <Grid.RowDefinitions>
30
                 <Grid.RowDefinitions>
48
-                    <RowDefinition Height="64" />
31
+                    <RowDefinition Height="44" />
49
                     <RowDefinition Height="*" />
32
                     <RowDefinition Height="*" />
50
                     <RowDefinition Height="64" />
33
                     <RowDefinition Height="64" />
51
                 </Grid.RowDefinitions>
34
                 </Grid.RowDefinitions>
52
                 <StackPanel Grid.Row="0" Orientation="Horizontal">
35
                 <StackPanel Grid.Row="0" Orientation="Horizontal">
53
                     <Image
36
                     <Image
54
-                        Width="35"
37
+                        Width="26"
55
                         Margin="10,5,0,0"
38
                         Margin="10,5,0,0"
56
                         VerticalAlignment="Center"
39
                         VerticalAlignment="Center"
57
                         Source="/Images/APP.png" />
40
                         Source="/Images/APP.png" />
60
                         Grid.Row="0"
43
                         Grid.Row="0"
61
                         Margin="10,0,0,0"
44
                         Margin="10,0,0,0"
62
                         VerticalAlignment="Center"
45
                         VerticalAlignment="Center"
63
-                        FontSize="26"
46
+                        FontSize="24"
64
                         Foreground="#333333"
47
                         Foreground="#333333"
65
                         Text="应用更新" />
48
                         Text="应用更新" />
66
                 </StackPanel>
49
                 </StackPanel>

+ 17
- 7
XHWK.WKTool/AppUpdateWin.xaml.cs View File

84
             progress_sp.Visibility = Visibility.Collapsed;
84
             progress_sp.Visibility = Visibility.Collapsed;
85
             content_sv.Visibility = Visibility.Visible;
85
             content_sv.Visibility = Visibility.Visible;
86
             button_bottom.Visibility = Visibility.Visible;
86
             button_bottom.Visibility = Visibility.Visible;
87
-            ProcessStartInfo psi = new ProcessStartInfo(filepath);
88
-            Process pro = new Process
87
+            try
89
             {
88
             {
90
-                StartInfo = psi
91
-            };
92
-            pro.Start();
89
+                using (Process process = new Process())
90
+                {
91
+                    process.StartInfo.FileName = filepath;
92
+                    process.StartInfo.CreateNoWindow = true;
93
+                    process.StartInfo.UseShellExecute = false;
94
+                    process.StartInfo.RedirectStandardOutput = true;
95
+                    process.StartInfo.RedirectStandardError = true;
96
+
97
+                    process.Start();
98
+                }
99
+            }
100
+            catch (Exception)
101
+            {
102
+            }
93
             Dispatcher.Invoke(new Action(() =>
103
             Dispatcher.Invoke(new Action(() =>
94
             {
104
             {
95
-                System.Environment.Exit(0);
105
+                Environment.Exit(0);
96
             }));
106
             }));
97
             Close();
107
             Close();
98
         }
108
         }
102
             MessageWindow.Show(msg);
112
             MessageWindow.Show(msg);
103
         }
113
         }
104
     }
114
     }
105
-}
115
+}

+ 5
- 7
XHWK.WKTool/CreateAMicroLessonWindow.xaml View File

10
     Height="450"
10
     Height="450"
11
     Margin="0"
11
     Margin="0"
12
     AllowsTransparency="True"
12
     AllowsTransparency="True"
13
+    Closed="Window_Closed"
13
     Loaded="Window_Loaded"
14
     Loaded="Window_Loaded"
14
     WindowStartupLocation="CenterScreen"
15
     WindowStartupLocation="CenterScreen"
15
     WindowStyle="None"
16
     WindowStyle="None"
182
                                     </Grid>
183
                                     </Grid>
183
                                     <Label Height="1.5" Background="#3F6FFF" />
184
                                     <Label Height="1.5" Background="#3F6FFF" />
184
                                 </StackPanel>
185
                                 </StackPanel>
185
-
186
                             </Grid>
186
                             </Grid>
187
                             <!--  按钮  -->
187
                             <!--  按钮  -->
188
                             <Grid Grid.Row="3">
188
                             <Grid Grid.Row="3">
209
                                     FontSize="18"
209
                                     FontSize="18"
210
                                     FontWeight="Bold"
210
                                     FontWeight="Bold"
211
                                     Foreground="#FFFFFF"
211
                                     Foreground="#FFFFFF"
212
-                                    IsDefault="True"
213
-                                    >
212
+                                    IsDefault="True">
214
                                     <Button.Template>
213
                                     <Button.Template>
215
                                         <ControlTemplate TargetType="{x:Type Button}">
214
                                         <ControlTemplate TargetType="{x:Type Button}">
216
                                             <Border
215
                                             <Border
272
                     FontSize="16"
271
                     FontSize="16"
273
                     Foreground="#FFFFFF"
272
                     Foreground="#FFFFFF"
274
                     Text="创建微课" />
273
                     Text="创建微课" />
275
-                <!--<Button  Cursor="Hand" Grid.Row="0" x:Name="btnDown" Content="×" VerticalAlignment="Top" Foreground="#FFFFFF" FontSize="30" Padding="10,2,10,0" HorizontalAlignment="Right"  Click="BtnDown_Click"/>-->
274
+                <!--<Button  Cursor="Hand" Grid.Row="0" x:Name="btnDown" Content="×" VerticalAlignment="Top" Foreground="#FFFFFF" FontSize="30" Padding="10,2,10,0" HorizontalAlignment="Right"  Click="BtnDown_Click" />-->
276
             </Grid>
275
             </Grid>
277
             <Grid
276
             <Grid
278
                 x:Name="GridTitle_Black"
277
                 x:Name="GridTitle_Black"
296
                     Content="×"
295
                     Content="×"
297
                     Cursor="Hand"
296
                     Cursor="Hand"
298
                     FontSize="30"
297
                     FontSize="30"
299
-                    Foreground="#FF333333"
300
-                     />
298
+                    Foreground="#FF333333" />
301
             </Grid>
299
             </Grid>
302
             <!--  第二行 讲解名称  -->
300
             <!--  第二行 讲解名称  -->
303
             <!--  第三行 存放路径  -->
301
             <!--  第三行 存放路径  -->
304
         </Grid>
302
         </Grid>
305
     </Grid>
303
     </Grid>
306
-</Window>
304
+</Window>

+ 5
- 0
XHWK.WKTool/CreateAMicroLessonWindow.xaml.cs View File

382
         {
382
         {
383
             getNewApp();
383
             getNewApp();
384
         }
384
         }
385
+
386
+        private void Window_Closed(object sender, EventArgs e)
387
+        {
388
+            Environment.Exit(0);
389
+        }
385
     }
390
     }
386
 }
391
 }

+ 1
- 0
XHWK.WKTool/MainWindow.xaml View File

10
     AllowsTransparency="False"
10
     AllowsTransparency="False"
11
     BorderBrush="#eee"
11
     BorderBrush="#eee"
12
     BorderThickness="0"
12
     BorderThickness="0"
13
+    Closed="Window_Closed"
13
     Loaded="Window_Loaded"
14
     Loaded="Window_Loaded"
14
     MouseLeftButtonDown="Window_MouseLeftButtonDown_1"
15
     MouseLeftButtonDown="Window_MouseLeftButtonDown_1"
15
     ResizeMode="CanMinimize"
16
     ResizeMode="CanMinimize"

+ 5
- 0
XHWK.WKTool/MainWindow.xaml.cs View File

4461
         }
4461
         }
4462
 
4462
 
4463
         #endregion 笔事件回调
4463
         #endregion 笔事件回调
4464
+
4465
+        private void Window_Closed(object sender, EventArgs e)
4466
+        {
4467
+            Environment.Exit(0);
4468
+        }
4464
     }
4469
     }
4465
 
4470
 
4466
     public class PageData
4471
     public class PageData

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

843
             #region 录屏批注取消画笔
843
             #region 录屏批注取消画笔
844
 
844
 
845
             string imagePath = Path.Combine(temppath, time + ".jpg");
845
             string imagePath = Path.Combine(temppath, time + ".jpg");
846
-            ImageHelper.GetScreenshot(new System.Drawing.Rectangle(0, 0, 0, 0), imagePath, true, out BitmapImage bitmap);
846
+            ImageHelper.GetScreenshot(new Rectangle(0, 0, 0, 0), imagePath);
847
 
847
 
848
             #endregion 录屏批注取消画笔
848
             #endregion 录屏批注取消画笔
849
 
849
 

+ 52
- 3
XHWK.WKTool/system/ImageHelper.cs View File

140
 
140
 
141
         #region 截图统一方法
141
         #region 截图统一方法
142
 
142
 
143
+        /// <summary>
144
+        /// 截图通用方法 创建人:赵耀 创建时间:2020年8月11日
145
+        /// </summary>
146
+        /// <param name="ScreenSize">截图的区域,设置new Rectangle(0, 0, 0, 0)为截全屏</param>
147
+        /// <param name="ImageSavePath">图片存储路径,为空或null则保存到临时文件夹</param>
148
+        /// <param name="IsRetImg">是否返回图片</param>
149
+        /// <param name="bitmapimg">图片</param>
150
+        /// <param name="level">压缩等级,0到100,0 最差质量,100 最佳</param>
151
+        /// <returns></returns>
152
+        public static bool GetScreenshot(Rectangle ScreenSize, string ImageSavePath, long level = -1)
153
+        {
154
+            try
155
+            {
156
+                System.Drawing.Size bounds = PrimaryScreen.DESKTOP;
157
+                if (string.IsNullOrEmpty(ImageSavePath))
158
+                {
159
+                    ImageSavePath = GetTempImagePath();//如果为空则指定临时存储路径
160
+                }
161
+                double scaleWidth = (bounds.Width * 1.0) / SystemParameters.PrimaryScreenWidth;
162
+                double scaleHeight = (bounds.Height * 1.0) / SystemParameters.PrimaryScreenHeight;
163
+                int width = bounds.Width;
164
+                int height = bounds.Height;
165
+                if (ScreenSize.Size != new System.Drawing.Size(0, 0))
166
+                {
167
+                    width = (int)(ScreenSize.Size.Width * scaleWidth);
168
+                    height = (int)(ScreenSize.Size.Height * scaleHeight);
169
+                }
170
+                int l = (int)(ScreenSize.X * scaleWidth);
171
+                int t = (int)(ScreenSize.Y * scaleHeight);
172
+                if (_Bitmap != null)
173
+                {
174
+                    _Bitmap.Dispose();
175
+                }
176
+                _Bitmap = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
177
+                using (Graphics g = Graphics.FromImage(_Bitmap))
178
+                {
179
+                    g.CopyFromScreen(l, t, 0, 0, _Bitmap.Size, CopyPixelOperation.SourceCopy);
180
+                    Compress(_Bitmap, ImageSavePath, level);
181
+                }
182
+
183
+                GC.Collect();
184
+                return true;
185
+            }
186
+            catch (Exception ex)
187
+            {
188
+                LogHelper.WriteErrLog("【截图】(GetBitmapSource)截图失败," + ex.Message, ex);
189
+                return false;
190
+            }
191
+        }
192
+
143
         /// <summary>
193
         /// <summary>
144
         /// 截图通用方法 创建人:赵耀 创建时间:2020年8月11日
194
         /// 截图通用方法 创建人:赵耀 创建时间:2020年8月11日
145
         /// </summary>
195
         /// </summary>
436
                         encoder.Save(stream);
486
                         encoder.Save(stream);
437
                     }
487
                     }
438
                 }
488
                 }
439
-                
440
             }
489
             }
441
             catch (Exception e)
490
             catch (Exception e)
442
             {
491
             {
462
                 RenderTargetBitmap bmp = new RenderTargetBitmap(
511
                 RenderTargetBitmap bmp = new RenderTargetBitmap(
463
                         (int)frameworkElement.ActualWidth,
512
                         (int)frameworkElement.ActualWidth,
464
                         (int)frameworkElement.ActualHeight,
513
                         (int)frameworkElement.ActualHeight,
465
-                        1 / 96, 
514
+                        1 / 96,
466
                         1 / 96,
515
                         1 / 96,
467
                         PixelFormats.Default
516
                         PixelFormats.Default
468
                     );
517
                     );
470
                 BitmapEncoder enc = new PngBitmapEncoder();
519
                 BitmapEncoder enc = new PngBitmapEncoder();
471
                 enc.Frames.Add(BitmapFrame.Create(bmp));
520
                 enc.Frames.Add(BitmapFrame.Create(bmp));
472
                 enc.Save(outStream);
521
                 enc.Save(outStream);
473
-              
522
+
474
                 System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(outStream);
523
                 System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(outStream);
475
                 return new Bitmap(bitmap, width, height);
524
                 return new Bitmap(bitmap, width, height);
476
             }
525
             }

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

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

Loading…
Cancel
Save