Browse Source

zhao:优化内存去除无用占用

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

+ 0
- 3
Common/system/DataProvider.cs View File

1
 using System;
1
 using System;
2
-using System.Collections.Generic;
3
 using System.IO;
2
 using System.IO;
4
-using System.Linq;
5
 using System.Security.Cryptography;
3
 using System.Security.Cryptography;
6
 using System.Text;
4
 using System.Text;
7
-using System.Threading.Tasks;
8
 
5
 
9
 namespace Common.system
6
 namespace Common.system
10
 {
7
 {

+ 43
- 25
Common/system/FFMpeg.cs View File

1
 using AForge.Video.DirectShow;
1
 using AForge.Video.DirectShow;
2
+
2
 using System;
3
 using System;
3
 using System.Collections.Generic;
4
 using System.Collections.Generic;
4
 using System.Diagnostics;
5
 using System.Diagnostics;
5
-using System.IO;
6
 using System.Linq;
6
 using System.Linq;
7
 using System.Text;
7
 using System.Text;
8
 using System.Threading;
8
 using System.Threading;
9
-using System.Windows.Forms;
10
 
9
 
11
 using VisioForge.Shared.NAudio.CoreAudioApi;
10
 using VisioForge.Shared.NAudio.CoreAudioApi;
12
 using VisioForge.Shared.NAudio.Wave;
11
 using VisioForge.Shared.NAudio.Wave;
46
         /// 录制屏幕
45
         /// 录制屏幕
47
         /// </summary>
46
         /// </summary>
48
         /// <param name="FilePath">文件存储路径</param>
47
         /// <param name="FilePath">文件存储路径</param>
49
-        public bool StartRecordingVideo(string FilePath,out string ErrMessage)
48
+        public bool StartRecordingVideo(string FilePath, out string ErrMessage)
50
         {
49
         {
51
             while (myProcess != null)
50
             while (myProcess != null)
52
             {
51
             {
184
         /// 录制音频
183
         /// 录制音频
185
         /// </summary>
184
         /// </summary>
186
         /// <param name="Mp3Path">MP3音频位置</param>
185
         /// <param name="Mp3Path">MP3音频位置</param>
187
-        public bool StartRecordingAudio(string Mp3Path,out string ErrMessage)
186
+        public bool StartRecordingAudio(string Mp3Path, out string ErrMessage)
188
         {
187
         {
189
             ErrMessage = null;
188
             ErrMessage = null;
190
             while (myProcess != null)
189
             while (myProcess != null)
263
                 }
262
                 }
264
             }
263
             }
265
             if (OutputVideoLog)
264
             if (OutputVideoLog)
265
+            {
266
                 LogHelper.WriteInfoLog("【录音】:" + myProcess.StartInfo.Arguments);
266
                 LogHelper.WriteInfoLog("【录音】:" + myProcess.StartInfo.Arguments);
267
+            }
268
+
267
             FileToolsCommon.AppendText(LogPath, "【录音】:" + myProcess.StartInfo.Arguments + "\r\n");
269
             FileToolsCommon.AppendText(LogPath, "【录音】:" + myProcess.StartInfo.Arguments + "\r\n");
268
             myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
270
             myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
269
             myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
271
             myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
284
                 }
286
                 }
285
                 else
287
                 else
286
                 {
288
                 {
287
-                    ErrMessage = ex.Message+" 请关闭杀毒软件或信任此软件后重试!";
289
+                    ErrMessage = ex.Message + " 请关闭杀毒软件或信任此软件后重试!";
288
                 }
290
                 }
289
-                LogHelper.WriteErrLog("【录音】(StartRecordingAudio)"+ErrMessage,ex);
291
+                LogHelper.WriteErrLog("【录音】(StartRecordingAudio)" + ErrMessage, ex);
290
                 myProcess.Dispose();
292
                 myProcess.Dispose();
291
                 myProcess = null;
293
                 myProcess = null;
292
                 return false;
294
                 return false;
365
         /// <param name="Frequency">每秒帧率</param>
367
         /// <param name="Frequency">每秒帧率</param>
366
         /// <param name="VideoWidth">视频宽度</param>
368
         /// <param name="VideoWidth">视频宽度</param>
367
         /// <param name="VideoHeight">视频高度</param>
369
         /// <param name="VideoHeight">视频高度</param>
368
-        public bool SynthesisVideo(string ImageListPath, string Mp3Path, string VideoSavePath, int Frequency, int VideoWidth, int VideoHeight,out string ErrMessage)
370
+        public bool SynthesisVideo(string ImageListPath, string Mp3Path, string VideoSavePath, int Frequency, int VideoWidth, int VideoHeight, out string ErrMessage)
369
         {
371
         {
370
             //new Thread(new ThreadStart(new Action(() =>
372
             //new Thread(new ThreadStart(new Action(() =>
371
             //{
373
             //{
427
                         break;
429
                         break;
428
                 }
430
                 }
429
                 if (OutputVideoLog)
431
                 if (OutputVideoLog)
432
+                {
430
                     LogHelper.WriteInfoLog("【图片音频合成视频】:" + myProcess.StartInfo.Arguments);
433
                     LogHelper.WriteInfoLog("【图片音频合成视频】:" + myProcess.StartInfo.Arguments);
434
+                }
435
+
431
                 FileToolsCommon.AppendText(LogPath, "【图片音频合成视频】:" + myProcess.StartInfo.Arguments + "\r\n");
436
                 FileToolsCommon.AppendText(LogPath, "【图片音频合成视频】:" + myProcess.StartInfo.Arguments + "\r\n");
432
                 myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
437
                 myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
433
                 myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
438
                 myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
549
                 myProcess.StartInfo.Arguments = "-f concat  -safe 0 -i " + Path + "temprs/filelist.d -c copy " + FilePath;
554
                 myProcess.StartInfo.Arguments = "-f concat  -safe 0 -i " + Path + "temprs/filelist.d -c copy " + FilePath;
550
             }
555
             }
551
             if (OutputVideoLog)
556
             if (OutputVideoLog)
557
+            {
552
                 LogHelper.WriteInfoLog("【音视频合成】:" + myProcess.StartInfo.Arguments);
558
                 LogHelper.WriteInfoLog("【音视频合成】:" + myProcess.StartInfo.Arguments);
559
+            }
560
+
553
             FileToolsCommon.AppendText(LogPath, "【音视频合成】:" + myProcess.StartInfo.Arguments + "\r\n");
561
             FileToolsCommon.AppendText(LogPath, "【音视频合成】:" + myProcess.StartInfo.Arguments + "\r\n");
554
             myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
562
             myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
555
             myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
563
             myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
652
         /// <param name="ImagePath">图片地址</param>
660
         /// <param name="ImagePath">图片地址</param>
653
         /// <param name="Width">图片大小</param>
661
         /// <param name="Width">图片大小</param>
654
         /// <param name="Height">图片大小</param>
662
         /// <param name="Height">图片大小</param>
