Explorar el Código

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

tags/录制修改前
耀 hace 4 años
padre
commit
b33a9937a2

+ 0
- 3
Common/system/DataProvider.cs Ver fichero

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

+ 43
- 25
Common/system/FFMpeg.cs Ver fichero

@@ -1,12 +1,11 @@
1 1
 using AForge.Video.DirectShow;
2
+
2 3
 using System;
3 4
 using System.Collections.Generic;
4 5
 using System.Diagnostics;
5
-using System.IO;
6 6
 using System.Linq;
7 7
 using System.Text;
8 8
 using System.Threading;
9
-using System.Windows.Forms;
10 9
 
11 10
 using VisioForge.Shared.NAudio.CoreAudioApi;
12 11
 using VisioForge.Shared.NAudio.Wave;
@@ -46,7 +45,7 @@ namespace Common.system
46 45
         /// 录制屏幕
47 46
         /// </summary>
48 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 50
             while (myProcess != null)
52 51
             {
@@ -184,7 +183,7 @@ namespace Common.system
184 183
         /// 录制音频
185 184
         /// </summary>
186 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 188
             ErrMessage = null;
190 189
             while (myProcess != null)
@@ -263,7 +262,10 @@ namespace Common.system
263 262
                 }
264 263
             }
265 264
             if (OutputVideoLog)
265
+            {
266 266
                 LogHelper.WriteInfoLog("【录音】:" + myProcess.StartInfo.Arguments);
267
+            }
268
+
267 269
             FileToolsCommon.AppendText(LogPath, "【录音】:" + myProcess.StartInfo.Arguments + "\r\n");
268 270
             myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
269 271
             myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
@@ -284,9 +286,9 @@ namespace Common.system
284 286
                 }
285 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 292
                 myProcess.Dispose();
291 293
                 myProcess = null;
292 294
                 return false;
@@ -365,7 +367,7 @@ namespace Common.system
365 367
         /// <param name="Frequency">每秒帧率</param>
366 368
         /// <param name="VideoWidth">视频宽度</param>
367 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 372
             //new Thread(new ThreadStart(new Action(() =>
371 373
             //{
@@ -427,7 +429,10 @@ namespace Common.system
427 429
                         break;
428 430
                 }
429 431
                 if (OutputVideoLog)
432
+                {
430 433
                     LogHelper.WriteInfoLog("【图片音频合成视频】:" + myProcess.StartInfo.Arguments);
434
+                }
435
+
431 436
                 FileToolsCommon.AppendText(LogPath, "【图片音频合成视频】:" + myProcess.StartInfo.Arguments + "\r\n");
432 437
                 myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
433 438
                 myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
@@ -549,7 +554,10 @@ namespace Common.system
549 554
                 myProcess.StartInfo.Arguments = "-f concat  -safe 0 -i " + Path + "temprs/filelist.d -c copy " + FilePath;
550 555
             }
551 556
             if (OutputVideoLog)
557
+            {
552 558
                 LogHelper.WriteInfoLog("【音视频合成】:" + myProcess.StartInfo.Arguments);
559
+            }
560
+
553 561
             FileToolsCommon.AppendText(LogPath, "【音视频合成】:" + myProcess.StartInfo.Arguments + "\r\n");
554 562
             myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
555 563
             myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
@@ -652,7 +660,7 @@ namespace Common.system
652 660
         /// <param name="ImagePath">图片地址</param>
653 661
         /// <param name="Width">图片大小</param>
654 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 665
             while (myProcess != null)
658 666
             {
@@ -664,9 +672,9 @@ namespace Common.system
664 672
                 KillProcess.Kill();
665 673
             }
666 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 679
             try
