Parcourir la source

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

master
张剑 il y a 2 ans
Parent
révision
30e603570f

+ 2
- 2
XHWK.WKTool/App.config Voir le fichier

@@ -9,8 +9,8 @@
9 9
     <!--参数是否加密 0不加密 1加密-->
10 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 14
     <!--皮肤样式 0白 1蓝 2黑色 -->
15 15
     <add key="SkinStyle" value="0" />
16 16
     <!--是否输出视频记录日志:0否-->

+ 0
- 2
XHWK.WKTool/App.xaml.cs Voir le fichier

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

+ 8
- 25
XHWK.WKTool/AppUpdateWin.xaml Voir le fichier

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

+ 17
- 7
XHWK.WKTool/AppUpdateWin.xaml.cs Voir le fichier

@@ -84,15 +84,25 @@ namespace XHWK.WKTool
84 84
             progress_sp.Visibility = Visibility.Collapsed;
85 85
             content_sv.Visibility = Visibility.Visible;
86 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 103
             Dispatcher.Invoke(new Action(() =>
94 104
             {
95
-                System.Environment.Exit(0);
105
+                Environment.Exit(0);
96 106
             }));
97 107
             Close();
98 108
         }
@@ -102,4 +112,4 @@ namespace XHWK.WKTool
102 112
             MessageWindow.Show(msg);
103 113
         }
104 114
     }
105
-}
115
+}

+ 5
- 7
XHWK.WKTool/CreateAMicroLessonWindow.xaml Voir le fichier

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

+ 5
- 0
XHWK.WKTool/CreateAMicroLessonWindow.xaml.cs Voir le fichier

@@ -382,5 +382,10 @@ namespace XHWK.WKTool
382 382
         {
383 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 Voir le fichier

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

+ 5
- 0
XHWK.WKTool/MainWindow.xaml.cs Voir le fichier

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

+ 1
- 1
XHWK.WKTool/ScreenRecordingToolbarWindow.xaml.cs Voir le fichier

@@ -843,7 +843,7 @@ namespace XHWK.WKTool
843 843
             #region 录屏批注取消画笔
844 844
 
845 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 848
             #endregion 录屏批注取消画笔
849 849
 

+ 52
- 3
XHWK.WKTool/system/ImageHelper.cs Voir le fichier

@@ -140,6 +140,56 @@ namespace Common.system
140 140
 
141 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 193
         /// <summary>
144 194
         /// 截图通用方法 创建人:赵耀 创建时间:2020年8月11日
145 195
         /// </summary>
@@ -436,7 +486,6 @@ namespace Common.system
436 486
                         encoder.Save(stream);
437 487
                     }
438 488
                 }
439
-                
440 489
             }
441 490
             catch (Exception e)
442 491
             {
@@ -462,7 +511,7 @@ namespace Common.system
462 511
                 RenderTargetBitmap bmp = new RenderTargetBitmap(
463 512
                         (int)frameworkElement.ActualWidth,
464 513
                         (int)frameworkElement.ActualHeight,
465
-                        1 / 96, 
514
+                        1 / 96,
466 515
                         1 / 96,
467 516
                         PixelFormats.Default
468 517
                     );
@@ -470,7 +519,7 @@ namespace Common.system
470 519
                 BitmapEncoder enc = new PngBitmapEncoder();
471 520
                 enc.Frames.Add(BitmapFrame.Create(bmp));
472 521
                 enc.Save(outStream);
473
-              
522
+
474 523
                 System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(outStream);
475 524
                 return new Bitmap(bitmap, width, height);
476 525
             }

+ 1
- 1
星火微课/星火微课-正式.iss Voir le fichier

@@ -3,7 +3,7 @@
3 3
 
4 4
 #define MyAppName "星火微课"  
5 5
 #define MyAppDir "xhwk"
6
-#define MyAppVersion "3.2.3"
6
+#define MyAppVersion "3.2.4"
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\"

Chargement…
Annuler
Enregistrer