655
-        public bool GenerateThumbnails(string VideoPath, string ImagePath,int Width=0,int Height=0)
663
+        public bool GenerateThumbnails(string VideoPath, string ImagePath, int Width = 0, int Height = 0)
656
         {
664
         {
657
             while (myProcess != null)
665
             while (myProcess != null)
658
             {
666
             {
664
                 KillProcess.Kill();
672
                 KillProcess.Kill();
665
             }
673
             }
666
             string WHStr = "";
674
             string WHStr = "";
667
-            if(Width>0)
675
+            if (Width > 0)
668
             {
676
             {
669
-                WHStr = " -s "+ Width + "x"+ Height;
677
+                WHStr = " -s " + Width + "x" + Height;
670
             }
678
             }
671
             try
679
             try
672
             {
680
             {
674
                 LogPath = CreateffmpegLog();
682
                 LogPath = CreateffmpegLog();
675
                 myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
683
                 myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
676
                                                                                                                  //myProcess.StartInfo.Arguments = "-i \"" + VideoPath + "\" -ss 1 -vframes 1 -r 1 -ac 1 -ab 2 -s " + thubWidth + "*" + thubHeight + " -f image2 \"" + ImagePath + "\"";
684
                                                                                                                  //myProcess.StartInfo.Arguments = "-i \"" + VideoPath + "\" -ss 1 -vframes 1 -r 1 -ac 1 -ab 2 -s " + thubWidth + "*" + thubHeight + " -f image2 \"" + ImagePath + "\"";
677
-                myProcess.StartInfo.Arguments = "-i \"" + VideoPath + "\" -ss 1 -vframes 1 -r 1 -ac 1 -ab 2"+ WHStr + " -f image2 \"" + ImagePath + "\"";
685
+                myProcess.StartInfo.Arguments = "-i \"" + VideoPath + "\" -ss 1 -vframes 1 -r 1 -ac 1 -ab 2" + WHStr + " -f image2 \"" + ImagePath + "\"";
678
 
686
 
679
                 if (OutputVideoLog)
687
                 if (OutputVideoLog)
688
+                {
680
                     LogHelper.WriteInfoLog("【生成缩略图】:" + myProcess.StartInfo.Arguments);
689
                     LogHelper.WriteInfoLog("【生成缩略图】:" + myProcess.StartInfo.Arguments);
690
+                }
691
+
681
                 FileToolsCommon.AppendText(LogPath, "【生成缩略图】:" + myProcess.StartInfo.Arguments + "\r\n");
692
                 FileToolsCommon.AppendText(LogPath, "【生成缩略图】:" + myProcess.StartInfo.Arguments + "\r\n");
682
                 myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
693
                 myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
683
                 myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
694
                 myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
739
                 myProcess.StartInfo.Arguments = "-i " + VideoPathName + " -acodec copy -vcodec libx264 -s " + Width + "*" + Height + " " + VideoSavePathName;
750
                 myProcess.StartInfo.Arguments = "-i " + VideoPathName + " -acodec copy -vcodec libx264 -s " + Width + "*" + Height + " " + VideoSavePathName;
740
 
751
 
741
                 if (OutputVideoLog)
752
                 if (OutputVideoLog)
753
+                {
742
                     LogHelper.WriteInfoLog("【视频转码】:" + myProcess.StartInfo.Arguments);
754
                     LogHelper.WriteInfoLog("【视频转码】:" + myProcess.StartInfo.Arguments);
743
-                FileToolsCommon.AppendText(LogPath,"【视频转码】:" + myProcess.StartInfo.Arguments + "\r\n");
755
+                }
756
+
757
+                FileToolsCommon.AppendText(LogPath, "【视频转码】:" + myProcess.StartInfo.Arguments + "\r\n");
744
                 myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
758
                 myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
745
                 myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
759
                 myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
746
                 myProcess.StartInfo.CreateNoWindow = true;             //不显示程序窗口
760
                 myProcess.StartInfo.CreateNoWindow = true;             //不显示程序窗口
825
         {
839
         {
826
             if (!string.IsNullOrEmpty(output.Data))
840
             if (!string.IsNullOrEmpty(output.Data))
827
             {
841
             {
828
-                FileToolsCommon.AppendText(LogPath, "【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff") +"】:");
829
-                FileToolsCommon.AppendText(LogPath, output.Data+"\r\n");
842
+                FileToolsCommon.AppendText(LogPath, "【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff") + "】:");
843
+                FileToolsCommon.AppendText(LogPath, output.Data + "\r\n");
830
             }
844
             }
831
         }
845
         }
832
         #region 麦克风声卡检测
846
         #region 麦克风声卡检测
833
         #region 获取麦克风
847
         #region 获取麦克风
834
-        bool IsMicrophone = false;
848
+        private bool IsMicrophone = false;
849
+
835
         /// <summary>
850
         /// <summary>
836
         /// 使用FFmpeg获取的麦克风名
851
         /// 使用FFmpeg获取的麦克风名
837
         /// </summary>
852
         /// </summary>
838
-        string MicrophoneNameInfo = "";
853
+        private string MicrophoneNameInfo = "";
839
         /// <summary>
854
         /// <summary>
840
         /// 获取麦克风名称
855
         /// 获取麦克风名称
841
         /// </summary>
856
         /// </summary>
899
                     myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
914
                     myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
900
                     myProcess.StartInfo.Arguments = " -list_devices true -f dshow -i dummy";
915
                     myProcess.StartInfo.Arguments = " -list_devices true -f dshow -i dummy";
901
                     if (OutputVideoLog)
916
                     if (OutputVideoLog)
917
+                    {
902
                         LogHelper.WriteInfoLog("【获取设备信息】:" + myProcess.StartInfo.Arguments);
918
                         LogHelper.WriteInfoLog("【获取设备信息】:" + myProcess.StartInfo.Arguments);
919
+                    }
920
+
903
                     FileToolsCommon.AppendText(LogPath, "【获取设备信息】:" + myProcess.StartInfo.Arguments + "\r\n");
921
                     FileToolsCommon.AppendText(LogPath, "【获取设备信息】:" + myProcess.StartInfo.Arguments + "\r\n");
904
                     myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
922
                     myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
905
                     myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
923
                     myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
976
             List<string> devicesList = new List<string>();
994
             List<string> devicesList = new List<string>();
977
             try
995
             try
978
             {
996
             {
979
-                var videoDevices = new FilterInfoCollection(FilterCategory.AudioInputDevice);
997
+                FilterInfoCollection videoDevices = new FilterInfoCollection(FilterCategory.AudioInputDevice);
980
                 foreach (FilterInfo device in videoDevices)
998
                 foreach (FilterInfo device in videoDevices)
981
                 {
999
                 {
982
                     devicesList.Add(device.Name);
1000
                     devicesList.Add(device.Name);
1005
             List<string> devicesList = new List<string>();
1023
             List<string> devicesList = new List<string>();
1006
             try
1024
             try
1007
             {
1025
             {
1008
-                var videoDevices = new FilterInfoCollection(FilterCategory.AudioInputDevice);
1026
+                FilterInfoCollection videoDevices = new FilterInfoCollection(FilterCategory.AudioInputDevice);
1009
                 foreach (FilterInfo device in videoDevices)
1027
                 foreach (FilterInfo device in videoDevices)
1010
                 {
1028
                 {
1011
                     devicesList.Add(device.Name);
1029
                     devicesList.Add(device.Name);
1023
         /// <returns></returns>
1041
         /// <returns></returns>
1024
         public static string GetInDeviceName()
1042
         public static string GetInDeviceName()
1025
         {
1043
         {
1026
-            var devices = new List<WaveInCapabilities>();
1044
+            List<WaveInCapabilities> devices = new List<WaveInCapabilities>();
1027
             int waveInDevices = WaveIn.DeviceCount;
1045
             int waveInDevices = WaveIn.DeviceCount;
1028
             for (int i = 0; i < waveInDevices; i++)
1046
             for (int i = 0; i < waveInDevices; i++)
1029
             {
1047
             {
1050
         public static string GetInDeviceFull()
1068
         public static string GetInDeviceFull()
1051
         {
1069
         {
1052
             List<string> devices = new List<string>();
1070
             List<string> devices = new List<string>();
1053
-            var enumberator = new MMDeviceEnumerator();
1054
-            var deviceCollection = enumberator.EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.All);
1071
+            MMDeviceEnumerator enumberator = new MMDeviceEnumerator();
1072
+            MMDeviceCollection deviceCollection = enumberator.EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.All);
1055
             for (int waveInDevice = 0; waveInDevice < WaveIn.DeviceCount; waveInDevice++)
1073
             for (int waveInDevice = 0; waveInDevice < WaveIn.DeviceCount; waveInDevice++)
1056
             {
1074
             {
1057
                 WaveInCapabilities deviceInfo = WaveIn.GetCapabilities(waveInDevice);
1075
                 WaveInCapabilities deviceInfo = WaveIn.GetCapabilities(waveInDevice);
1065
                             break;
1083
                             break;
1066
                         }
1084
                         }
1067
                     }
1085
                     }
1068
-                    catch (Exception ex)
1086
+                    catch (Exception)
1069
                     {
1087
                     {
1070
                         continue;
1088
                         continue;
1071
                     }
1089
                     }
1089
         public List<string> GetInDeviceListFull()
1107
         public List<string> GetInDeviceListFull()
1090
         {
1108
         {
1091
             List<string> devices = new List<string>();
1109
             List<string> devices = new List<string>();
1092
-            var enumberator = new MMDeviceEnumerator();
1093
-            var deviceCollection = enumberator.EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.All);
1110
+            MMDeviceEnumerator enumberator = new MMDeviceEnumerator();
1111
+            MMDeviceCollection deviceCollection = enumberator.EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.All);
1094
             for (int waveInDevice = 0; waveInDevice < WaveIn.DeviceCount; waveInDevice++)
1112
             for (int waveInDevice = 0; waveInDevice < WaveIn.DeviceCount; waveInDevice++)
1095
             {
1113
             {
1096
                 WaveInCapabilities deviceInfo = WaveIn.GetCapabilities(waveInDevice);
1114
                 WaveInCapabilities deviceInfo = WaveIn.GetCapabilities(waveInDevice);
1104
                             break;
1122
                             break;
1105
                         }
1123
                         }
1106
                     }
1124
                     }
1107
-                    catch (Exception ex)
1125
+                    catch (Exception)
1108
                     {
1126
                     {
1109
                         continue;
1127
                         continue;
1110
                     }
1128
                     }

+ 6
- 8
Common/system/ImageHelper.cs View File

1
 using System;
1
 using System;
2
 using System.Drawing;
2
 using System.Drawing;
3
-using System.Drawing.Drawing2D;
4
 using System.Drawing.Imaging;
3
 using System.Drawing.Imaging;
5
 using System.IO;
4
 using System.IO;
6
 using System.Text;
5
 using System.Text;
7
 using System.Threading;
6
 using System.Threading;
8
 using System.Windows;
7
 using System.Windows;
9
-using System.Windows.Documents;
10
 using System.Windows.Media;
8
 using System.Windows.Media;
11
 using System.Windows.Media.Imaging;
9
 using System.Windows.Media.Imaging;
12
 
10
 
13
-using VisioForge.Shared.Helpers;
14
-
15
 namespace Common.system
11
 namespace Common.system
16
 {
12
 {
17
     /// <summary>
13
     /// <summary>
94
             {
90
             {
95
                 using (MemoryStream ms = new MemoryStream(File.ReadAllBytes(path)))
91
                 using (MemoryStream ms = new MemoryStream(File.ReadAllBytes(path)))
96
                 {
92
                 {
97
-                    bitmap = new BitmapImage();
98
-                    bitmap.DecodePixelHeight = 100;
93
+                    bitmap = new BitmapImage
94
+                    {
95
+                        DecodePixelHeight = 100
96
+                    };
99
                     bitmap.BeginInit();
97
                     bitmap.BeginInit();
100
                     bitmap.CacheOption = BitmapCacheOption.OnLoad;//设置缓存模式
98
                     bitmap.CacheOption = BitmapCacheOption.OnLoad;//设置缓存模式
101
                     bitmap.StreamSource = ms;//通过StreamSource加载图片
99
                     bitmap.StreamSource = ms;//通过StreamSource加载图片
421
                         encoder.Save(memoryStream);
419
                         encoder.Save(memoryStream);
422
                         //System.Drawing.Image img = System.Drawing.Image.FromStream(memoryStream);
420
                         //System.Drawing.Image img = System.Drawing.Image.FromStream(memoryStream);
423
                         Bitmap bit = new Bitmap(memoryStream);
421
                         Bitmap bit = new Bitmap(memoryStream);
424
-                        if ((int)ImgWidth-2 < (int)bit.Width)
422
+                        if (ImgWidth - 2 < bit.Width)
425
                         {
423
                         {
426
                             try
424
                             try
427
                             {
425
                             {
428
                                 Graphics g = Graphics.FromImage(Img);
426
                                 Graphics g = Graphics.FromImage(Img);
429
                                 //g.InterpolationMode = InterpolationMode.HighQualityBicubic;
427
                                 //g.InterpolationMode = InterpolationMode.HighQualityBicubic;
430
-                                g.DrawImage(bit, new Rectangle(0, 0, ImgWidth, ImgHeight), new Rectangle(0, 0, (int)bit.Width, (int)bit.Height), GraphicsUnit.Pixel);
428
+                                g.DrawImage(bit, new Rectangle(0, 0, ImgWidth, ImgHeight), new Rectangle(0, 0, bit.Width, bit.Height), GraphicsUnit.Pixel);
431
                                 g.Dispose();
429
                                 g.Dispose();
432
                             }
430
                             }
433
                             catch
431
                             catch

+ 1
- 7
XHWK.Model/Model_Signatures.cs View File

1
-using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4
-using System.Text;
5
-using System.Threading.Tasks;
6
-
7
-namespace XHWK.Model
1
+namespace XHWK.Model
8
 {
2
 {
9
     public class Model_Signatures
3
     public class Model_Signatures
10
     {
4
     {

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

25
         /// <summary>
25
         /// <summary>
26
         /// 是否为测试版
26
         /// 是否为测试版
27
         /// </summary>
27
         /// </summary>
28
-        public static bool isDebug =FileToolsCommon.GetConfigValue("IsDebug")!="0";
28
+        public static bool isDebug = FileToolsCommon.GetConfigValue("IsDebug") != "0";
29
         /// <summary>
29
         /// <summary>
30
         /// 接口地址
30
         /// 接口地址
31
         /// </summary>
31
         /// </summary>

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

26
         public CreateAMicroLessonWindow()
26
         public CreateAMicroLessonWindow()
27
         {
27
         {
28
             InitializeComponent();
28
             InitializeComponent();
29
-            this.ResizeMode = ResizeMode.NoResize;
29
+            ResizeMode = ResizeMode.NoResize;
30
             if (!APP.CheckScreenCapturerRecorder())
30
             if (!APP.CheckScreenCapturerRecorder())
31
             {
31
             {
32
                 MessageWindow.Show("首次运行需安装环境,请在确定后依次点击“OK-Next>-Next>Install”完成安装!");
32
                 MessageWindow.Show("首次运行需安装环境,请在确定后依次点击“OK-Next>-Next>Install”完成安装!");

+ 1
- 0
XHWK.WKTool/DAL/Interface.cs View File

6
 using System.Collections.Generic;
6
 using System.Collections.Generic;
7
 using System.IO;
7
 using System.IO;
8
 using System.Text;
8
 using System.Text;
9
+
9
 using XHWK.Model;
10
 using XHWK.Model;
10
 
11
 
11
 namespace XHWK.WKTool.DAL
12
 namespace XHWK.WKTool.DAL

+ 0
- 4
XHWK.WKTool/Helpers/BackgroundWorkerHelper.cs View File

1
 using System;
1
 using System;
2
-using System.Collections.Generic;
3
 using System.ComponentModel;
2
 using System.ComponentModel;
4
-using System.Linq;
5
-using System.Text;
6
 using System.Threading;
3
 using System.Threading;
7
-using System.Threading.Tasks;
8
 
4
 
9
 namespace XHWK.WKTool.Helpers
5
 namespace XHWK.WKTool.Helpers
10
 {
6
 {

+ 2
- 2
XHWK.WKTool/JieTuWindow.xaml.cs View File

112
         /// </summary>
112
         /// </summary>
113
         public void InitializeKeyDownEvent()
113
         public void InitializeKeyDownEvent()
114
         {
114
         {
115
-          
115
+
116
             k_hook.Start();//安装键盘钩子
116
             k_hook.Start();//安装键盘钩子
117
         }
117
         }
118
         /// <summary>
118
         /// <summary>
128
                 Current.OnCancel();
128
                 Current.OnCancel();
129
                 APP.W_XHMicroLessonSystemWindow.InitializeKeyDownEvent();
129
                 APP.W_XHMicroLessonSystemWindow.InitializeKeyDownEvent();
130
                 APP.W_XHMicroLessonSystemWindow.WindowType();
130
                 APP.W_XHMicroLessonSystemWindow.WindowType();
131
-                this.Hide();
131
+                Hide();
132
             }
132
             }
133
         }
133
         }
134
 
134
 

+ 3
- 3
XHWK.WKTool/KeyVerification.xaml.cs View File

4
 using System.Text;
4
 using System.Text;
5
 using System.Threading;
5
 using System.Threading;
6
 using System.Windows;
6
 using System.Windows;
7
-using System.Windows.Forms;
7
+
8
 using XHWK.WKTool.DAL;
8
 using XHWK.WKTool.DAL;
9
 
9
 
10
 namespace XHWK.WKTool
10
 namespace XHWK.WKTool
23
         public KeyVerification()
23
         public KeyVerification()
24
         {
24
         {
25
             InitializeComponent();
25
             InitializeComponent();
26
-            this.Topmost = true;
26
+            Topmost = true;
27
             WindowStartupLocation = WindowStartupLocation.CenterScreen;
27
             WindowStartupLocation = WindowStartupLocation.CenterScreen;
28
         }
28
         }
29
 
29
 
69
                     //win.Topmost = true;
69
                     //win.Topmost = true;
70
                     win.Show();
70
                     win.Show();
71
 
71
 
72
-                    
72
+
73
                     Thread.Sleep(200);
73
                     Thread.Sleep(200);
74
                     Close();
74
                     Close();
75
                 }));
75
                 }));

+ 0
- 1
XHWK.WKTool/MessageWindow.xaml.cs View File

1
 using System.Windows;
1
 using System.Windows;
2
 using System.Windows.Input;
2
 using System.Windows.Input;
3
-using System.Windows.Media;
4
 
3
 
5
 namespace XHWK.WKTool
4
 namespace XHWK.WKTool
6
 {
5
 {

+ 2
- 4
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;
4
 using System.Threading;
3
 using System.Threading;
5
 using System.Windows;
4
 using System.Windows;
6
 using System.Windows.Controls;
5
 using System.Windows.Controls;
7
 using System.Windows.Ink;
6
 using System.Windows.Ink;
8
 using System.Windows.Input;
7
 using System.Windows.Input;
9
 using System.Windows.Media;
8
 using System.Windows.Media;
10
-using System.Windows.Media.Imaging;
11
 
9
 
12
 using XHWK.Model;
10
 using XHWK.Model;
13
 
11
 
43
         {
41
         {
44
             InitializeComponent();
42
             InitializeComponent();
45
         }
43
         }
46
-        public void Initialize(string _imgPath=null)
44
+        public void Initialize(string _imgPath = null)
47
         {
45
         {
48
             flg = 0;
46
             flg = 0;
49
             blackboard_canvas.Strokes.Clear();
47
             blackboard_canvas.Strokes.Clear();
408
                 Thread.Sleep(500);
406
                 Thread.Sleep(500);
409
                 Dispatcher.Invoke(() =>
407
                 Dispatcher.Invoke(() =>
410
                 {
408
                 {
411
-                    this.Owner = null;
409
+                    Owner = null;
412
                     APP.W_PracticeWindow.Hide();
410
                     APP.W_PracticeWindow.Hide();
413
                 });
411
                 });
414
             }))).Start();
412
             }))).Start();

+ 64
- 62
XHWK.WKTool/PrintWindow.xaml.cs View File

29
         {
29
         {
30
             InitializeComponent();
30
             InitializeComponent();
31
             double proportion = 1036.0 / 1290.0;
31
             double proportion = 1036.0 / 1290.0;
32
-          double  Widths = (PrimaryScreen.ScaleWorkingAreaSize.Height) / proportion - (BorderThickness.Left + BorderThickness.Right);
33
-          double  Heights = PrimaryScreen.ScaleWorkingAreaSize.Height - (BorderThickness.Top + BorderThickness.Bottom);
32
+            double Widths = (PrimaryScreen.ScaleWorkingAreaSize.Height) / proportion - (BorderThickness.Left + BorderThickness.Right);
33
+            double Heights = PrimaryScreen.ScaleWorkingAreaSize.Height - (BorderThickness.Top + BorderThickness.Bottom);
34
             Width = Widths / 1.42;
34
             Width = Widths / 1.42;
35
             Height = Heights / 1.71;
35
             Height = Heights / 1.71;
36
-            GridContent.Width = Width+5;
36
+            GridContent.Width = Width + 5;
37
             GridContent.Height = Height;
37
             GridContent.Height = Height;
38
-            this.ResizeMode = ResizeMode.NoResize;
38
+            ResizeMode = ResizeMode.NoResize;
39
             string defa = string.Empty;
39
             string defa = string.Empty;
40
             List<string> defaList = LatticeFileHelper.GetPrinterList(out defa);
40
             List<string> defaList = LatticeFileHelper.GetPrinterList(out defa);
41
             if (defaList.Count > 0)
41
             if (defaList.Count > 0)
56
                 cmbClass.SelectedIndex = 0;
56
                 cmbClass.SelectedIndex = 0;
57
             }
57
             }
58
         }
58
         }
59
-        double wit = 0;
60
-        double hei = 0;
61
-        public void Initialize(string _imgPath, double _wit,double _hei)
59
+
60
+        private double wit = 0;
61
+        private double hei = 0;
62
+        public void Initialize(string _imgPath, double _wit, double _hei)
62
         {
63
         {
63
             wit = _wit;
64
             wit = _wit;
64
             hei = _hei;
65
             hei = _hei;
97
             //FileToolsCommon.CreateFile(imgPath);
98
             //FileToolsCommon.CreateFile(imgPath);
98
             //string pdf = imgPath + "\\101.pdf";
99
             //string pdf = imgPath + "\\101.pdf";
99
             //PDF位置
100
             //PDF位置
100
-            string SourcePath=FileToolsCommon.GetFileAbsolutePath("/temp/101.pdf");
101
+            string SourcePath = FileToolsCommon.GetFileAbsolutePath("/temp/101.pdf");
101
             StrList.Add(SourcePath);
102
             StrList.Add(SourcePath);
102
             //打印数量
103
             //打印数量
103
             int PrinterNum = Convert.ToInt32(txbNumberOfCopies.Text);
104
             int PrinterNum = Convert.ToInt32(txbNumberOfCopies.Text);
113
             times.Elapsed += Times_ElapsedClick;
114
             times.Elapsed += Times_ElapsedClick;
114
             times.Start();
115
             times.Start();
115
         }
116
         }
116
-        int num = 0;
117
+
118
+        private int num = 0;
117
         /// <summary>
119
         /// <summary>
118
         /// 计时器
120
         /// 计时器
119
         /// </summary>
121
         /// </summary>
124
             Dispatcher.Invoke(() =>
126
             Dispatcher.Invoke(() =>
125
             {
127
             {
126
                 pgbProcess.Value = num;
128
                 pgbProcess.Value = num;
127
-                lbProcess.Content = num.ToString()+"%";
129
+                lbProcess.Content = num.ToString() + "%";
128
                 if (num < 99)
130
                 if (num < 99)
129
                 {
131
                 {
130
                     num++;
132
                     num++;
131
-                    times.Interval += (num/2);
133
+                    times.Interval += (num / 2);
132
                 }
134
                 }
133
                 else
135
                 else
134
                 {
136
                 {
140
         /// <summary>
142
         /// <summary>
141
         /// 开始打印
143
         /// 开始打印
142
         /// </summary>
144
         /// </summary>
143
-        void StartPrint(object obj)
145
+        private void StartPrint(object obj)
144
         {
146
         {
145
-          
146
-                try
147
+
148
+            try
147
             {
149
             {
148
                 iTextSharp.text.Document document = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 0, 0, 0, 0);
150
                 iTextSharp.text.Document document = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 0, 0, 0, 0);
149
                 //iTextSharp.text.Rectangle page = new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.A4., 250f);//cs
151
                 //iTextSharp.text.Rectangle page = new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.A4., 250f);//cs
154
                 string tempImgPath = imgPath;
156
                 string tempImgPath = imgPath;
155
                 FileToolsCommon.CreateDirectory(imgPath);
157
                 FileToolsCommon.CreateDirectory(imgPath);
156
                 imgPath += "101.pdf";
158
                 imgPath += "101.pdf";
157
-                while(File.Exists(imgPath))
159
+                while (File.Exists(imgPath))
158
                 {
160
                 {
159
                     imgPath = tempImgPath + ipdf.ToString() + ".pdf";
161
                     imgPath = tempImgPath + ipdf.ToString() + ".pdf";
160
                     ipdf++;
162
                     ipdf++;
180
                     }
182
                     }
181
                     else
183
                     else
182
                     {
184
                     {
183
-                        RectangleF rectangleF = new RectangleF(0,0,0,0) ;
185
+                        RectangleF rectangleF = new RectangleF(0, 0, 0, 0);
184
                         Dispatcher.Invoke(() =>
186
                         Dispatcher.Invoke(() =>
185
                         {
187
                         {
186
-                             rectangleF = new RectangleF
188
+                            rectangleF = new RectangleF
187
                             {
189
                             {
188
                                 Width = (float)APP.PageDrawList[i].ImageSizes.CenterX,
190
                                 Width = (float)APP.PageDrawList[i].ImageSizes.CenterX,
189
                                 Height = (float)APP.PageDrawList[i].ImageSizes.CenterY,
191
                                 Height = (float)APP.PageDrawList[i].ImageSizes.CenterY,
191
                                 Y = (float)APP.PageDrawList[i].ImageLocation.Y
193
                                 Y = (float)APP.PageDrawList[i].ImageLocation.Y
192
                             };
194
                             };
193
                         });
195
                         });
194
-                   
196
+
195
 
197
 
196
 
198
 
197
                         string msgs = string.Empty;
199
                         string msgs = string.Empty;
198
 
200
 
199
-               
200
-                            bool isImg = MergerImg(APP.PageDrawList[i].PageImagePath, filePathOutPut, rectangleF, out msgs);
201
-                            if (isImg)
202
-                            {
203
-                                image = iTextSharp.text.Image.GetInstance(filePathOutPut);
204
-                            }
205
-                            else
206
-                            {
207
-                                image = iTextSharp.text.Image.GetInstance(APP.PageDrawList[i].PageImagePath);
208
-                            }
209
-                   
210
-                     
201
+
202
+                        bool isImg = MergerImg(APP.PageDrawList[i].PageImagePath, filePathOutPut, rectangleF, out msgs);
203
+                        if (isImg)
204
+                        {
205
+                            image = iTextSharp.text.Image.GetInstance(filePathOutPut);
206
+                        }
207
+                        else
208
+                        {
209
+                            image = iTextSharp.text.Image.GetInstance(APP.PageDrawList[i].PageImagePath);
210
+                        }
211
+
212
+
211
                     }
213
                     }
212
                     if (image.Height > iTextSharp.text.PageSize.A4.Height)
214
                     if (image.Height > iTextSharp.text.PageSize.A4.Height)
213
                     {
215
                     {
242
                     MessageWindow.Show(ex.Message);
244
                     MessageWindow.Show(ex.Message);
243
                     return;
245
                     return;
244
                 });
246
                 });
245
-                LogHelper.WriteErrLog("打印转换PDF失败,原因:" + ex.Message,ex);
247
+                LogHelper.WriteErrLog("打印转换PDF失败,原因:" + ex.Message, ex);
246
             }
248
             }
247
 
249
 
248
 
250
 
249
 
251
 
250
             List<string> objStr = (List<string>)obj;
252
             List<string> objStr = (List<string>)obj;
251
-            string SourcePath= objStr[0];
252
-            int PrinterNum=int.Parse(objStr[1]);
253
-            string PrinterName= objStr[2];
253
+            string SourcePath = objStr[0];
254
+            int PrinterNum = int.Parse(objStr[1]);
255
+            string PrinterName = objStr[2];
254
             //TPF文件位置
256
             //TPF文件位置
255
             string TPFPath = FileToolsCommon.GetFileAbsolutePath("temp/");
257
             string TPFPath = FileToolsCommon.GetFileAbsolutePath("temp/");
256
             FileToolsCommon.CreateDirectory(TPFPath);
258
             FileToolsCommon.CreateDirectory(TPFPath);
257
             TPFPath += "101.TPF";
259
             TPFPath += "101.TPF";
258
             //生成点阵文件
260
             //生成点阵文件
259
             LatticeFileHelper.GeneratingPDF(SourcePath, TPFPath, out int pr, out string msg, out string outPut/*, pyte*/);
261
             LatticeFileHelper.GeneratingPDF(SourcePath, TPFPath, out int pr, out string msg, out string outPut/*, pyte*/);
260
-            while(!FileToolsCommon.IsExistFile(TPFPath))
262
+            while (!FileToolsCommon.IsExistFile(TPFPath))
261
             {
263
             {
262
                 Thread.Sleep(100);
264
                 Thread.Sleep(100);
263
             }
265
             }
264
-            while(string.IsNullOrWhiteSpace(pr.ToString()))
266
+            while (string.IsNullOrWhiteSpace(pr.ToString()))
265
             {
267
             {
266
                 Thread.Sleep(100);
268
                 Thread.Sleep(100);
267
             }
269
             }
397
                 int frequency = 1;
399
                 int frequency = 1;
398
                 //Dispatcher.Invoke(() =>
400
                 //Dispatcher.Invoke(() =>
399
                 //{
401
                 //{
400
-                     frequency = Convert.ToInt32(txbNumberOfCopies.Text);
401
-                    LatticeFileHelper.PrinterTPFFile(tpf, frequency, cmbClass.Text, out int printResult, out standardError, out standardOutput);
402
-                    if (printResult == 0)// 0为成功
402
+                frequency = Convert.ToInt32(txbNumberOfCopies.Text);
403
+                LatticeFileHelper.PrinterTPFFile(tpf, frequency, cmbClass.Text, out int printResult, out standardError, out standardOutput);
404
+                if (printResult == 0)// 0为成功
405
+                {
406
+                    new Thread(new ThreadStart(new Action(() =>
403
                     {
407
                     {
404
-                        new Thread(new ThreadStart(new Action(() =>
408
+                        Dispatcher.Invoke(() =>
405
                         {
409
                         {
406
-                            Dispatcher.Invoke(() =>
407
-                            {
408
-                                I = 100;
409
-                                pgbProcess.Value = I * 100 / 100;
410
-                                lbProcess.Content = I.ToString() + "%";
411
-                                APP.myloading.Hide();
412
-                                I = 0;
413
-                            });
414
-                            Thread.Sleep(3000);
415
-                            Dispatcher.Invoke(() =>
416
-                            {
417
-                                tip_outer.Visibility = Visibility.Collapsed;
410
+                            I = 100;
411
+                            pgbProcess.Value = I * 100 / 100;
412
+                            lbProcess.Content = I.ToString() + "%";
413
+                            APP.myloading.Hide();
414
+                            I = 0;
415
+                        });
416
+                        Thread.Sleep(3000);
417
+                        Dispatcher.Invoke(() =>
418
+                        {
419
+                            tip_outer.Visibility = Visibility.Collapsed;
418
                                 //tip_outer.Visibility = Visibility.Collapsed;
420
                                 //tip_outer.Visibility = Visibility.Collapsed;
419
                                 MessageWindow.Show("打印成功");
421
                                 MessageWindow.Show("打印成功");
420
-                            });
421
-                        }))).Start();
422
+                        });
423
+                    }))).Start();
422
                 }
424
                 }
423
                 else
425
                 else
424
                 {
426
                 {
459
         {
461
         {
460
             Dispatcher.Invoke(() =>
462
             Dispatcher.Invoke(() =>
461
             {
463
             {
462
-            if (I <= 90)
463
-            {
464
-                try
464
+                if (I <= 90)
465
                 {
465
                 {
466
+                    try
467
+                    {
466
                         pgbProcess.Value = I * 100 / 100;
468
                         pgbProcess.Value = I * 100 / 100;
467
                         lbProcess.Content = I.ToString() + "%";
469
                         lbProcess.Content = I.ToString() + "%";
468
                         I++;
470
                         I++;
471
+                    }
472
+                    catch (Exception ex)
473
+                    {
474
+                        LogHelper.WriteErrLog("【摄像】(Times_Elapsed)生成图片错误:" + ex.Message, ex);
475
+                    }
469
                 }
476
                 }
470
-                catch (Exception ex)
471
-                {
472
-                    LogHelper.WriteErrLog("【摄像】(Times_Elapsed)生成图片错误:" + ex.Message, ex);
473
-                }
474
-            }
475
             });
477
             });
476
         }
478
         }
477
         /// <summary>
479
         /// <summary>

+ 7
- 15
XHWK.WKTool/ProductVerification.xaml.cs View File

1
 using Common.system;
1
 using Common.system;
2
+
2
 using System;
3
 using System;
3
-using System.Collections.Generic;
4
 using System.IO;
4
 using System.IO;
5
-using System.Linq;
6
 using System.Text;
5
 using System.Text;
7
-using System.Threading.Tasks;
8
 using System.Windows;
6
 using System.Windows;
9
-using System.Windows.Controls;
10
-using System.Windows.Data;
11
-using System.Windows.Documents;
12
-using System.Windows.Input;
13
-using System.Windows.Media;
14
-using System.Windows.Media.Imaging;
15
-using System.Windows.Shapes;
7
+
16
 using XHWK.Model;
8
 using XHWK.Model;
17
 using XHWK.WKTool.DAL;
9
 using XHWK.WKTool.DAL;
18
 
10
 
34
         {
26
         {
35
             InitializeComponent();
27
             InitializeComponent();
36
             WindowStartupLocation = WindowStartupLocation.CenterScreen;
28
             WindowStartupLocation = WindowStartupLocation.CenterScreen;
37
-            this.Topmost = true;
29
+            Topmost = true;
38
             APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeActivationDecryptServering, InvokeActivationDecryptServerCompate);
30
             APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeActivationDecryptServering, InvokeActivationDecryptServerCompate);
39
         }
31
         }
40
         /// <summary>
32
         /// <summary>
57
             {
49
             {
58
                 APP.Signature = System.IO.File.ReadAllText(APP.dataPath + "signature.txt", Encoding.Default);
50
                 APP.Signature = System.IO.File.ReadAllText(APP.dataPath + "signature.txt", Encoding.Default);
59
                 string decrypt = DataProvider.TripleDESDecrypt(APP.Signature, APP.secretKey);
51
                 string decrypt = DataProvider.TripleDESDecrypt(APP.Signature, APP.secretKey);
60
-                decrypt = decrypt.Replace("\u0001", "").Replace("\u0007","").Trim();
52
+                decrypt = decrypt.Replace("\u0001", "").Replace("\u0007", "").Trim();
61
                 Model_Signatures msgBean = JsonHelper.JsonToObj<Model_Signatures>(decrypt);
53
                 Model_Signatures msgBean = JsonHelper.JsonToObj<Model_Signatures>(decrypt);
62
                 long currentTimeTimestamp = DataProvider.TimestampTotalSeconds(); //当前时间 时间戳
54
                 long currentTimeTimestamp = DataProvider.TimestampTotalSeconds(); //当前时间 时间戳
63
                 if (msgBean.endtime > currentTimeTimestamp)//条件成立  解析成功 code 在有效期内
55
                 if (msgBean.endtime > currentTimeTimestamp)//条件成立  解析成功 code 在有效期内
73
                     }
65
                     }
74
                     Dispatcher.Invoke(new Action(() =>
66
                     Dispatcher.Invoke(new Action(() =>
75
                     {
67
                     {
76
-                        this.Hide();
68
+                        Hide();
77
                         CreateAMicroLessonWindow win = new CreateAMicroLessonWindow();
69
                         CreateAMicroLessonWindow win = new CreateAMicroLessonWindow();
78
                         win.Show();
70
                         win.Show();
79
                         Close();
71
                         Close();
83
                 {
75
                 {
84
                     Dispatcher.Invoke(new Action(() =>
76
                     Dispatcher.Invoke(new Action(() =>
85
                     {
77
                     {
86
-                        this.Hide();
78
+                        Hide();
87
                         KeyVerification wins = new KeyVerification
79
                         KeyVerification wins = new KeyVerification
88
                         {
80
                         {
89
                             Topmost = true
81
                             Topmost = true
98
                 LogHelper.WriteErrLog("ProductVerification(解析失败)" + ex.Message, ex);
90
                 LogHelper.WriteErrLog("ProductVerification(解析失败)" + ex.Message, ex);
99
                 Dispatcher.Invoke(new Action(() =>
91
                 Dispatcher.Invoke(new Action(() =>
100
                 {
92
                 {
101
-                    this.Hide();
93
+                    Hide();
102
                     KeyVerification wins = new KeyVerification
94
                     KeyVerification wins = new KeyVerification
103
                     {
95
                     {
104
                         Topmost = true
96
                         Topmost = true

+ 48
- 47
XHWK.WKTool/ScreenRecordingToolbarWindow.xaml.cs View File

75
         public ScreenRecordingToolbarWindow()
75
         public ScreenRecordingToolbarWindow()
76
         {
76
         {
77
             InitializeComponent();
77
             InitializeComponent();
78
-            this.ResizeMode = ResizeMode.NoResize;
78
+            ResizeMode = ResizeMode.NoResize;
79
         }
79
         }
80
         /// <summary>
80
         /// <summary>
81
         /// 初始化
81
         /// 初始化
82
         /// </summary>
82
         /// </summary>
83
         public void Initialize()
83
         public void Initialize()
84
         {
84
         {
85
-                if (APP.W_PracticeWindow == null)
85
+            if (APP.W_PracticeWindow == null)
86
+            {
87
+                APP.W_PracticeWindow = new PracticeWindow
86
                 {
88
                 {
87
-                    APP.W_PracticeWindow = new PracticeWindow
88
-                    {
89
-                        //APP.W_PracticeWindow.Topmost = true;
90
-                        Width = pwidth,
91
-                        Height = pHeight,
92
-                        Left = 0,
93
-                        Top = 0
94
-                    };
95
-                    //practiceWin.Owner = this;
96
-                }
97
-                APP.W_PracticeWindow.Show();
98
-                new Thread(new ThreadStart(new Action(() =>
89
+                    //APP.W_PracticeWindow.Topmost = true;
90
+                    Width = pwidth,
91
+                    Height = pHeight,
92
+                    Left = 0,
93
+                    Top = 0
94
+                };
95
+                //practiceWin.Owner = this;
96
+            }
97
+            APP.W_PracticeWindow.Show();
98
+            new Thread(new ThreadStart(new Action(() =>
99
+            {
100
+                Thread.Sleep(100);
101
+                Dispatcher.Invoke(() =>
99
                 {
102
                 {
100
-                    Thread.Sleep(100);
101
-                    Dispatcher.Invoke(() =>
102
-                    {
103
-                        this.Owner = APP.W_PracticeWindow;
104
-                        this.Topmost = true;
105
-                    });
106
-                }))).Start();
107
-                APP.W_PracticeWindow.Hide();
108
-            
103
+                    Owner = APP.W_PracticeWindow;
104
+                    Topmost = true;
105
+                });
106
+            }))).Start();
107
+            APP.W_PracticeWindow.Hide();
108
+
109
             //timer = new System.Timers.Timer(200);
109
             //timer = new System.Timers.Timer(200);
110
             //timer.Interval = 300;
110
             //timer.Interval = 300;
111
             //timer.Elapsed += new System.Timers.ElapsedEventHandler(TimerDealy);
111
             //timer.Elapsed += new System.Timers.ElapsedEventHandler(TimerDealy);
112
             //timer.Enabled = true; //启动计时器
112
             //timer.Enabled = true; //启动计时器
113
 
113
 
114
             borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
114
             borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
115
-                borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
115
+            borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
116
             flg = 0;
116
             flg = 0;
117
-         
117
+
118
 
118
 
119
             k_hook = new KeyboardHookCommon();
119
             k_hook = new KeyboardHookCommon();
120
             k_hook.KeyDownEvent += K_hook_KeyDownEvent;
120
             k_hook.KeyDownEvent += K_hook_KeyDownEvent;
272
                 num++;
272
                 num++;
273
             }
273
             }
274
         }
274
         }
275
+
275
         /// <summary>
276
         /// <summary>
276
         /// 是否已经按下按钮
277
         /// 是否已经按下按钮
277
         /// </summary>
278
         /// </summary>
278
-        bool IsPressButton = false;
279
+        private bool IsPressButton = false;
279
         /// <summary>
280
         /// <summary>
280
         /// 开始或暂停录制
281
         /// 开始或暂停录制
281
         /// </summary>
282
         /// </summary>
420
                         {
421
                         {
421
                             Thread.Sleep(800);
422
                             Thread.Sleep(800);
422
                         }
423
                         }
423
-                        if(APP.FFmpeg.myProcess!=null)
424
+                        if (APP.FFmpeg.myProcess != null)
424
                         {
425
                         {
425
                             Thread.Sleep(100);
426
                             Thread.Sleep(100);
426
                         }
427
                         }
427
-                        bool SynRes=APP.FFmpeg.StartRecordingVideo(VideoSavePathName,out string ErrMessage);
428
+                        bool SynRes = APP.FFmpeg.StartRecordingVideo(VideoSavePathName, out string ErrMessage);
428
 
429
 
429
                         Thread.Sleep(1300);
430
                         Thread.Sleep(1300);
430
                         Dispatcher.Invoke(() =>
431
                         Dispatcher.Invoke(() =>
431
                         {
432
                         {
432
-                            if(!SynRes)
433
+                            if (!SynRes)
433
                             {
434
                             {
434
                                 MessageWindow.Show(ErrMessage);
435
                                 MessageWindow.Show(ErrMessage);
435
                                 //隐藏画笔工具栏
436
                                 //隐藏画笔工具栏
534
             {
535
             {
535
                 if (APP.W_PracticeWindow.Visibility == Visibility.Visible)
536
                 if (APP.W_PracticeWindow.Visibility == Visibility.Visible)
536
                 {
537
                 {
537
-                    this.Owner = null;
538
+                    Owner = null;
538
                     APP.W_PracticeWindow.ReturnPractice();
539
                     APP.W_PracticeWindow.ReturnPractice();
539
                 }
540
                 }
540
             }
541
             }
577
                                 Thread.Sleep(100);
578
                                 Thread.Sleep(100);
578
                             }
579
                             }
579
                             FileToolsCommon.DeleteFile(ThumbnailPathName);
580
                             FileToolsCommon.DeleteFile(ThumbnailPathName);
580
-                        //VideoInfo.VideoSize = FileToolsCommon.GetFileSizeByMB(VideoSavePathName).ToString() + " MB";
581
-                        VideoInfo.RSTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
581
+                            //VideoInfo.VideoSize = FileToolsCommon.GetFileSizeByMB(VideoSavePathName).ToString() + " MB";
582
+                            VideoInfo.RSTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
582
                             VideoInfo.VideoPath = VideoSavePathName;
583
                             VideoInfo.VideoPath = VideoSavePathName;
583
                             VideoInfo.ThumbnailPath = ThumbnailPathName;
584
                             VideoInfo.ThumbnailPath = ThumbnailPathName;
584
                             APP.FFmpeg.GenerateThumbnails(VideoSavePathName, ThumbnailPathName, 200, 130);
585
                             APP.FFmpeg.GenerateThumbnails(VideoSavePathName, ThumbnailPathName, 200, 130);
587
                             VideoInfo.Uploaded = 0;
588
                             VideoInfo.Uploaded = 0;
588
                             VideoInfo.Savefolder = APP.UserInfo.Schoolid + "/resource";
589
                             VideoInfo.Savefolder = APP.UserInfo.Schoolid + "/resource";
589
                             APP.VideoList.Add(VideoInfo);
590
                             APP.VideoList.Add(VideoInfo);
590
-                        //保存数据
591
-                        APP.SaveWkData();
591
+                            //保存数据
592
+                            APP.SaveWkData();
592
                         }))).Start();
593
                         }))).Start();
593
                         Click_stopRecordingScreen();
594
                         Click_stopRecordingScreen();
594
                     }
595
                     }
683
                 {
684
                 {
684
                     //new Thread(new ThreadStart(new Action(() =>
685
                     //new Thread(new ThreadStart(new Action(() =>
685
                     //{
686
                     //{
686
-                        Dispatcher.Invoke(() =>
687
-                        {
688
-                            borOne.Background = new SolidColorBrush(Colors.LightSkyBlue);
689
-                            borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
690
-                        });
687
+                    Dispatcher.Invoke(() =>
688
+                    {
689
+                        borOne.Background = new SolidColorBrush(Colors.LightSkyBlue);
690
+                        borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
691
+                    });
691
 
692
 
692
                     //}))).Start();
693
                     //}))).Start();
693
                     if (APP.W_PracticeWindow == null)
694
                     if (APP.W_PracticeWindow == null)
711
                         Thread.Sleep(100);
712
                         Thread.Sleep(100);
712
                         Dispatcher.Invoke(() =>
713
                         Dispatcher.Invoke(() =>
713
                         {
714
                         {
714
-                            this.Owner = APP.W_PracticeWindow;
715
-                            this.Topmost = true;
715
+                            Owner = APP.W_PracticeWindow;
716
+                            Topmost = true;
716
                         });
717
                         });
717
                     }))).Start();
718
                     }))).Start();
718
                 }
719
                 }
1016
                         Thread.Sleep(100);
1017
                         Thread.Sleep(100);
1017
                         Dispatcher.Invoke(() =>
1018
                         Dispatcher.Invoke(() =>
1018
                         {
1019
                         {
1019
-                            this.Owner = APP.W_PracticeWindow;
1020
-                            this.Topmost = true;
1020
+                            Owner = APP.W_PracticeWindow;
1021
+                            Topmost = true;
1021
                         });
1022
                         });
1022
                     }))).Start();
1023
                     }))).Start();
1023
-                 
1024
-                    
1024
+
1025
+
1025
                 }
1026
                 }
1026
             }
1027
             }
1027
             catch (Exception ex)
1028
             catch (Exception ex)
1038
         {
1039
         {
1039
             if (flg > 9)
1040
             if (flg > 9)
1040
             {
1041
             {
1041
-                this.Owner = null;
1042
+                Owner = null;
1042
                 APP.W_PracticeWindow.Hide();
1043
                 APP.W_PracticeWindow.Hide();
1043
             }
1044
             }
1044
             else
1045
             else
1170
                 Thread.Sleep(500);
1171
                 Thread.Sleep(500);
1171
                 Dispatcher.Invoke(() =>
1172
                 Dispatcher.Invoke(() =>
1172
                 {
1173
                 {
1173
-                    this.Owner = null;
1174
+                    Owner = null;
1174
                     APP.W_PracticeWindow.Hide();
1175
                     APP.W_PracticeWindow.Hide();
1175
                 });
1176
                 });
1176
             }))).Start();
1177
             }))).Start();

+ 11
- 17
XHWK.WKTool/UControl/Uc_VideoItem.xaml.cs View File

1
 using Common.system;
1
 using Common.system;
2
+
2
 using System;
3
 using System;
3
-using System.Collections.Generic;
4
 using System.Diagnostics;
4
 using System.Diagnostics;
5
-using System.Linq;
6
-using System.Text;
7
-using System.Threading.Tasks;
8
 using System.Windows;
5
 using System.Windows;
9
 using System.Windows.Controls;
6
 using System.Windows.Controls;
10
-using System.Windows.Data;
11
-using System.Windows.Documents;
12
 using System.Windows.Input;
7
 using System.Windows.Input;
13
 using System.Windows.Media;
8
 using System.Windows.Media;
14
-using System.Windows.Media.Imaging;
15
-using System.Windows.Navigation;
16
-using System.Windows.Shapes;
9
+
17
 using XHWK.Model;
10
 using XHWK.Model;
18
 using XHWK.WKTool.DAL;
11
 using XHWK.WKTool.DAL;
19
 
12
 
28
         /// <summary>
21
         /// <summary>
29
         /// 视频模型
22
         /// 视频模型
30
         /// </summary>
23
         /// </summary>
31
-        Model_Video VideoModel = new Model_Video();
24
+        private Model_Video VideoModel = new Model_Video();
32
         /// <summary>
25
         /// <summary>
33
         /// 刷新视频列表
26
         /// 刷新视频列表
34
         /// </summary>
27
         /// </summary>
45
         /// 登陆事件
38
         /// 登陆事件
46
         /// </summary>
39
         /// </summary>
47
         public event UploadLogin Click_UploadLogin;
40
         public event UploadLogin Click_UploadLogin;
41
+
48
         /// <summary>
42
         /// <summary>
49
         /// 上传页面
43
         /// 上传页面
50
         /// </summary>
44
         /// </summary>
51
-        UploadWindow W_UploadWindow = null;
52
-      
45
+        private UploadWindow W_UploadWindow = null;
46
+
53
         #endregion
47
         #endregion
54
 
48
 
55
         #region 初始化
49
         #region 初始化
88
         /// <param name="e"></param>
82
         /// <param name="e"></param>
89
         private void TextBlock_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
83
         private void TextBlock_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
90
         {
84
         {
91
-            if(e.ClickCount==2)
85
+            if (e.ClickCount == 2)
92
             {
86
             {
93
                 TxtModify.Text = TbName.ToolTip.ToString();
87
                 TxtModify.Text = TbName.ToolTip.ToString();
94
                 TbName.Visibility = Visibility.Hidden;
88
                 TbName.Visibility = Visibility.Hidden;
127
         {
121
         {
128
             ModifyVideoName();
122
             ModifyVideoName();
129
         }
123
         }
124
+
130
         /// <summary>
125
         /// <summary>
131
         /// 修改视频文件名
126
         /// 修改视频文件名
132
         /// </summary>
127
         /// </summary>
133
-        void ModifyVideoName()
128
+        private void ModifyVideoName()
134
         {
129
         {
135
             if (TxtModify.Text != TbName.Text)
130
             if (TxtModify.Text != TbName.Text)
136
             {
131
             {
137
-                string ErrMessage;
138
-                if (ModifyPathName(VideoModel.FileGuid, TxtModify.Text + "." + VideoModel.VideoType, out ErrMessage))
132
+                if (ModifyPathName(VideoModel.FileGuid, TxtModify.Text + "." + VideoModel.VideoType, out string ErrMessage))
139
                 {
133
                 {
140
                     //保存成功
134
                     //保存成功
141
                     TbName.Text = TxtModify.Text.Length > 11 ? TxtModify.Text.Substring(0, 11) + "..." : TxtModify.Text;
135
                     TbName.Text = TxtModify.Text.Length > 11 ? TxtModify.Text.Substring(0, 11) + "..." : TxtModify.Text;
239
                             ImgVideo.Source = null;
233
                             ImgVideo.Source = null;
240
                             GC.Collect();
234
                             GC.Collect();
241
                             FileToolsCommon.DeleteFile(ThumbnailPath);
235
                             FileToolsCommon.DeleteFile(ThumbnailPath);
242
-                            this.Visibility = Visibility.Hidden;
236
+                            Visibility = Visibility.Hidden;
243
                             return;
237
                             return;
244
                         }
238
                         }
245
                         catch (Exception ex)
239
                         catch (Exception ex)

+ 19
- 18
XHWK.WKTool/UploadWindow.xaml.cs View File

9
 
9
 
10
 using XHWK.Model;
10
 using XHWK.Model;
11
 using XHWK.WKTool.DAL;
11
 using XHWK.WKTool.DAL;
12
-using XHWK.WKTool.UControl;
12
+
13
 using static XHWK.WKTool.XHMicroLessonSystemWindow;
13
 using static XHWK.WKTool.XHMicroLessonSystemWindow;
14
 
14
 
15
 namespace XHWK.WKTool
15
 namespace XHWK.WKTool
48
         /// <summary>
48
         /// <summary>
49
         /// 当前视频的下标
49
         /// 当前视频的下标
50
         /// </summary>
50
         /// </summary>
51
-       private int i = 0;
51
+        private int i = 0;
52
         private System.Timers.Timer times;
52
         private System.Timers.Timer times;
53
         public UploadWindow()
53
         public UploadWindow()
54
         {
54
         {
57
         /// <summary>
57
         /// <summary>
58
         /// 初始化
58
         /// 初始化
59
         /// </summary>
59
         /// </summary>
60
-        public void Initialize(string _resourcename, long _resourcesize, string _suffix, string _guid,int _i)
60
+        public void Initialize(string _resourcename, long _resourcesize, string _suffix, string _guid, int _i)
61
         {
61
         {
62
             i = _i;
62
             i = _i;
63
             Resourcename = _resourcename;
63
             Resourcename = _resourcename;
196
         /// <param name="e"></param>
196
         /// <param name="e"></param>
197
         private void BtnStart_Click(object sender, RoutedEventArgs e)
197
         private void BtnStart_Click(object sender, RoutedEventArgs e)
198
         {
198
         {
199
-                if(string.IsNullOrWhiteSpace(book_list.Text))
200
-                {
201
-                    MessageWindow.Show("教材不能为空!");
202
-                }
203
-                btnStart.IsEnabled = false;
199
+            if (string.IsNullOrWhiteSpace(book_list.Text))
200
+            {
201
+                MessageWindow.Show("教材不能为空!");
202
+            }
203
+            btnStart.IsEnabled = false;
204
             book_list.IsEnabled = false;
204
             book_list.IsEnabled = false;
205
             cmbTeachingMaterial.IsEnabled = false;
205
             cmbTeachingMaterial.IsEnabled = false;
206
-                Thread myThread = new Thread(StartUpload);
206
+            Thread myThread = new Thread(StartUpload);
207
 
207
 
208
-                num = 0;
209
-                tip_outer.Visibility = Visibility.Visible;
210
-                myThread.Start();
211
-                times = new System.Timers.Timer(100);
212
-                times.Elapsed += Times_ElapsedClick;
213
-                times.Start();
208
+            num = 0;
209
+            tip_outer.Visibility = Visibility.Visible;
210
+            myThread.Start();
211
+            times = new System.Timers.Timer(100);
212
+            times.Elapsed += Times_ElapsedClick;
213
+            times.Start();
214
         }
214
         }
215
         private void StartUpload()
215
         private void StartUpload()
216
         {
216
         {
242
                     Model_ResourceAdd model_ResourceAdd = new Model_ResourceAdd();
242
                     Model_ResourceAdd model_ResourceAdd = new Model_ResourceAdd();
243
                     Dispatcher.Invoke(() =>
243
                     Dispatcher.Invoke(() =>
244
                     {
244
                     {
245
-                         model_ResourceAdd = new Model_ResourceAdd
245
+                        model_ResourceAdd = new Model_ResourceAdd
246
                         {
246
                         {
247
                             converted = 0,
247
                             converted = 0,
248
                             createid = APP.UserInfo.Userid,
248
                             createid = APP.UserInfo.Userid,
262
                             schoolid = APP.UserInfo.Schoolid
262
                             schoolid = APP.UserInfo.Schoolid
263
                         };
263
                         };
264
                     });
264
                     });
265
-                    
265
+
266
                     if (Suffix.Equals("FLV"))
266
                     if (Suffix.Equals("FLV"))
267
                     {
267
                     {
268
                         Suffix = "flv";
268
                         Suffix = "flv";
338
                 });
338
                 });
339
             }
339
             }
340
         }
340
         }
341
-        int num = 0;
341
+
342
+        private int num = 0;
342
         /// <summary>
343
         /// <summary>
343
         /// 计时器
344
         /// 计时器
344
         /// </summary>
345
         /// </summary>

+ 53
- 42
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs View File

209
             //wfhCamera.Visibility = Visibility.Hidden;
209
             //wfhCamera.Visibility = Visibility.Hidden;
210
             ImgPDFPath = null;
210
             ImgPDFPath = null;
211
             ImgPDFPath = new string[300];
211
             ImgPDFPath = new string[300];
212
-        } 
212
+        }
213
         /// <summary>
213
         /// <summary>
214
         /// 初始化快捷键
214
         /// 初始化快捷键
215
         /// </summary>
215
         /// </summary>
216
-        public void InitializeKeyDownEvent() 
216
+        public void InitializeKeyDownEvent()
217
         {
217
         {
218
             k_hook.Start();//安装键盘钩子
218
             k_hook.Start();//安装键盘钩子
219
         }
219
         }
369
                 #endregion
369
                 #endregion
370
 
370
 
371
                 CameraHelper.UpdateCameraDevices();
371
                 CameraHelper.UpdateCameraDevices();
372
-            if (CameraHelper.CameraDevices.Count > 0)
373
-            {
374
-                CameraHelper.SetCameraDevice(0);
375
-                RbnOpen = new List<string>();
376
-                times = new System.Timers.Timer(200)//初始值为300
372
+                if (CameraHelper.CameraDevices.Count > 0)
377
                 {
373
                 {
378
-                    AutoReset = true//设置是否执行System.Timers.Timer.Elapsed事件
379
-                };//设置执行一次(false)还是一直执行(true)
380
-                times.Elapsed += new System.Timers.ElapsedEventHandler(Times_Elapsed);
381
-                times.Enabled = true; //启动计时器
374
+                    CameraHelper.SetCameraDevice(0);
375
+                    RbnOpen = new List<string>();
376
+                    times = new System.Timers.Timer(200)//初始值为300
377
+                    {
378
+                        AutoReset = true//设置是否执行System.Timers.Timer.Elapsed事件
379
+                    };//设置执行一次(false)还是一直执行(true)
380
+                    times.Elapsed += new System.Timers.ElapsedEventHandler(Times_Elapsed);
381
+                    times.Enabled = true; //启动计时器
382
 
382
 
383
-                IsRbnOpen = true;
383
+                    IsRbnOpen = true;
384
 
384
 
385
-                string imgPath = FileToolsCommon.GetFileAbsolutePath("Temp/imgplayer");
386
-                FileToolsCommon.CreateDirectory(imgPath);
387
-            }
385
+                    string imgPath = FileToolsCommon.GetFileAbsolutePath("Temp/imgplayer");
386
+                    FileToolsCommon.CreateDirectory(imgPath);
387
+                }
388
             }
388
             }
389
         }
389
         }
390
 
390
 
465
         /// <param name="e"></param>
465
         /// <param name="e"></param>
466
         private void RbnTurnOff_Click(object sender, RoutedEventArgs e)
466
         private void RbnTurnOff_Click(object sender, RoutedEventArgs e)
467
         {
467
         {
468
-            if(IsRbnOpen)
468
+            if (IsRbnOpen)
469
             {
469
             {
470
                 #region 防止连击
470
                 #region 防止连击
471
                 if (IsPressButton)
471
                 if (IsPressButton)
487
                 }
487
                 }
488
                 #endregion
488
                 #endregion
489
                 IsRbnOpen = false;
489
                 IsRbnOpen = false;
490
-            imgPlayerRight.Visibility = Visibility.Collapsed;
491
-            imgPlayerLeft.Visibility = Visibility.Collapsed;
492
-            imgPlayerRightUnder.Visibility = Visibility.Collapsed;
493
-            imgPlayerLeftUnder.Visibility = Visibility.Collapsed;
494
-            CameraHelper.CloseDevice();
495
-            I = 9999;
490
+                imgPlayerRight.Visibility = Visibility.Collapsed;
491
+                imgPlayerLeft.Visibility = Visibility.Collapsed;
492
+                imgPlayerRightUnder.Visibility = Visibility.Collapsed;
493
+                imgPlayerLeftUnder.Visibility = Visibility.Collapsed;
494
+                CameraHelper.CloseDevice();
495
+                I = 9999;
496
             }
496
             }
497
         }
497
         }
498
         #endregion
498
         #endregion
953
             {
953
             {
954
                 WindowState = WindowState.Minimized;
954
                 WindowState = WindowState.Minimized;
955
             }
955
             }
956
-       
956
+
957
             if (APP.W_JieTuWindow != null)
957
             if (APP.W_JieTuWindow != null)
958
             {
958
             {
959
                 APP.W_JieTuWindow.initialization();
959
                 APP.W_JieTuWindow.initialization();
1411
 
1411
 
1412
                             LogHelper.WriteErrLog("【打开pdf】(OpenDialog pdf)" + ex.Message, ex);
1412
                             LogHelper.WriteErrLog("【打开pdf】(OpenDialog pdf)" + ex.Message, ex);
1413
                         }
1413
                         }
1414
-                      
1414
+
1415
                     }
1415
                     }
1416
                     else//word
1416
                     else//word
1417
                     {
1417
                     {
2460
         /// <summary>
2460
         /// <summary>
2461
         /// 总页数
2461
         /// 总页数
2462
         /// </summary>
2462
         /// </summary>
2463
-        int TotalPage = 0;
2463
+        private int TotalPage = 0;
2464
+
2464
         /// <summary>
2465
         /// <summary>
2465
         /// 当前页
2466
         /// 当前页
2466
         /// </summary>
2467
         /// </summary>
2467
-        int CurrentPage = 1;
2468
+        private int CurrentPage = 1;
2469
+
2468
         /// <summary>
2470
         /// <summary>
2469
         /// 每页显示的视频数
2471
         /// 每页显示的视频数
2470
         /// </summary>
2472
         /// </summary>
2471
-        int PageShowNum = 0;
2473
+        private int PageShowNum = 0;
2474
+
2472
         /// <summary>
2475
         /// <summary>
2473
         /// 视频信息列表
2476
         /// 视频信息列表
2474
         /// </summary>
2477
         /// </summary>
2475
-        List<Uc_VideoItem> VideoControlList = new List<Uc_VideoItem>();
2478
+        private List<Uc_VideoItem> VideoControlList = new List<Uc_VideoItem>();
2479
+
2476
         /// <summary>
2480
         /// <summary>
2477
         /// 横向间隔
2481
         /// 横向间隔
2478
         /// </summary>
2482
         /// </summary>
2479
-        double IntervalX = 0;
2483
+        private double IntervalX = 0;
2484
+
2480
         /// <summary>
2485
         /// <summary>
2481
         /// 纵向间隔
2486
         /// 纵向间隔
2482
         /// </summary>
2487
         /// </summary>
2483
-        double IntervalY = 0;
2488
+        private double IntervalY = 0;
2484
         #endregion
2489
         #endregion
2485
         /// <summary>
2490
         /// <summary>
2486
         /// 初始化加载上传页面数据
2491
         /// 初始化加载上传页面数据
2487
         /// </summary>
2492
         /// </summary>
2488
-        void LoadUploadInitData()
2493
+        private void LoadUploadInitData()
2489
         {
2494
         {
2490
             APP.myloading.Show();
2495
             APP.myloading.Show();
2491
             //加载视频列表
2496
             //加载视频列表
2570
                     {
2575
                     {
2571
                         continue;
2576
                         continue;
2572
                     }
2577
                     }
2573
-                    videoItem = new Uc_VideoItem(model_VideoList[DataIndex]);
2574
-                    videoItem.Tag = model_VideoList[DataIndex].FileGuid;
2578
+                    videoItem = new Uc_VideoItem(model_VideoList[DataIndex])
2579
+                    {
2580
+                        Tag = model_VideoList[DataIndex].FileGuid
2581
+                    };
2575
                     videoItem.Click_refreshVideoList += LoadUploadInitData;
2582
                     videoItem.Click_refreshVideoList += LoadUploadInitData;
2576
                     videoItem.Click_UploadLogin += Login;
2583
                     videoItem.Click_UploadLogin += Login;
2577
                     videoItem.Width = 250;
2584
                     videoItem.Width = 250;
2686
         /// 录制计时
2693
         /// 录制计时
2687
         /// </summary>
2694
         /// </summary>
2688
         private DateTime SRTime = DateTime.Now;
2695
         private DateTime SRTime = DateTime.Now;
2696
+
2689
         /// <summary>
2697
         /// <summary>
2690
         /// 录制大小
2698
         /// 录制大小
2691
         /// </summary>
2699
         /// </summary>
2692
-        int gridActWidth = 1276;
2700
+        private int gridActWidth = 1276;
2701
+
2693
         /// <summary>
2702
         /// <summary>
2694
         /// 录制大小
2703
         /// 录制大小
2695
         /// </summary>
2704
         /// </summary>
2696
-        int gridActHeight = 898;
2705
+        private int gridActHeight = 898;
2697
 
2706
 
2698
         #endregion
2707
         #endregion
2699
 
2708
 
2787
 
2796
 
2788
         }
2797
         }
2789
         #endregion
2798
         #endregion
2790
-        bool IsPressButton = false;
2799
+        private bool IsPressButton = false;
2791
         /// <summary>
2800
         /// <summary>
2792
         /// 录制窗口内容
2801
         /// 录制窗口内容
2793
         /// </summary>
2802
         /// </summary>
3092
                     new Thread(new ThreadStart(new Action(() =>
3101
                     new Thread(new ThreadStart(new Action(() =>
3093
                     {
3102
                     {
3094
                         Thread.Sleep(1000);
3103
                         Thread.Sleep(1000);
3095
-                        IsRecordAudio = APP.FFmpeg.StartRecordingAudio(AudioPathName,out string ErrMessage);
3104
+                        IsRecordAudio = APP.FFmpeg.StartRecordingAudio(AudioPathName, out string ErrMessage);
3096
                         Thread.Sleep(1000);
3105
                         Thread.Sleep(1000);
3097
                         Dispatcher.Invoke(() =>
3106
                         Dispatcher.Invoke(() =>
3098
                         {
3107
                         {
3099
-                            if(!IsRecordAudio)
3108
+                            if (!IsRecordAudio)
3100
                             {
3109
                             {
3101
                                 MessageWindow.Show(ErrMessage);
3110
                                 MessageWindow.Show(ErrMessage);
3102
                             }
3111
                             }
3155
                 }
3164
                 }
3156
             }
3165
             }
3157
         }
3166
         }
3167
+
3158
         /// <summary>
3168
         /// <summary>
3159
         /// 记录上次截图时间
3169
         /// 记录上次截图时间
3160
         /// </summary>
3170
         /// </summary>
3161
-        DateTime Recorddt = DateTime.Now;
3171
+        private DateTime Recorddt = DateTime.Now;
3162
         /// <summary>
3172
         /// <summary>
3163
         /// 录制保存图片计时器
3173
         /// 录制保存图片计时器
3164
         /// </summary>
3174
         /// </summary>
3179
                 }
3189
                 }
3180
             }
3190
             }
3181
         }
3191
         }
3192
+
3182
         /// <summary>
3193
         /// <summary>
3183
         /// 录制保存图片
3194
         /// 录制保存图片
3184
         /// </summary>
3195
         /// </summary>
3185
-        void RecordSaveImage()
3196
+        private void RecordSaveImage()
3186
         {
3197
         {
3187
             try
3198
             try
3188
             {
3199
             {
3365
                                 AudioPathName = null;
3376
                                 AudioPathName = null;
3366
                             }
3377
                             }
3367
                             //合成视频
3378
                             //合成视频
3368
-                            bool SynRes = APP.FFmpeg.SynthesisVideo(ImgPath, AudioPathName, VideoSynthesisPathName, 5, gridActWidth, gridActHeight,out string ErrMessage);
3379
+                            bool SynRes = APP.FFmpeg.SynthesisVideo(ImgPath, AudioPathName, VideoSynthesisPathName, 5, gridActWidth, gridActHeight, out string ErrMessage);
3369
                             //}))).Start();
3380
                             //}))).Start();
3370
                             //new Thread(new ThreadStart(new Action(() =>
3381
                             //new Thread(new ThreadStart(new Action(() =>
3371
                             //{
3382
                             //{
3374
                                 Dispatcher.Invoke(() =>
3385
                                 Dispatcher.Invoke(() =>
3375
                                 {
3386
                                 {
3376
                                     //MessageWindow.Show("视频录制失败,无法保存此视频!");
3387
                                     //MessageWindow.Show("视频录制失败,无法保存此视频!");
3377
-                                    MessageWindow.Show("录制失败,"+ErrMessage);
3388
+                                    MessageWindow.Show("录制失败," + ErrMessage);
3378
                                     BtnRecord.IsEnabled = true;
3389
                                     BtnRecord.IsEnabled = true;
3379
                                     btnStop.IsEnabled = true;
3390
                                     btnStop.IsEnabled = true;
3380
                                     TxbRecordingWord.Text = "录制";
3391
                                     TxbRecordingWord.Text = "录制";

Loading…
Cancel
Save