672 680
             {
@@ -674,10 +682,13 @@ namespace Common.system
674 682
                 LogPath = CreateffmpegLog();
675 683
                 myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
676 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 687
                 if (OutputVideoLog)
688
+                {
680 689
                     LogHelper.WriteInfoLog("【生成缩略图】:" + myProcess.StartInfo.Arguments);
690
+                }
691
+
681 692
                 FileToolsCommon.AppendText(LogPath, "【生成缩略图】:" + myProcess.StartInfo.Arguments + "\r\n");
682 693
                 myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
683 694
                 myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
@@ -739,8 +750,11 @@ namespace Common.system
739 750
                 myProcess.StartInfo.Arguments = "-i " + VideoPathName + " -acodec copy -vcodec libx264 -s " + Width + "*" + Height + " " + VideoSavePathName;
740 751
 
741 752
                 if (OutputVideoLog)
753
+                {
742 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 758
                 myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
745 759
                 myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
746 760
                 myProcess.StartInfo.CreateNoWindow = true;             //不显示程序窗口
@@ -825,17 +839,18 @@ namespace Common.system
825 839
         {
826 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 846
         #region 麦克风声卡检测
833 847
         #region 获取麦克风
834
-        bool IsMicrophone = false;
848
+        private bool IsMicrophone = false;
849
+
835 850
         /// <summary>
836 851
         /// 使用FFmpeg获取的麦克风名
837 852
         /// </summary>
838
-        string MicrophoneNameInfo = "";
853
+        private string MicrophoneNameInfo = "";
839 854
         /// <summary>
840 855
         /// 获取麦克风名称
841 856
         /// </summary>
@@ -899,7 +914,10 @@ namespace Common.system
899 914
                     myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
900 915
                     myProcess.StartInfo.Arguments = " -list_devices true -f dshow -i dummy";
901 916
                     if (OutputVideoLog)
917
+                    {
902 918
                         LogHelper.WriteInfoLog("【获取设备信息】:" + myProcess.StartInfo.Arguments);
919
+                    }
920
+
903 921
                     FileToolsCommon.AppendText(LogPath, "【获取设备信息】:" + myProcess.StartInfo.Arguments + "\r\n");
904 922
                     myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
905 923
                     myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
@@ -976,7 +994,7 @@ namespace Common.system
976 994
             List<string> devicesList = new List<string>();
977 995
             try
978 996
             {
979
-                var videoDevices = new FilterInfoCollection(FilterCategory.AudioInputDevice);
997
+                FilterInfoCollection videoDevices = new FilterInfoCollection(FilterCategory.AudioInputDevice);
980 998
                 foreach (FilterInfo device in videoDevices)
981 999
                 {
982 1000
                     devicesList.Add(device.Name);
@@ -1005,7 +1023,7 @@ namespace Common.system
1005 1023
             List<string> devicesList = new List<string>();
1006 1024
             try
1007 1025
             {
1008
-                var videoDevices = new FilterInfoCollection(FilterCategory.AudioInputDevice);
1026
+                FilterInfoCollection videoDevices = new FilterInfoCollection(FilterCategory.AudioInputDevice);
1009 1027
                 foreach (FilterInfo device in videoDevices)
1010 1028
                 {
1011 1029
                     devicesList.Add(device.Name);
@@ -1023,7 +1041,7 @@ namespace Common.system
1023 1041
         /// <returns></returns>
1024 1042
         public static string GetInDeviceName()
1025 1043
         {
1026
-            var devices = new List<WaveInCapabilities>();
1044
+            List<WaveInCapabilities> devices = new List<WaveInCapabilities>();
1027 1045
             int waveInDevices = WaveIn.DeviceCount;
1028 1046
             for (int i = 0; i < waveInDevices; i++)
1029 1047
             {
@@ -1050,8 +1068,8 @@ namespace Common.system
1050 1068
         public static string GetInDeviceFull()
1051 1069
         {
1052 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 1073
             for (int waveInDevice = 0; waveInDevice < WaveIn.DeviceCount; waveInDevice++)
1056 1074
             {
1057 1075
                 WaveInCapabilities deviceInfo = WaveIn.GetCapabilities(waveInDevice);
@@ -1065,7 +1083,7 @@ namespace Common.system
1065 1083
                             break;
1066 1084
                         }
1067 1085
                     }
1068
-                    catch (Exception ex)
1086
+                    catch (Exception)
1069 1087
                     {
1070 1088
                         continue;
1071 1089
                     }
@@ -1089,8 +1107,8 @@ namespace Common.system
1089 1107
         public List<string> GetInDeviceListFull()
1090 1108
         {
1091 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 1112
             for (int waveInDevice = 0; waveInDevice < WaveIn.DeviceCount; waveInDevice++)
1095 1113
             {
1096 1114
                 WaveInCapabilities deviceInfo = WaveIn.GetCapabilities(waveInDevice);
@@ -1104,7 +1122,7 @@ namespace Common.system
1104 1122
                             break;
1105 1123
                         }
1106 1124
                     }
1107
-                    catch (Exception ex)
1125
+                    catch (Exception)
1108 1126
                     {
1109 1127
                         continue;
1110 1128
                     }

+ 6
- 8
Common/system/ImageHelper.cs Ver fichero

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

+ 1
- 7
XHWK.Model/Model_Signatures.cs Ver fichero

@@ -1,10 +1,4 @@
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 3
     public class Model_Signatures
10 4
     {

+ 1
- 1
XHWK.WKTool/App.cs Ver fichero

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

+ 1
- 1
XHWK.WKTool/CreateAMicroLessonWindow.xaml.cs Ver fichero

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

+ 1
- 0
XHWK.WKTool/DAL/Interface.cs Ver fichero

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

+ 0
- 4
XHWK.WKTool/Helpers/BackgroundWorkerHelper.cs Ver fichero

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

+ 2
- 2
XHWK.WKTool/JieTuWindow.xaml.cs Ver fichero

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

+ 3
- 3
XHWK.WKTool/KeyVerification.xaml.cs Ver fichero

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

+ 0
- 1
XHWK.WKTool/MessageWindow.xaml.cs Ver fichero

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

+ 2
- 4
XHWK.WKTool/PracticeWindow.xaml.cs Ver fichero

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

+ 64
- 62
XHWK.WKTool/PrintWindow.xaml.cs Ver fichero

@@ -29,13 +29,13 @@ namespace XHWK.WKTool
29 29
         {
30 30
             InitializeComponent();
31 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 34
             Width = Widths / 1.42;
35 35
             Height = Heights / 1.71;
36
-            GridContent.Width = Width+5;
36
+            GridContent.Width = Width + 5;
37 37
             GridContent.Height = Height;
38
-            this.ResizeMode = ResizeMode.NoResize;
38
+            ResizeMode = ResizeMode.NoResize;
39 39
             string defa = string.Empty;
40 40
             List<string> defaList = LatticeFileHelper.GetPrinterList(out defa);
41 41
             if (defaList.Count > 0)
@@ -56,9 +56,10 @@ namespace XHWK.WKTool
56 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 64
             wit = _wit;
64 65
             hei = _hei;
@@ -97,7 +98,7 @@ namespace XHWK.WKTool
97 98
             //FileToolsCommon.CreateFile(imgPath);
98 99
             //string pdf = imgPath + "\\101.pdf";
99 100
             //PDF位置
100
-            string SourcePath=FileToolsCommon.GetFileAbsolutePath("/temp/101.pdf");
101
+            string SourcePath = FileToolsCommon.GetFileAbsolutePath("/temp/101.pdf");
101 102
             StrList.Add(SourcePath);
102 103
             //打印数量
103 104
             int PrinterNum = Convert.ToInt32(txbNumberOfCopies.Text);
@@ -113,7 +114,8 @@ namespace XHWK.WKTool
113 114
             times.Elapsed += Times_ElapsedClick;
114 115
             times.Start();
115 116
         }
116
-        int num = 0;
117
+
118
+        private int num = 0;
117 119
         /// <summary>
118 120
         /// 计时器
119 121
         /// </summary>
@@ -124,11 +126,11 @@ namespace XHWK.WKTool
124 126
             Dispatcher.Invoke(() =>
125 127
             {
126 128
                 pgbProcess.Value = num;
127
-                lbProcess.Content = num.ToString()+"%";
129
+                lbProcess.Content = num.ToString() + "%";
128 130
                 if (num < 99)
129 131
                 {
130 132
                     num++;
131
-                    times.Interval += (num/2);
133
+                    times.Interval += (num / 2);
132 134
                 }
133 135
                 else
134 136
                 {
@@ -140,10 +142,10 @@ namespace XHWK.WKTool
140 142
         /// <summary>
141 143
         /// 开始打印
142 144
         /// </summary>
143
-        void StartPrint(object obj)
145
+        private void StartPrint(object obj)
144 146
         {
145
-          
146
-                try
147
+
148
+            try
147 149
             {
148 150
                 iTextSharp.text.Document document = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 0, 0, 0, 0);
149 151
                 //iTextSharp.text.Rectangle page = new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.A4., 250f);//cs
@@ -154,7 +156,7 @@ namespace XHWK.WKTool
154 156
                 string tempImgPath = imgPath;
155 157
                 FileToolsCommon.CreateDirectory(imgPath);
156 158
                 imgPath += "101.pdf";
157
-                while(File.Exists(imgPath))
159
+                while (File.Exists(imgPath))
158 160
                 {
159 161
                     imgPath = tempImgPath + ipdf.ToString() + ".pdf";
160 162
                     ipdf++;
@@ -180,10 +182,10 @@ namespace XHWK.WKTool
180 182
                     }
181 183
                     else
182 184
                     {
183
-                        RectangleF rectangleF = new RectangleF(0,0,0,0) ;
185
+                        RectangleF rectangleF = new RectangleF(0, 0, 0, 0);
184 186
                         Dispatcher.Invoke(() =>
185 187
                         {
186
-                             rectangleF = new RectangleF
188
+                            rectangleF = new RectangleF
187 189
                             {
188 190
                                 Width = (float)APP.PageDrawList[i].ImageSizes.CenterX,
189 191
                                 Height = (float)APP.PageDrawList[i].ImageSizes.CenterY,
@@ -191,23 +193,23 @@ namespace XHWK.WKTool
191 193
                                 Y = (float)APP.PageDrawList[i].ImageLocation.Y
192 194
                             };
193 195
                         });
194
-                   
196
+
195 197
 
196 198
 
197 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 214
                     if (image.Height > iTextSharp.text.PageSize.A4.Height)
213 215
                     {
@@ -242,26 +244,26 @@ namespace XHWK.WKTool
242 244
                     MessageWindow.Show(ex.Message);
243 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 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 256
             //TPF文件位置
255 257
             string TPFPath = FileToolsCommon.GetFileAbsolutePath("temp/");
256 258
             FileToolsCommon.CreateDirectory(TPFPath);
257 259
             TPFPath += "101.TPF";
258 260
             //生成点阵文件
259 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 264
                 Thread.Sleep(100);
263 265
             }
264
-            while(string.IsNullOrWhiteSpace(pr.ToString()))
266
+            while (string.IsNullOrWhiteSpace(pr.ToString()))
265 267
             {
266 268
                 Thread.Sleep(100);
267 269
             }
@@ -397,28 +399,28 @@ namespace XHWK.WKTool
397 399
                 int frequency = 1;
398 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 420
                                 //tip_outer.Visibility = Visibility.Collapsed;
419 421
                                 MessageWindow.Show("打印成功");
420
-                            });
421
-                        }))).Start();
422
+                        });
423
+                    }))).Start();
422 424
                 }
423 425
                 else
424 426
                 {
@@ -459,19 +461,19 @@ namespace XHWK.WKTool
459 461
         {
460 462
             Dispatcher.Invoke(() =>
461 463
             {
462
-            if (I <= 90)
463
-            {
464
-                try
464
+                if (I <= 90)
465 465
                 {
466
+                    try
467
+                    {
466 468
                         pgbProcess.Value = I * 100 / 100;
467 469
                         lbProcess.Content = I.ToString() + "%";
468 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 479
         /// <summary>

+ 7
- 15
XHWK.WKTool/ProductVerification.xaml.cs Ver fichero

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

+ 48
- 47
XHWK.WKTool/ScreenRecordingToolbarWindow.xaml.cs Ver fichero

@@ -75,46 +75,46 @@ namespace XHWK.WKTool
75 75
         public ScreenRecordingToolbarWindow()
76 76
         {
77 77
             InitializeComponent();
78
-            this.ResizeMode = ResizeMode.NoResize;
78
+            ResizeMode = ResizeMode.NoResize;
79 79
         }
80 80
         /// <summary>
81 81
         /// 初始化
82 82
         /// </summary>
83 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 109
             //timer = new System.Timers.Timer(200);
110 110
             //timer.Interval = 300;
111 111
             //timer.Elapsed += new System.Timers.ElapsedEventHandler(TimerDealy);
112 112
             //timer.Enabled = true; //启动计时器
113 113
 
114 114
             borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
115
-                borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
115
+            borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
116 116
             flg = 0;
117
-         
117
+
118 118
 
119 119
             k_hook = new KeyboardHookCommon();
120 120
             k_hook.KeyDownEvent += K_hook_KeyDownEvent;
@@ -272,10 +272,11 @@ namespace XHWK.WKTool
272 272
                 num++;
273 273
             }
274 274
         }
275
+
275 276
         /// <summary>
276 277
         /// 是否已经按下按钮
277 278
         /// </summary>
278
-        bool IsPressButton = false;
279
+        private bool IsPressButton = false;
279 280
         /// <summary>
280 281
         /// 开始或暂停录制
281 282
         /// </summary>
@@ -420,16 +421,16 @@ namespace XHWK.WKTool
420 421
                         {
421 422
                             Thread.Sleep(800);
422 423
                         }
423
-                        if(APP.FFmpeg.myProcess!=null)
424
+                        if (APP.FFmpeg.myProcess != null)
424 425
                         {
425 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 430
                         Thread.Sleep(1300);
430 431
                         Dispatcher.Invoke(() =>
431 432
                         {
432
-                            if(!SynRes)
433
+                            if (!SynRes)
433 434
                             {
434 435
                                 MessageWindow.Show(ErrMessage);
435 436
                                 //隐藏画笔工具栏
@@ -534,7 +535,7 @@ namespace XHWK.WKTool
534 535
             {
535 536
                 if (APP.W_PracticeWindow.Visibility == Visibility.Visible)
536 537
                 {
537
-                    this.Owner = null;
538
+                    Owner = null;
538 539
                     APP.W_PracticeWindow.ReturnPractice();
539 540
                 }
540 541
             }
@@ -577,8 +578,8 @@ namespace XHWK.WKTool
577 578
                                 Thread.Sleep(100);
578 579
                             }
579 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 583
                             VideoInfo.VideoPath = VideoSavePathName;
583 584
                             VideoInfo.ThumbnailPath = ThumbnailPathName;
584 585
                             APP.FFmpeg.GenerateThumbnails(VideoSavePathName, ThumbnailPathName, 200, 130);
@@ -587,8 +588,8 @@ namespace XHWK.WKTool
587 588
                             VideoInfo.Uploaded = 0;
588 589
                             VideoInfo.Savefolder = APP.UserInfo.Schoolid + "/resource";
589 590
                             APP.VideoList.Add(VideoInfo);
590
-                        //保存数据
591
-                        APP.SaveWkData();
591
+                            //保存数据
592
+                            APP.SaveWkData();
592 593
                         }))).Start();
593 594
                         Click_stopRecordingScreen();
594 595
                     }
@@ -683,11 +684,11 @@ namespace XHWK.WKTool
683 684
                 {
684 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 693
                     //}))).Start();
693 694
                     if (APP.W_PracticeWindow == null)
@@ -711,8 +712,8 @@ namespace XHWK.WKTool
711 712
                         Thread.Sleep(100);
712 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 718
                     }))).Start();
718 719
                 }
@@ -1016,12 +1017,12 @@ namespace XHWK.WKTool
1016 1017
                         Thread.Sleep(100);
1017 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 1023
                     }))).Start();
1023
-                 
1024
-                    
1024
+
1025
+
1025 1026
                 }
1026 1027
             }
1027 1028
             catch (Exception ex)
@@ -1038,7 +1039,7 @@ namespace XHWK.WKTool
1038 1039
         {
1039 1040
             if (flg > 9)
1040 1041
             {
1041
-                this.Owner = null;
1042
+                Owner = null;
1042 1043
                 APP.W_PracticeWindow.Hide();
1043 1044
             }
1044 1045
             else
@@ -1170,7 +1171,7 @@ namespace XHWK.WKTool
1170 1171
                 Thread.Sleep(500);
1171 1172
                 Dispatcher.Invoke(() =>
1172 1173
                 {
1173
-                    this.Owner = null;
1174
+                    Owner = null;
1174 1175
                     APP.W_PracticeWindow.Hide();
1175 1176
                 });
1176 1177
             }))).Start();

+ 11
- 17
XHWK.WKTool/UControl/Uc_VideoItem.xaml.cs Ver fichero

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

+ 19
- 18
XHWK.WKTool/UploadWindow.xaml.cs Ver fichero

@@ -9,7 +9,7 @@ using System.Windows.Input;
9 9
 
10 10
 using XHWK.Model;
11 11
 using XHWK.WKTool.DAL;
12
-using XHWK.WKTool.UControl;
12
+
13 13
 using static XHWK.WKTool.XHMicroLessonSystemWindow;
14 14
 
15 15
 namespace XHWK.WKTool
@@ -48,7 +48,7 @@ namespace XHWK.WKTool
48 48
         /// <summary>
49 49
         /// 当前视频的下标
50 50
         /// </summary>
51
-       private int i = 0;
51
+        private int i = 0;
52 52
         private System.Timers.Timer times;
53 53
         public UploadWindow()
54 54
         {
@@ -57,7 +57,7 @@ namespace XHWK.WKTool
57 57
         /// <summary>
58 58
         /// 初始化
59 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 62
             i = _i;
63 63
             Resourcename = _resourcename;
@@ -196,21 +196,21 @@ namespace XHWK.WKTool
196 196
         /// <param name="e"></param>
197 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 204
             book_list.IsEnabled = false;
205 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 215
         private void StartUpload()
216 216
         {
@@ -242,7 +242,7 @@ namespace XHWK.WKTool
242 242
                     Model_ResourceAdd model_ResourceAdd = new Model_ResourceAdd();
243 243
                     Dispatcher.Invoke(() =>
244 244
                     {
245
-                         model_ResourceAdd = new Model_ResourceAdd
245
+                        model_ResourceAdd = new Model_ResourceAdd
246 246
                         {
247 247
                             converted = 0,
248 248
                             createid = APP.UserInfo.Userid,
@@ -262,7 +262,7 @@ namespace XHWK.WKTool
262 262
                             schoolid = APP.UserInfo.Schoolid
263 263
                         };
264 264
                     });
265
-                    
265
+
266 266
                     if (Suffix.Equals("FLV"))
267 267
                     {
268 268
                         Suffix = "flv";
@@ -338,7 +338,8 @@ namespace XHWK.WKTool
338 338
                 });
339 339
             }
340 340
         }
341
-        int num = 0;
341
+
342
+        private int num = 0;
342 343
         /// <summary>
343 344
         /// 计时器
344 345
         /// </summary>

+ 53
- 42
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs Ver fichero

@@ -209,11 +209,11 @@ namespace XHWK.WKTool
209 209
             //wfhCamera.Visibility = Visibility.Hidden;
210 210
             ImgPDFPath = null;
211 211
             ImgPDFPath = new string[300];
212
-        } 
212
+        }
213 213
         /// <summary>
214 214
         /// 初始化快捷键
215 215
         /// </summary>
216
-        public void InitializeKeyDownEvent() 
216
+        public void InitializeKeyDownEvent()
217 217
         {
218 218
             k_hook.Start();//安装键盘钩子
219 219
         }
@@ -369,22 +369,22 @@ namespace XHWK.WKTool
369 369
                 #endregion
370 370
 
371 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,7 +465,7 @@ namespace XHWK.WKTool
465 465
         /// <param name="e"></param>
466 466
         private void RbnTurnOff_Click(object sender, RoutedEventArgs e)
467 467
         {
468
-            if(IsRbnOpen)
468
+            if (IsRbnOpen)
469 469
             {
470 470
                 #region 防止连击
471 471
                 if (IsPressButton)
@@ -487,12 +487,12 @@ namespace XHWK.WKTool
487 487
                 }
488 488
                 #endregion
489 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 498
         #endregion
@@ -953,7 +953,7 @@ namespace XHWK.WKTool
953 953
             {
954 954
                 WindowState = WindowState.Minimized;
955 955
             }
956
-       
956
+
957 957
             if (APP.W_JieTuWindow != null)
958 958
             {
959 959
                 APP.W_JieTuWindow.initialization();
@@ -1411,7 +1411,7 @@ namespace XHWK.WKTool
1411 1411
 
1412 1412
                             LogHelper.WriteErrLog("【打开pdf】(OpenDialog pdf)" + ex.Message, ex);
1413 1413
                         }
1414
-                      
1414
+
1415 1415
                     }
1416 1416
                     else//word
1417 1417
                     {
@@ -2460,32 +2460,37 @@ namespace XHWK.WKTool
2460 2460
         /// <summary>
2461 2461
         /// 总页数
2462 2462
         /// </summary>
2463
-        int TotalPage = 0;
2463
+        private int TotalPage = 0;
2464
+
2464 2465
         /// <summary>
2465 2466
         /// 当前页
2466 2467
         /// </summary>
2467
-        int CurrentPage = 1;
2468
+        private int CurrentPage = 1;
2469
+
2468 2470
         /// <summary>
2469 2471
         /// 每页显示的视频数
2470 2472
         /// </summary>
2471
-        int PageShowNum = 0;
2473
+        private int PageShowNum = 0;
2474
+
2472 2475
         /// <summary>
2473 2476
         /// 视频信息列表
2474 2477
         /// </summary>
2475
-        List<Uc_VideoItem> VideoControlList = new List<Uc_VideoItem>();
2478
+        private List<Uc_VideoItem> VideoControlList = new List<Uc_VideoItem>();
2479
+
2476 2480
         /// <summary>
2477 2481
         /// 横向间隔
2478 2482
         /// </summary>
2479
-        double IntervalX = 0;
2483
+        private double IntervalX = 0;
2484
+
2480 2485
         /// <summary>
2481 2486
         /// 纵向间隔
2482 2487
         /// </summary>
2483
-        double IntervalY = 0;
2488
+        private double IntervalY = 0;
2484 2489
         #endregion
2485 2490
         /// <summary>
2486 2491
         /// 初始化加载上传页面数据
2487 2492
         /// </summary>
2488
-        void LoadUploadInitData()
2493
+        private void LoadUploadInitData()
2489 2494
         {
2490 2495
             APP.myloading.Show();
2491 2496
             //加载视频列表
@@ -2570,8 +2575,10 @@ namespace XHWK.WKTool
2570 2575
                     {
2571 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 2582
                     videoItem.Click_refreshVideoList += LoadUploadInitData;
2576 2583
                     videoItem.Click_UploadLogin += Login;
2577 2584
                     videoItem.Width = 250;
@@ -2686,14 +2693,16 @@ namespace XHWK.WKTool
2686 2693
         /// 录制计时
2687 2694
         /// </summary>
2688 2695
         private DateTime SRTime = DateTime.Now;
2696
+
2689 2697
         /// <summary>
2690 2698
         /// 录制大小
2691 2699
         /// </summary>
2692
-        int gridActWidth = 1276;
2700
+        private int gridActWidth = 1276;
2701
+
2693 2702
         /// <summary>
2694 2703
         /// 录制大小
2695 2704
         /// </summary>
2696
-        int gridActHeight = 898;
2705
+        private int gridActHeight = 898;
2697 2706
 
2698 2707
         #endregion
2699 2708
 
@@ -2787,7 +2796,7 @@ namespace XHWK.WKTool
2787 2796
 
2788 2797
         }
2789 2798
         #endregion
2790
-        bool IsPressButton = false;
2799
+        private bool IsPressButton = false;
2791 2800
         /// <summary>
2792 2801
         /// 录制窗口内容
2793 2802
         /// </summary>
@@ -3092,11 +3101,11 @@ namespace XHWK.WKTool
3092 3101
                     new Thread(new ThreadStart(new Action(() =>
3093 3102
                     {
3094 3103
                         Thread.Sleep(1000);
3095
-                        IsRecordAudio = APP.FFmpeg.StartRecordingAudio(AudioPathName,out string ErrMessage);
3104
+                        IsRecordAudio = APP.FFmpeg.StartRecordingAudio(AudioPathName, out string ErrMessage);
3096 3105
                         Thread.Sleep(1000);
3097 3106
                         Dispatcher.Invoke(() =>
3098 3107
                         {
3099
-                            if(!IsRecordAudio)
3108
+                            if (!IsRecordAudio)
3100 3109
                             {
3101 3110
                                 MessageWindow.Show(ErrMessage);
3102 3111
                             }
@@ -3155,10 +3164,11 @@ namespace XHWK.WKTool
3155 3164
                 }
3156 3165
             }
3157 3166
         }
3167
+
3158 3168
         /// <summary>
3159 3169
         /// 记录上次截图时间
3160 3170
         /// </summary>
3161
-        DateTime Recorddt = DateTime.Now;
3171
+        private DateTime Recorddt = DateTime.Now;
3162 3172
         /// <summary>
3163 3173
         /// 录制保存图片计时器
3164 3174
         /// </summary>
@@ -3179,10 +3189,11 @@ namespace XHWK.WKTool
3179 3189
                 }
3180 3190
             }
3181 3191
         }
3192
+
3182 3193
         /// <summary>
3183 3194
         /// 录制保存图片
3184 3195
         /// </summary>
3185
-        void RecordSaveImage()
3196
+        private void RecordSaveImage()
3186 3197
         {
3187 3198
             try
3188 3199
             {
@@ -3365,7 +3376,7 @@ namespace XHWK.WKTool
3365 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 3380
                             //}))).Start();
3370 3381
                             //new Thread(new ThreadStart(new Action(() =>
3371 3382
                             //{
@@ -3374,7 +3385,7 @@ namespace XHWK.WKTool
3374 3385
                                 Dispatcher.Invoke(() =>
3375 3386
                                 {
3376 3387
                                     //MessageWindow.Show("视频录制失败,无法保存此视频!");
3377
-                                    MessageWindow.Show("录制失败,"+ErrMessage);
3388
+                                    MessageWindow.Show("录制失败," + ErrMessage);
3378 3389
                                     BtnRecord.IsEnabled = true;
3379 3390
                                     btnStop.IsEnabled = true;
3380 3391
                                     TxbRecordingWord.Text = "录制";

Loading…
Cancelar
Guardar