Browse Source

zhao:1增加微课模型2增加视频模型3增加录屏4优化代码

tags/录制修改前
耀 4 years ago
parent
commit
73db3d61a6
35 changed files with 411 additions and 228 deletions
  1. 3
    6
      Common/Model/DownloadInfoModel.cs
  2. 0
    1
      Common/Properties/AssemblyInfo.cs
  3. 4
    6
      Common/system/CLeopardZip.cs
  4. 5
    5
      Common/system/CameraHelper.cs
  5. 1
    6
      Common/system/DataConvertCommon.cs
  6. 2
    2
      Common/system/DownloadManager.cs
  7. 1
    3
      Common/system/DownloadService.cs
  8. 3
    6
      Common/system/FFMpeg.cs
  9. 62
    6
      Common/system/FileToolsCommon.cs
  10. 1
    4
      Common/system/FreeMemoryHelper.cs
  11. 0
    2
      Common/system/HttpHelper.cs
  12. 3
    6
      Common/system/ImageHelper.cs
  13. 1
    5
      Common/system/LogHelper.cs
  14. 12
    8
      Common/system/PrimaryScreen.cs
  15. 1
    4
      Common/system/SplashScreen.cs
  16. 0
    3
      Common/system/XmlUtilHelper.cs
  17. 0
    12
      XHWK.Model/Class1.cs
  18. 8
    0
      XHWK.Model/Model_UserInfo.cs
  19. 69
    0
      XHWK.Model/Model_Video.cs
  20. 23
    0
      XHWK.Model/Model_WKData.cs
  21. 0
    1
      XHWK.Model/Properties/AssemblyInfo.cs
  22. 14
    18
      XHWK.Model/XHWK.Model.csproj
  23. 1
    1
      XHWK.WKTool/App.config
  24. 16
    4
      XHWK.WKTool/App.cs
  25. 5
    17
      XHWK.WKTool/CountdownWindow.xaml.cs
  26. 5
    5
      XHWK.WKTool/CreateAMicroLessonWindow.xaml
  27. 45
    16
      XHWK.WKTool/CreateAMicroLessonWindow.xaml.cs
  28. 1
    12
      XHWK.WKTool/FileDirectoryWindow.xaml.cs
  29. 1
    13
      XHWK.WKTool/LoginWindow.xaml.cs
  30. 0
    2
      XHWK.WKTool/Properties/AssemblyInfo.cs
  31. 1
    1
      XHWK.WKTool/ScreenRecordingToolbarWindow.xaml
  32. 113
    25
      XHWK.WKTool/ScreenRecordingToolbarWindow.xaml.cs
  33. 1
    13
      XHWK.WKTool/UCCamera.xaml.cs
  34. 1
    1
      XHWK.WKTool/XHMicroLessonSystemWindow.xaml
  35. 8
    14
      XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs

+ 3
- 6
Common/Model/DownloadInfoModel.cs View File

1
-using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4
-using System.Text;
1
+using System.Collections.Generic;
5
 
2
 
6
 namespace Common.Model
3
 namespace Common.Model
7
 {
4
 {
91
         /// </summary>
88
         /// </summary>
92
         public List<string> downloadUrlList
89
         public List<string> downloadUrlList
93
         {
90
         {
94
-            get {return _downloadUrlList;}
91
+            get { return _downloadUrlList; }
95
 
92
 
96
             set
93
             set
97
             {
94
             {
98
                 List<string> UTF8ValueList = new List<string>();
95
                 List<string> UTF8ValueList = new List<string>();
99
                 foreach (string val in value)
96
                 foreach (string val in value)
100
                 {
97
                 {
101
-                    string path = val.Substring(0, val.LastIndexOf("/")+1);
98
+                    string path = val.Substring(0, val.LastIndexOf("/") + 1);
102
                     string name = val.Substring(val.LastIndexOf("/") + 1);
99
                     string name = val.Substring(val.LastIndexOf("/") + 1);
103
                     string UTF8Name = System.Web.HttpUtility.UrlEncode(name);
100
                     string UTF8Name = System.Web.HttpUtility.UrlEncode(name);
104
                     string UTF8Url = path + UTF8Name;
101
                     string UTF8Url = path + UTF8Name;

+ 0
- 1
Common/Properties/AssemblyInfo.cs View File

1
 using System.Reflection;
1
 using System.Reflection;
2
-using System.Runtime.CompilerServices;
3
 using System.Runtime.InteropServices;
2
 using System.Runtime.InteropServices;
4
 
3
 
5
 // 有关程序集的一般信息由以下
4
 // 有关程序集的一般信息由以下

+ 4
- 6
Common/system/CLeopardZip.cs View File

1
-using System;
1
+using ICSharpCode.SharpZipLib.Checksums;
2
+using ICSharpCode.SharpZipLib.Zip;
3
+
4
+using System;
2
 using System.Collections.Generic;
5
 using System.Collections.Generic;
3
-using System.Linq;
4
-using System.Text;
5
 using System.IO;
6
 using System.IO;
6
-using ICSharpCode.SharpZipLib;
7
-using ICSharpCode.SharpZipLib.Zip;
8
-using ICSharpCode.SharpZipLib.Checksums;
9
 
7
 
10
 namespace Common.system
8
 namespace Common.system
11
 {
9
 {

+ 5
- 5
Common/system/CameraHelper.cs View File

1
-using System;
2
-using System.Windows;
3
-using System.IO;
1
+using AForge.Controls;
2
+using AForge.Video.DirectShow;
3
+
4
+using System;
4
 using System.Drawing;
5
 using System.Drawing;
5
 using System.Drawing.Imaging;
6
 using System.Drawing.Imaging;
6
-using AForge.Video.DirectShow;
7
-using AForge.Controls;
7
+using System.IO;
8
 
8
 
9
 
9
 
10
 namespace Common.system
10
 namespace Common.system

+ 1
- 6
Common/system/DataConvertCommon.cs View File

1
-using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4
-using System.Text;
5
-
6
-namespace Common.system
1
+namespace Common.system
7
 {
2
 {
8
     /// <summary>
3
     /// <summary>
9
     /// 数据转换帮助类
4
     /// 数据转换帮助类

+ 2
- 2
Common/system/DownloadManager.cs View File

1
 using Common.Model;
1
 using Common.Model;
2
+
2
 using System;
3
 using System;
3
 using System.Collections.Generic;
4
 using System.Collections.Generic;
4
 using System.IO;
5
 using System.IO;
5
 using System.Linq;
6
 using System.Linq;
6
-using System.Text;
7
 using System.Threading;
7
 using System.Threading;
8
 
8
 
9
 namespace Common.system
9
 namespace Common.system
110
                             }
110
                             }
111
                             catch (Exception)//无法获取文件名时  使用传入保存名称
111
                             catch (Exception)//无法获取文件名时  使用传入保存名称
112
                             {
112
                             {
113
-                                dlInfo.fileName = dlInfo.saveFileName; 
113
+                                dlInfo.fileName = dlInfo.saveFileName;
114
                             }
114
                             }
115
 
115
 
116
                             //默认给流总数
116
                             //默认给流总数

+ 1
- 3
Common/system/DownloadService.cs View File

1
 using Common.Model;
1
 using Common.Model;
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.Net;
5
 using System.Net;
7
-using System.Text;
8
 
6
 
9
 namespace Common.system
7
 namespace Common.system
10
 {
8
 {

+ 3
- 6
Common/system/FFMpeg.cs View File

1
 using System;
1
 using System;
2
 using System.Collections.Generic;
2
 using System.Collections.Generic;
3
 using System.Diagnostics;
3
 using System.Diagnostics;
4
-using System.IO;
5
-using System.Linq;
6
-using System.Text;
7
 using System.Threading;
4
 using System.Threading;
8
 
5
 
9
 using VisioForge.Shared.NAudio.CoreAudioApi;
6
 using VisioForge.Shared.NAudio.CoreAudioApi;
96
         /// 录制音频
93
         /// 录制音频
97
         /// </summary>
94
         /// </summary>
98
         /// <param name="Mp3Path">MP3音频位置</param>
95
         /// <param name="Mp3Path">MP3音频位置</param>
99
-        private void StartRecordingAudio(string Mp3Path)
96
+        public void StartRecordingAudio(string Mp3Path)
100
         {
97
         {
101
             Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
98
             Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
102
             Debug.WriteLine(KillProcessArray.Length.ToString());
99
             Debug.WriteLine(KillProcessArray.Length.ToString());
168
         /// <param name="Frequency">每秒帧率</param>
165
         /// <param name="Frequency">每秒帧率</param>
169
         /// <param name="VideoWidth">视频宽度</param>
166
         /// <param name="VideoWidth">视频宽度</param>
170
         /// <param name="VideoHeight">视频高度</param>
167
         /// <param name="VideoHeight">视频高度</param>
171
-        private void SynthesisVideo(string ImageListPath, string Mp3Path, string VideoSavePath, int Frequency, int VideoWidth, int VideoHeight)
168
+        public void SynthesisVideo(string ImageListPath, string Mp3Path, string VideoSavePath, int Frequency, int VideoWidth, int VideoHeight)
172
         {
169
         {
173
             Thread thread = new Thread(delegate ()
170
             Thread thread = new Thread(delegate ()
174
             {
171
             {
296
         /// </summary>
293
         /// </summary>
297
         /// <param name="VideoPath">视频地址</param>
294
         /// <param name="VideoPath">视频地址</param>
298
         /// <param name="ImagePath">图片地址</param>
295
         /// <param name="ImagePath">图片地址</param>
299
-        void GenerateThumbnails(string VideoPath, string ImagePath)
296
+        public void GenerateThumbnails(string VideoPath, string ImagePath)
300
         {
297
         {
301
             Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
298
             Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
302
             Debug.WriteLine(KillProcessArray.Length.ToString());
299
             Debug.WriteLine(KillProcessArray.Length.ToString());

+ 62
- 6
Common/system/FileToolsCommon.cs View File

1
 using System;
1
 using System;
2
-using System.Collections.Generic;
3
 using System.Configuration;
2
 using System.Configuration;
4
 using System.IO;
3
 using System.IO;
5
-using System.Linq;
6
 using System.Text;
4
 using System.Text;
5
+using System.Text.RegularExpressions;
7
 using System.Windows.Forms;
6
 using System.Windows.Forms;
8
 
7
 
9
 namespace Common.system
8
 namespace Common.system
15
     /// </summary>
14
     /// </summary>
16
     public static class FileToolsCommon
15
     public static class FileToolsCommon
17
     {
16
     {
17
+        #region 获取文件的绝对路径
18
+
18
         /// <summary>
19
         /// <summary>
19
         /// 获取文件的绝对路径
20
         /// 获取文件的绝对路径
20
         /// </summary>
21
         /// </summary>
43
                 return Path;
44
                 return Path;
44
             }
45
             }
45
         }
46
         }
47
+        /// <summary>
48
+        /// 获取合法路径 结尾带/
49
+        /// </summary>
50
+        /// <returns></returns>
51
+        public static string GetLegalPath(string FilePath)
52
+        {
53
+            FilePath = System.IO.Path.Combine(FilePath.Replace("\\", "/"));
54
+            FilePath += (FilePath.Substring(FilePath.Length - 1, 1) == "/" ? "" : "/");
55
+            return FilePath;
56
+        }
57
+        #endregion
58
+
59
+        #region 检测路径是否合法
60
+        /// <summary>
61
+        /// 检测路径是否合法
62
+        /// </summary>
63
+        /// <param name="FilePathName">绝对路径</param>
64
+        /// <param name="ErrMessage">返回错误</param>
65
+        /// <returns></returns>
66
+        public static bool IsLegalPath(string FilePathName, out string ErrMessage)
67
+        {
68
+            string FilePath;
69
+            string FileName;
70
+            ErrMessage = "";
71
+            try
72
+            {
73
+                FilePath = GetDirectoryName(FilePathName);
74
+                FileName = GetIOFileName(FilePathName);
75
+            }
76
+            catch (Exception)
77
+            {
78
+                ErrMessage = "路径或文件名不合法!";
79
+                return false;
80
+            }
81
+            Regex regex = new Regex(@"^([a-zA-Z]:\\)?[^\/\:\*\?\""\<\>\|\,]*$");
82
+            Match m = regex.Match(FilePath);
83
+            if (!m.Success)
84
+            {
85
+                ErrMessage = "非法的文件保存路径!";
86
+                return false;
87
+            }
88
+            if (!string.IsNullOrWhiteSpace(FileName))
89
+            {
90
+                regex = new Regex(@"^[^\/\:\*\?\""\<\>\|\,]+$");
91
+                m = regex.Match(FileName);
92
+                if (!m.Success)
93
+                {
94
+                    ErrMessage = "非法的文件名!文件名中包含\\ / : * ? \" < > |等字符!";
95
+                    return false;
96
+                }
97
+            }
98
+            return true;
99
+
100
+        }
101
+        #endregion
46
 
102
 
47
         #region 检测指定目录是否存在
103
         #region 检测指定目录是否存在
48
         /// <summary>  
104
         /// <summary>  
128
             try
184
             try
129
             {
185
             {
130
                 //获取指定的文件列表  
186
                 //获取指定的文件列表  
131
-                string[] fileNames = GetFileNames(directoryPath, searchPattern, true);
187
+                string[] fileNames = GetFileNames(directoryPath, searchPattern, isSearchChild);
132
 
188
 
133
                 //判断指定文件是否存在  
189
                 //判断指定文件是否存在  
134
                 return fileNames.Length != 0;
190
                 return fileNames.Length != 0;
292
                 return null;//throw new FileNotFoundException();
348
                 return null;//throw new FileNotFoundException();
293
             }
349
             }
294
             DirectoryInfo folder = new DirectoryInfo(directoryPath);
350
             DirectoryInfo folder = new DirectoryInfo(directoryPath);
295
-            FileInfo[] fileList = null;
351
+            FileInfo[] fileList;
296
             if (files == null)
352
             if (files == null)
297
                 fileList = folder.GetFiles();
353
                 fileList = folder.GetFiles();
298
             else
354
             else
610
 
666
 
611
         #region 从文件的绝对路径中获取路径名
667
         #region 从文件的绝对路径中获取路径名
612
         /// <summary>  
668
         /// <summary>  
613
-        /// 从文件的绝对路径中获取扩展
669
+        /// 使用IO从文件的绝对路径中获取路径
614
         /// </summary>  
670
         /// </summary>  
615
         /// <param name="filePath">文件的绝对路径</param>          
671
         /// <param name="filePath">文件的绝对路径</param>          
616
         public static string GetDirectoryName(string filePath)
672
         public static string GetDirectoryName(string filePath)
695
         /// </summary>
751
         /// </summary>
696
         /// <param name="directoryPath">目录地址</param>
752
         /// <param name="directoryPath">目录地址</param>
697
         /// <returns> 单位:MB</returns>
753
         /// <returns> 单位:MB</returns>
698
-        public static double pathSize(string directoryPath)
754
+        public static double PathSize(string directoryPath)
699
         {
755
         {
700
             DirectoryInfo folder = new DirectoryInfo(directoryPath);
756
             DirectoryInfo folder = new DirectoryInfo(directoryPath);
701
             double DirectorySize = DirSize(folder);
757
             double DirectorySize = DirSize(folder);

+ 1
- 4
Common/system/FreeMemoryHelper.cs View File

1
 using Microsoft.Win32;
1
 using Microsoft.Win32;
2
+
2
 using System;
3
 using System;
3
-using System.Collections.Generic;
4
-using System.Linq;
5
 using System.Runtime.InteropServices;
4
 using System.Runtime.InteropServices;
6
-using System.Text;
7
-using System.Threading.Tasks;
8
 
5
 
9
 namespace Common.system
6
 namespace Common.system
10
 {
7
 {

+ 0
- 2
Common/system/HttpHelper.cs View File

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

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

1
 using System;
1
 using System;
2
-using System.Collections.Generic;
2
+using System.Configuration;
3
 using System.Drawing;
3
 using System.Drawing;
4
+using System.Drawing.Imaging;
4
 using System.IO;
5
 using System.IO;
5
-using System.Windows.Media.Imaging;
6
 using System.Windows;
6
 using System.Windows;
7
-using System.Linq;
8
-using System.Text;
9
-using System.Drawing.Imaging;
10
-using System.Configuration;
11
 using System.Windows.Media;
7
 using System.Windows.Media;
8
+using System.Windows.Media.Imaging;
12
 
9
 
13
 namespace Common.system
10
 namespace Common.system
14
 {
11
 {

+ 1
- 5
Common/system/LogHelper.cs View File

1
 using System;
1
 using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4
-using System.Text;
5
-using log4net;
6
 
2
 
7
 namespace Common.system
3
 namespace Common.system
8
 {
4
 {
10
     {
6
     {
11
         public static readonly log4net.ILog loginfo = log4net.LogManager.GetLogger("loginfo");
7
         public static readonly log4net.ILog loginfo = log4net.LogManager.GetLogger("loginfo");
12
         public static readonly log4net.ILog logerror = log4net.LogManager.GetLogger("logerror");
8
         public static readonly log4net.ILog logerror = log4net.LogManager.GetLogger("logerror");
13
-        public static void WriteInfoLog(string info) 
9
+        public static void WriteInfoLog(string info)
14
         {
10
         {
15
             if (loginfo.IsInfoEnabled)
11
             if (loginfo.IsInfoEnabled)
16
             {
12
             {

+ 12
- 8
Common/system/PrimaryScreen.cs View File

38
             get
38
             get
39
             {
39
             {
40
                 IntPtr hdc = GetDC(IntPtr.Zero);
40
                 IntPtr hdc = GetDC(IntPtr.Zero);
41
-                Size size = new Size();
42
-                size.Width = GetDeviceCaps(hdc, HORZRES);
43
-                size.Height = GetDeviceCaps(hdc, VERTRES);
41
+                Size size = new Size
42
+                {
43
+                    Width = GetDeviceCaps(hdc, HORZRES),
44
+                    Height = GetDeviceCaps(hdc, VERTRES)
45
+                };
44
                 ReleaseDC(IntPtr.Zero, hdc);
46
                 ReleaseDC(IntPtr.Zero, hdc);
45
                 return size;
47
                 return size;
46
             }
48
             }
79
             get
81
             get
80
             {
82
             {
81
                 IntPtr hdc = GetDC(IntPtr.Zero);
83
                 IntPtr hdc = GetDC(IntPtr.Zero);
82
-                Size size = new Size();
83
-                size.Width = GetDeviceCaps(hdc, DESKTOPHORZRES);
84
-                size.Height = GetDeviceCaps(hdc, DESKTOPVERTRES);
84
+                Size size = new Size
85
+                {
86
+                    Width = GetDeviceCaps(hdc, DESKTOPHORZRES),
87
+                    Height = GetDeviceCaps(hdc, DESKTOPVERTRES)
88
+                };
85
                 ReleaseDC(IntPtr.Zero, hdc);
89
                 ReleaseDC(IntPtr.Zero, hdc);
86
                 return size;
90
                 return size;
87
             }
91
             }
95
             get
99
             get
96
             {
100
             {
97
                 IntPtr hdc = GetDC(IntPtr.Zero);
101
                 IntPtr hdc = GetDC(IntPtr.Zero);
98
-                int t = GetDeviceCaps(hdc, DESKTOPHORZRES);
99
-                int d = GetDeviceCaps(hdc, HORZRES);
102
+                /*int t = */GetDeviceCaps(hdc, DESKTOPHORZRES);
103
+               /* int d = */GetDeviceCaps(hdc, HORZRES);
100
                 float ScaleX = (float)GetDeviceCaps(hdc, DESKTOPHORZRES) / (float)GetDeviceCaps(hdc, HORZRES);
104
                 float ScaleX = (float)GetDeviceCaps(hdc, DESKTOPHORZRES) / (float)GetDeviceCaps(hdc, HORZRES);
101
                 ReleaseDC(IntPtr.Zero, hdc);
105
                 ReleaseDC(IntPtr.Zero, hdc);
102
                 return ScaleX;
106
                 return ScaleX;

+ 1
- 4
Common/system/SplashScreen.cs View File

1
 using System;
1
 using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4
 using System.Reflection;
2
 using System.Reflection;
5
-using System.Text;
6
 using System.Threading;
3
 using System.Threading;
7
 using System.Windows.Forms;
4
 using System.Windows.Forms;
8
 
5
 
32
                 throw (new Exception());
29
                 throw (new Exception());
33
             }
30
             }
34
 
31
 
35
-            _SplashThread = new Thread(new ThreadStart(delegate()
32
+            _SplashThread = new Thread(new ThreadStart(delegate ()
36
             {
33
             {
37
                 CreateInstance(splashFormType);
34
                 CreateInstance(splashFormType);
38
                 Application.Run(_SplashForm);
35
                 Application.Run(_SplashForm);

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

1
 using System;
1
 using System;
2
-using System.Collections.Generic;
3
 using System.Data;
2
 using System.Data;
4
 using System.IO;
3
 using System.IO;
5
-using System.Linq;
6
-using System.Text;
7
 using System.Xml;
4
 using System.Xml;
8
 using System.Xml.Serialization;
5
 using System.Xml.Serialization;
9
 
6
 

+ 0
- 12
XHWK.Model/Class1.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
8
-{
9
-    public class Class1
10
-    {
11
-    }
12
-}

+ 8
- 0
XHWK.Model/Model_UserInfo.cs View File

1
+namespace XHWK.Model
2
+{
3
+    public class Model_UserInfo
4
+    {
5
+        string _wkName;
6
+        public string WkName { get => _wkName; set => _wkName = value; }
7
+    }
8
+}

+ 69
- 0
XHWK.Model/Model_Video.cs View File

1
+namespace XHWK.Model
2
+{
3
+    /// <summary>
4
+    /// 视频模型
5
+    /// </summary>
6
+    public class Model_Video
7
+    {
8
+        private string _videPath;
9
+        private string _thumbnailPath;
10
+        private Emum_VideoType _videoType;
11
+        private Enum_WKVidetype _wkType;
12
+        private string _RSTime;
13
+        private string _videoSize;
14
+        private string _drawDataPath;
15
+        /// <summary>
16
+        /// 视频路径
17
+        /// </summary>
18
+        public string VidePath { get => _videPath; set => _videPath = value; }
19
+        /// <summary>
20
+        /// 缩略图路径
21
+        /// </summary>
22
+        public string ThumbnailPath { get => _thumbnailPath; set => _thumbnailPath = value; }
23
+        /// <summary>
24
+        /// 视频类型
25
+        /// </summary>
26
+        public Emum_VideoType VideoType { get => _videoType; set => _videoType = value; }
27
+        /// <summary>
28
+        /// 微课类型
29
+        /// </summary>
30
+        public Enum_WKVidetype WkType { get => _wkType; set => _wkType = value; }
31
+        /// <summary>
32
+        /// 录制时间
33
+        /// </summary>
34
+        public string RSTime { get => _RSTime; set => _RSTime = value; }
35
+        /// <summary>
36
+        /// 视频大小
37
+        /// </summary>
38
+        public string VideoSize { get => _videoSize; set => _videoSize = value; }
39
+        /// <summary>
40
+        /// 画板数据存储路径
41
+        /// </summary>
42
+        public string DrawDataPath { get => _drawDataPath; set => _drawDataPath = value; }
43
+    }
44
+    /// <summary>
45
+    /// 视频格式类型
46
+    /// </summary>
47
+    public enum Emum_VideoType
48
+    {
49
+        MP4 = 1,
50
+        FlV = 2,
51
+        AVI = 3
52
+    }
53
+
54
+    /// <summary>
55
+    /// 录制视频类型
56
+    /// </summary>
57
+    public enum Enum_WKVidetype
58
+    {
59
+        /// <summary>
60
+        /// 录屏
61
+        /// </summary>
62
+        RecordingScreen = 1,
63
+        /// <summary>
64
+        /// 录课
65
+        /// </summary>
66
+        RecordingLessons = 2
67
+    }
68
+
69
+}

+ 23
- 0
XHWK.Model/Model_WKData.cs View File

1
+using System.Collections.Generic;
2
+
3
+namespace XHWK.Model
4
+{
5
+    public class Model_WKData
6
+    {
7
+        private string _wkName;
8
+        private List<Model_Video> _videoList;
9
+        private string _wkPath;
10
+        /// <summary>
11
+        /// 微课名
12
+        /// </summary>
13
+        public string WkName { get => _wkName; set => _wkName = value; }
14
+        /// <summary>
15
+        /// 视频列表
16
+        /// </summary>
17
+        public List<Model_Video> VideoList { get => _videoList; set => _videoList = value; }
18
+        /// <summary>
19
+        /// 微课路径
20
+        /// </summary>
21
+        public string WkPath { get => _wkPath; set => _wkPath = value; }
22
+    }
23
+}

+ 0
- 1
XHWK.Model/Properties/AssemblyInfo.cs View File

1
 using System.Reflection;
1
 using System.Reflection;
2
-using System.Runtime.CompilerServices;
3
 using System.Runtime.InteropServices;
2
 using System.Runtime.InteropServices;
4
 
3
 
5
 // 有关程序集的一般信息由以下
4
 // 有关程序集的一般信息由以下

+ 14
- 18
XHWK.Model/XHWK.Model.csproj View File

1
-<?xml version="1.0" encoding="utf-8"?>
1
+<?xml version="1.0" encoding="utf-8"?>
2
 <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2
 <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
3
   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4
   <PropertyGroup>
4
   <PropertyGroup>
5
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7
-    <ProjectGuid>445a4527-849b-4fa9-aa97-8ed1098d211e</ProjectGuid>
7
+    <ProjectGuid>{445A4527-849B-4FA9-AA97-8ED1098D211E}</ProjectGuid>
8
     <OutputType>Library</OutputType>
8
     <OutputType>Library</OutputType>
9
     <AppDesignerFolder>Properties</AppDesignerFolder>
9
     <AppDesignerFolder>Properties</AppDesignerFolder>
10
     <RootNamespace>XHWK.Model</RootNamespace>
10
     <RootNamespace>XHWK.Model</RootNamespace>
31
     <WarningLevel>4</WarningLevel>
31
     <WarningLevel>4</WarningLevel>
32
   </PropertyGroup>
32
   </PropertyGroup>
33
   <ItemGroup>
33
   <ItemGroup>
34
-    <Reference Include="System"/>
35
-    
36
-    <Reference Include="System.Core"/>
37
-    <Reference Include="System.Xml.Linq"/>
38
-    <Reference Include="System.Data.DataSetExtensions"/>
39
-    
40
-    
41
-    <Reference Include="Microsoft.CSharp"/>
42
-    
43
-    <Reference Include="System.Data"/>
44
-    
45
-    <Reference Include="System.Net.Http"/>
46
-    
47
-    <Reference Include="System.Xml"/>
34
+    <Reference Include="System" />
35
+    <Reference Include="System.Core" />
36
+    <Reference Include="System.Xml.Linq" />
37
+    <Reference Include="System.Data.DataSetExtensions" />
38
+    <Reference Include="Microsoft.CSharp" />
39
+    <Reference Include="System.Data" />
40
+    <Reference Include="System.Net.Http" />
41
+    <Reference Include="System.Xml" />
48
   </ItemGroup>
42
   </ItemGroup>
49
   <ItemGroup>
43
   <ItemGroup>
50
-    <Compile Include="Class1.cs" />
44
+    <Compile Include="Model_UserInfo.cs" />
45
+    <Compile Include="Model_Video.cs" />
46
+    <Compile Include="Model_WKData.cs" />
51
     <Compile Include="Properties\AssemblyInfo.cs" />
47
     <Compile Include="Properties\AssemblyInfo.cs" />
52
   </ItemGroup>
48
   </ItemGroup>
53
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
49
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
54
- </Project>
50
+</Project>

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

7
     <!--图片压缩等级-->
7
     <!--图片压缩等级-->
8
     <add key="ImageCompressionLevel" value="30" />
8
     <add key="ImageCompressionLevel" value="30" />
9
     <!--文件存放路径  路径\账户名\讲解名称_x.MP4-->
9
     <!--文件存放路径  路径\账户名\讲解名称_x.MP4-->
10
-    <add key="VideoSavePath" value="30" />
10
+    <add key="VideoSavePath" value="D:\星火微课" />
11
     <!--视频格式 1、MP4 2、FlV 3、AVI-->
11
     <!--视频格式 1、MP4 2、FlV 3、AVI-->
12
     <add key="VideoType" value="1" />
12
     <add key="VideoType" value="1" />
13
   </appSettings>
13
   </appSettings>

+ 16
- 4
XHWK.WKTool/App.cs View File

1
 using Common.system;
1
 using Common.system;
2
 
2
 
3
 using System;
3
 using System;
4
-using System.Collections.Generic;
5
 using System.Diagnostics;
4
 using System.Diagnostics;
6
-using System.Linq;
7
-using System.Text;
8
 using System.Threading;
5
 using System.Threading;
9
-using System.Threading.Tasks;
10
 using System.Windows;
6
 using System.Windows;
11
 using System.Windows.Threading;
7
 using System.Windows.Threading;
12
 
8
 
9
+using XHWK.Model;
10
+
13
 namespace XHWK.WKTool
11
 namespace XHWK.WKTool
14
 {
12
 {
15
     public partial class APP : Application
13
     public partial class APP : Application
16
     {
14
     {
15
+        #region 全局变量
16
+        /// <summary>
17
+        /// 微课模型
18
+        /// </summary>
19
+        public static Model_WKData WKData = null;
20
+        /// <summary>
21
+        /// 讲解名称
22
+        /// </summary>
23
+        public static string WkName = null;
24
+        /// <summary>
25
+        /// 微课保存路径
26
+        /// </summary>
27
+        public static string WkSavePath = null;
17
         /// <summary>
28
         /// <summary>
18
         /// 主页面
29
         /// 主页面
19
         /// </summary>
30
         /// </summary>
26
         /// 录像工具栏
37
         /// 录像工具栏
27
         /// </summary>
38
         /// </summary>
28
         public static ScreenRecordingToolbarWindow W_ScreenRecordingToolbarWindow = null;
39
         public static ScreenRecordingToolbarWindow W_ScreenRecordingToolbarWindow = null;
40
+        #endregion
29
 
41
 
30
         [STAThread]
42
         [STAThread]
31
         private static void Main()
43
         private static void Main()

+ 5
- 17
XHWK.WKTool/CountdownWindow.xaml.cs View File

1
-using AForge.Imaging;
2
-using Common.system;
3
-using System;
4
-using System.Collections.Generic;
5
-using System.Linq;
6
-using System.Text;
7
-using System.Threading;
8
-using System.Threading.Tasks;
1
+using System;
9
 using System.Windows;
2
 using System.Windows;
10
 using System.Windows.Controls;
3
 using System.Windows.Controls;
11
-using System.Windows.Data;
12
-using System.Windows.Documents;
13
-using System.Windows.Input;
14
-using System.Windows.Media;
15
-using System.Windows.Media.Imaging;
16
-using System.Windows.Shapes;
17
 using System.Windows.Threading;
4
 using System.Windows.Threading;
18
 
5
 
19
 namespace XHWK.WKTool
6
 namespace XHWK.WKTool
35
             //this.Hide();
22
             //this.Hide();
36
             //MediaElement.Position
23
             //MediaElement.Position
37
             //((MediaElement)((object)ImgGif)).Position= TimeSpan.Zero;
24
             //((MediaElement)((object)ImgGif)).Position= TimeSpan.Zero;
38
-            timer = new DispatcherTimer();
39
-            timer.Interval = TimeSpan.FromMilliseconds(2500);
25
+            timer = new DispatcherTimer
26
+            {
27
+                Interval = TimeSpan.FromMilliseconds(2500)
28
+            };
40
             timer.Tick += Timer_Tick;
29
             timer.Tick += Timer_Tick;
41
             timer.Start();
30
             timer.Start();
42
         }
31
         }
66
 
55
 
67
         private void Image_MediaEnded(object sender, RoutedEventArgs e)
56
         private void Image_MediaEnded(object sender, RoutedEventArgs e)
68
         {
57
         {
69
-            System.Windows.Controls.Image img = (System.Windows.Controls.Image)sender;
70
             ((MediaElement)sender).Position = ((MediaElement)sender).Position.Add(TimeSpan.FromMilliseconds(10000));
58
             ((MediaElement)sender).Position = ((MediaElement)sender).Position.Add(TimeSpan.FromMilliseconds(10000));
71
         }
59
         }
72
     }
60
     }

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

22
             <Border Grid.Row="0" Background="#2D8CF0">
22
             <Border Grid.Row="0" Background="#2D8CF0">
23
                 <Grid>
23
                 <Grid>
24
                     <TextBlock Text="创建微课" Foreground="#FFFFFF" FontSize="16" Padding="10,13,0,0"/>
24
                     <TextBlock Text="创建微课" Foreground="#FFFFFF" FontSize="16" Padding="10,13,0,0"/>
25
-                    <Button Grid.Row="0" x:Name="btnDown" Content="×" Foreground="#FFFFFF" FontSize="25" Padding="10,0,10,0" HorizontalAlignment="Right" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Click="btnDown_Click"/>
25
+                    <Button Grid.Row="0" x:Name="btnDown" Content="×" Foreground="#FFFFFF" FontSize="25" Padding="10,0,10,0" HorizontalAlignment="Right" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Click="BtnDown_Click"/>
26
                 </Grid>
26
                 </Grid>
27
             </Border>
27
             </Border>
28
             <!--第二行 讲解名称-->
28
             <!--第二行 讲解名称-->
31
                 <TextBlock Text="讲解名称" FontSize="18" Padding="2,15,10,0"/>
31
                 <TextBlock Text="讲解名称" FontSize="18" Padding="2,15,10,0"/>
32
                 <!--输入框-->
32
                 <!--输入框-->
33
                 <Border Background="#CDD6E0" Width="321" Height="43" CornerRadius="3">
33
                 <Border Background="#CDD6E0" Width="321" Height="43" CornerRadius="3">
34
-                    <TextBox x:Name="txbExplainName" Text="微课1" FontSize="16" Foreground="#333333" Padding="5,12,2,2" Width="319" Height="42" BorderBrush="{x:Null}" BorderThickness="0"/>
34
+                    <TextBox x:Name="txbExplainName" Text="" FontSize="16" Foreground="#333333" Padding="5,12,2,2" Width="319" Height="42" BorderBrush="{x:Null}" BorderThickness="0"/>
35
                 </Border>
35
                 </Border>
36
             </StackPanel>
36
             </StackPanel>
37
             <!--第三行 存放路径-->
37
             <!--第三行 存放路径-->
40
                 <TextBlock Text="存放路径" FontSize="18" Padding="2,15,10,0"/>
40
                 <TextBlock Text="存放路径" FontSize="18" Padding="2,15,10,0"/>
41
                 <!--输入框-->
41
                 <!--输入框-->
42
                 <Border Background="#CDD6E0" Width="225" Height="43" CornerRadius="3">
42
                 <Border Background="#CDD6E0" Width="225" Height="43" CornerRadius="3">
43
-                    <TextBox x:Name="txbStoragePath" Text="D:\" FontSize="16" Foreground="#333333" Padding="5,12,2,2" Width="223" Height="42" BorderBrush="{x:Null}" BorderThickness="0"/>
43
+                    <TextBox x:Name="txbStoragePath" Text="D:\星火微课" FontSize="16" Foreground="#333333" Padding="5,12,2,2" Width="223" Height="42" BorderBrush="{x:Null}" BorderThickness="0"/>
44
                 </Border>
44
                 </Border>
45
                 <!--浏览按钮-->
45
                 <!--浏览按钮-->
46
-                <Button x:Name="btnBrowse" Content="浏览" FontSize="18" Width="80" Height="43" Margin="18,0,0,0" Click="btnBrowse_Click">
46
+                <Button x:Name="btnBrowse" Content="浏览" FontSize="18" Width="80" Height="43" Margin="18,0,0,0" Click="BtnBrowse_Click">
47
                     <Button.Template>
47
                     <Button.Template>
48
                         <ControlTemplate TargetType="{x:Type Button}">
48
                         <ControlTemplate TargetType="{x:Type Button}">
49
                             <Border
49
                             <Border
61
                 </Button>
61
                 </Button>
62
             </StackPanel>
62
             </StackPanel>
63
             <!--第四行 开始按钮-->
63
             <!--第四行 开始按钮-->
64
-            <Button Grid.Row="3" x:Name="btnStart" Content="开始" FontSize="18" Foreground="#FFFFFF" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Width="418" Height="43" Margin="10,0,10,0" Click="btnStart_Click">
64
+            <Button Grid.Row="3" x:Name="btnStart" Content="开始" FontSize="18" Foreground="#FFFFFF" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Width="418" Height="43" Margin="10,0,10,0" Click="BtnStart_Click">
65
                 <Button.Template>
65
                 <Button.Template>
66
                     <ControlTemplate TargetType="{x:Type Button}">
66
                     <ControlTemplate TargetType="{x:Type Button}">
67
                         <Border
67
                         <Border

+ 45
- 16
XHWK.WKTool/CreateAMicroLessonWindow.xaml.cs View File

1
-using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4
-using System.Text;
5
-using System.Threading.Tasks;
1
+using Common.system;
2
+
3
+using System;
6
 using System.Windows;
4
 using System.Windows;
7
-using System.Windows.Controls;
8
-using System.Windows.Data;
9
-using System.Windows.Documents;
10
 using System.Windows.Forms;
5
 using System.Windows.Forms;
11
 using System.Windows.Input;
6
 using System.Windows.Input;
12
-using System.Windows.Media;
13
-using System.Windows.Media.Imaging;
14
-using System.Windows.Navigation;
15
-using System.Windows.Shapes;
16
 
7
 
17
 namespace XHWK.WKTool
8
 namespace XHWK.WKTool
18
 {
9
 {
19
     /// <summary>
10
     /// <summary>
20
     /// 创建微课
11
     /// 创建微课
21
     /// </summary>
12
     /// </summary>
22
-    public partial class CreateAMicroLessonWindow : Window 
13
+    public partial class CreateAMicroLessonWindow : Window
23
     {
14
     {
24
         #region 字段
15
         #region 字段
25
         private FolderBrowserDialog ofd;
16
         private FolderBrowserDialog ofd;
32
         public CreateAMicroLessonWindow()
23
         public CreateAMicroLessonWindow()
33
         {
24
         {
34
             InitializeComponent();
25
             InitializeComponent();
26
+            txbStoragePath.Text = FileToolsCommon.GetConfigValue("VideoSavePath");
35
         }
27
         }
36
 
28
 
37
         #region 事件
29
         #region 事件
40
         /// </summary>
32
         /// </summary>
41
         /// <param name="sender"></param>
33
         /// <param name="sender"></param>
42
         /// <param name="e"></param>
34
         /// <param name="e"></param>
43
-        private void btnDown_Click(object sender, RoutedEventArgs e)
35
+        private void BtnDown_Click(object sender, RoutedEventArgs e)
44
         {
36
         {
45
 
37
 
46
         }
38
         }
49
         /// </summary>
41
         /// </summary>
50
         /// <param name="sender"></param>
42
         /// <param name="sender"></param>
51
         /// <param name="e"></param>
43
         /// <param name="e"></param>
52
-        private void btnBrowse_Click(object sender, RoutedEventArgs e)
44
+        private void BtnBrowse_Click(object sender, RoutedEventArgs e)
53
         {
45
         {
54
             string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
46
             string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
55
             ofd = new System.Windows.Forms.FolderBrowserDialog();
47
             ofd = new System.Windows.Forms.FolderBrowserDialog();
71
         /// </summary>
63
         /// </summary>
72
         /// <param name="sender"></param>
64
         /// <param name="sender"></param>
73
         /// <param name="e"></param>
65
         /// <param name="e"></param>
74
-        private void btnStart_Click(object sender, RoutedEventArgs e)
66
+        private void BtnStart_Click(object sender, RoutedEventArgs e)
75
         {
67
         {
68
+            #region 合法性判断
69
+            if (string.IsNullOrWhiteSpace(txbExplainName.Text.Trim()))
70
+            {
71
+                System.Windows.MessageBox.Show("讲解名称不可为空!");
72
+                return;
73
+            }
74
+            if (string.IsNullOrWhiteSpace(txbStoragePath.Text.Trim()))
75
+            {
76
+                System.Windows.MessageBox.Show("路径不可为空!");
77
+                return;
78
+            }
79
+            if (!FileToolsCommon.IsLegalPath(txbExplainName.Text.Trim(), out string ErrMessage))
80
+            {
81
+                System.Windows.MessageBox.Show(ErrMessage);
82
+            }
83
+            string PathName = FileToolsCommon.GetLegalPath(txbStoragePath.Text) + txbExplainName.Text.Trim() + "/";
84
+            if (FileToolsCommon.IsExistDirectory(PathName))
85
+            {
86
+                //微课已存在
87
+                MessageBoxResult dr = System.Windows.MessageBox.Show("讲解已存在是否覆盖?", "提示", MessageBoxButton.OKCancel);
88
+                if (dr == MessageBoxResult.OK)
89
+                {
90
+                    FileToolsCommon.DeleteDirectory(PathName);
91
+                }
92
+                else
93
+                {
94
+                    return;
95
+                }
96
+            }
97
+            #endregion
98
+            //创建文件夹
99
+            FileToolsCommon.CreateDirectory(PathName);
100
+            //存储文件
101
+            FileToolsCommon.SetConfigValue("VideoSavePath", txbStoragePath.Text);
102
+            APP.WkName = txbExplainName.Text;
103
+            APP.WkSavePath = PathName;
104
+            FileToolsCommon.CreateDirectory(APP.WkSavePath);
76
             if (APP.W_XHMicroLessonSystemWindow == null)
105
             if (APP.W_XHMicroLessonSystemWindow == null)
77
             {
106
             {
78
                 APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();
107
                 APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();

+ 1
- 12
XHWK.WKTool/FileDirectoryWindow.xaml.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
-using System.Windows;
7
-using System.Windows.Controls;
8
-using System.Windows.Data;
9
-using System.Windows.Documents;
1
+using System.Windows;
10
 using System.Windows.Input;
2
 using System.Windows.Input;
11
-using System.Windows.Media;
12
-using System.Windows.Media.Imaging;
13
-using System.Windows.Shapes;
14
 
3
 
15
 namespace XHWK.WKTool
4
 namespace XHWK.WKTool
16
 {
5
 {

+ 1
- 13
XHWK.WKTool/LoginWindow.xaml.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
-using System.Windows;
7
-using System.Windows.Controls;
8
-using System.Windows.Data;
9
-using System.Windows.Documents;
10
-using System.Windows.Input;
11
-using System.Windows.Media;
12
-using System.Windows.Media.Imaging;
13
-using System.Windows.Shapes;
1
+using System.Windows;
14
 
2
 
15
 namespace XHWK.WKTool
3
 namespace XHWK.WKTool
16
 {
4
 {

+ 0
- 2
XHWK.WKTool/Properties/AssemblyInfo.cs View File

1
 using System.Reflection;
1
 using System.Reflection;
2
-using System.Resources;
3
-using System.Runtime.CompilerServices;
4
 using System.Runtime.InteropServices;
2
 using System.Runtime.InteropServices;
5
 using System.Windows;
3
 using System.Windows;
6
 
4
 

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

73
                 <Image Grid.Row="1"  Source="./Images/Toobar0.png"/>
73
                 <Image Grid.Row="1"  Source="./Images/Toobar0.png"/>
74
             <TextBlock Grid.Row="1" Text="01:35" FontSize="23" Foreground="#FFFFFF" Margin="30,50,0,0"/>
74
             <TextBlock Grid.Row="1" Text="01:35" FontSize="23" Foreground="#FFFFFF" Margin="30,50,0,0"/>
75
             <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,15,0">
75
             <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,15,0">
76
-                <Button  Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="0,0,15,0">
76
+                <Button x:Name="BtnRecordingScreen"  Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="0,0,15,0" Click="BtnRecordingScreen_Click">
77
                     <Image Source="./Images/Toobar25.png"/>
77
                     <Image Source="./Images/Toobar25.png"/>
78
                 </Button>
78
                 </Button>
79
                 <Button x:Name="BtnStopRecordingScreen" Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="0,0,15,0" Click="BtnStopRecordingScreen_Click">
79
                 <Button x:Name="BtnStopRecordingScreen" Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="0,0,15,0" Click="BtnStopRecordingScreen_Click">

+ 113
- 25
XHWK.WKTool/ScreenRecordingToolbarWindow.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.Linq;
5
-using System.Text;
6
-using System.Threading.Tasks;
7
 using System.Windows;
4
 using System.Windows;
8
-using System.Windows.Controls;
9
-using System.Windows.Data;
10
-using System.Windows.Documents;
11
-using System.Windows.Input;
12
-using System.Windows.Media;
13
-using System.Windows.Media.Imaging;
14
-using System.Windows.Shapes;
5
+
6
+using XHWK.Model;
15
 
7
 
16
 namespace XHWK.WKTool
8
 namespace XHWK.WKTool
17
 {
9
 {
20
     /// </summary>
12
     /// </summary>
21
     public partial class ScreenRecordingToolbarWindow : Window
13
     public partial class ScreenRecordingToolbarWindow : Window
22
     {
14
     {
15
+        #region 初始变量
16
+        /// <summary>
17
+        /// 视频存储路径
18
+        /// </summary>
19
+        string RSPath;
20
+        /// <summary>
21
+        /// 是否正在录制
22
+        /// </summary>
23
+        bool IsStartRS = false;
24
+        /// <summary>
25
+        /// 是否暂停
26
+        /// </summary>
27
+        bool IsSuspend = true;
28
+        /// <summary>
29
+        /// 录屏
30
+        /// </summary>
31
+        FFMpeg Ffmpeg = null;
32
+        #endregion
33
+
34
+        #region 初始化
35
+        /// <summary>
36
+        /// 录屏工具栏
37
+        /// </summary>
23
         public ScreenRecordingToolbarWindow()
38
         public ScreenRecordingToolbarWindow()
24
         {
39
         {
25
             InitializeComponent();
40
             InitializeComponent();
26
         }
41
         }
42
+        /// <summary>
43
+        /// 初始化
44
+        /// </summary>
27
         public void Initialize()
45
         public void Initialize()
28
         {
46
         {
47
+            //隐藏画笔工具栏
29
             BtnToolbarDown_Click(null, null);
48
             BtnToolbarDown_Click(null, null);
49
+            IsStartRS = false;
50
+            IsSuspend = true;
51
+            RSPath = null;
52
+            if (Ffmpeg == null)
53
+            {
54
+                Ffmpeg = new FFMpeg();
55
+            }
56
+        }
57
+        #endregion
58
+
59
+        #region 录制
60
+        /// <summary>
61
+        /// 停止录像
62
+        /// </summary>
63
+        /// <param name="sender"></param>
64
+        /// <param name="e"></param>
65
+        private void BtnStopRecordingScreen_Click(object sender, RoutedEventArgs e)
66
+        {
67
+            if (APP.W_XHMicroLessonSystemWindow == null)
68
+            {
69
+                APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();
70
+            }
71
+            APP.W_XHMicroLessonSystemWindow.Show();
72
+            try
73
+            {
74
+                Ffmpeg.StopFFmpeg(RSPath);
75
+            }
76
+            catch (Exception ex)
77
+            {
78
+                MessageBox.Show(ex.Message);
79
+            }
80
+            IsStartRS = false;
81
+            Hide();
82
+        }
83
+        /// <summary>
84
+        /// 开始或暂停录制
85
+        /// </summary>
86
+        /// <param name="sender"></param>
87
+        /// <param name="e"></param>
88
+        private void BtnRecordingScreen_Click(object sender, RoutedEventArgs e)
89
+        {
90
+            if (IsSuspend)
91
+            {
92
+                if(IsStartRS)
93
+                {
94
+                }
95
+                //timer = new DispatcherTimer();
96
+                //timer.Interval = TimeSpan.FromMilliseconds(1000);
97
+                //timer.Tick += Timer_Tick;//你的事件
98
+                //dt = Convert.ToDateTime("2020-01-01 00:00:00");
99
+                //FileToolsCommon.DeleteDirectory(RSPath);
100
+                IsSuspend = false;
101
+                IsStartRS = true;
102
+                BtnRecordingScreen.Content = "暂停录制";
103
+                try
104
+                {
105
+                    RSPath = APP.WkSavePath;
106
+                    FileToolsCommon.CreateDirectory(RSPath);
107
+                    RSPath += "." + ((Emum_VideoType)int.Parse(FileToolsCommon.GetConfigValue("VideoType"))).ToString();
108
+                    Ffmpeg.StartRecordingVideo(RSPath);
109
+                }
110
+                catch (Exception ex)
111
+                {
112
+                    MessageBox.Show(ex.Message);
113
+                }
114
+            }
115
+            else
116
+            {
117
+                IsSuspend = true;
118
+                try
119
+                {
120
+                    Ffmpeg.SuspendFFmpeg();
121
+                    Ffmpeg.StopFFmpeg(RSPath);
122
+                }
123
+                catch (Exception ex)
124
+                {
125
+                    MessageBox.Show(ex.Message);
126
+                }
127
+            }
30
         }
128
         }
129
+        #endregion
130
+
131
+        #region 画笔相关
31
         /// <summary>
132
         /// <summary>
32
         /// 画笔工具栏关闭事件
133
         /// 画笔工具栏关闭事件
33
         /// </summary>
134
         /// </summary>
75
             gridColour.Visibility = Visibility.Visible;
176
             gridColour.Visibility = Visibility.Visible;
76
             gridThickness.Visibility = Visibility.Collapsed;
177
             gridThickness.Visibility = Visibility.Collapsed;
77
         }
178
         }
78
-        /// <summary>
79
-        /// 停止录像
80
-        /// </summary>
81
-        /// <param name="sender"></param>
82
-        /// <param name="e"></param>
83
-        private void BtnStopRecordingScreen_Click(object sender, RoutedEventArgs e)
84
-        {
85
-            if(APP.W_XHMicroLessonSystemWindow==null)
86
-            {
87
-                APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();
88
-            }
89
-            APP.W_XHMicroLessonSystemWindow.Show();
90
-            Hide();
91
-        }
179
+        #endregion
92
     }
180
     }
93
 }
181
 }

+ 1
- 13
XHWK.WKTool/UCCamera.xaml.cs View File

1
 using Common.system;
1
 using Common.system;
2
-using System;
3
-using System.Collections.Generic;
4
-using System.Linq;
5
-using System.Text;
6
-using System.Threading.Tasks;
2
+
7
 using System.Windows;
3
 using System.Windows;
8
-using System.Windows.Controls;
9
-using System.Windows.Data;
10
-using System.Windows.Documents;
11
-using System.Windows.Input;
12
-using System.Windows.Media;
13
-using System.Windows.Media.Imaging;
14
-using System.Windows.Navigation;
15
-using System.Windows.Shapes;
16
 
4
 
17
 namespace XHWK.WKTool
5
 namespace XHWK.WKTool
18
 {
6
 {

+ 1
- 1
XHWK.WKTool/XHMicroLessonSystemWindow.xaml View File

170
                         <TextBox x:Name="txbStoragePath" Text="D:\" FontSize="16" Foreground="#333333" Padding="5,12,2,2" Width="523" Height="42" BorderBrush="{x:Null}" BorderThickness="0"/>
170
                         <TextBox x:Name="txbStoragePath" Text="D:\" FontSize="16" Foreground="#333333" Padding="5,12,2,2" Width="523" Height="42" BorderBrush="{x:Null}" BorderThickness="0"/>
171
                     </Border>
171
                     </Border>
172
                     <!--浏览按钮-->
172
                     <!--浏览按钮-->
173
-                    <Button Cursor="Hand" x:Name="btnBrowse" Content="浏览" FontSize="18" Width="80" Height="43" Margin="18,0,0,0" Click="btnBrowse_Click">
173
+                    <Button Cursor="Hand" x:Name="btnBrowse" Content="浏览" FontSize="18" Width="80" Height="43" Margin="18,0,0,0" Click="BtnBrowse_Click">
174
                         <Button.Template>
174
                         <Button.Template>
175
                             <ControlTemplate TargetType="{x:Type Button}">
175
                             <ControlTemplate TargetType="{x:Type Button}">
176
                                 <Border
176
                                 <Border

+ 8
- 14
XHWK.WKTool/XHMicroLessonSystemWindow.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.Linq;
5
-using System.Text;
6
-using System.Threading.Tasks;
7
 using System.Windows;
4
 using System.Windows;
8
-using System.Windows.Controls;
9
-using System.Windows.Data;
10
-using System.Windows.Documents;
11
 using System.Windows.Forms;
5
 using System.Windows.Forms;
12
 using System.Windows.Ink;
6
 using System.Windows.Ink;
13
 using System.Windows.Input;
7
 using System.Windows.Input;
14
 using System.Windows.Media;
8
 using System.Windows.Media;
15
-using System.Windows.Media.Imaging;
16
-using System.Windows.Shapes;
17
 
9
 
18
 namespace XHWK.WKTool
10
 namespace XHWK.WKTool
19
 {
11
 {
51
             //InkCanvas 通过 DefaultDrawingAttributes 属性来获取墨迹的各种设置,该属性的类型为 DrawingAttributes 型  
43
             //InkCanvas 通过 DefaultDrawingAttributes 属性来获取墨迹的各种设置,该属性的类型为 DrawingAttributes 型  
52
             blackboard_canvas.DefaultDrawingAttributes = drawingAttributes;
44
             blackboard_canvas.DefaultDrawingAttributes = drawingAttributes;
53
             drawingAttributes.FitToCurve = true;
45
             drawingAttributes.FitToCurve = true;
54
-        } 
46
+        }
55
         #endregion
47
         #endregion
56
 
48
 
57
         #region 事件
49
         #region 事件
118
 
110
 
119
             if (APP.W_ScreenRecordingToolbarWindow == null)
111
             if (APP.W_ScreenRecordingToolbarWindow == null)
120
             {
112
             {
121
-                APP.W_ScreenRecordingToolbarWindow = new ScreenRecordingToolbarWindow();
122
-                APP.W_ScreenRecordingToolbarWindow.Topmost = true;
113
+                APP.W_ScreenRecordingToolbarWindow = new ScreenRecordingToolbarWindow
114
+                {
115
+                    Topmost = true
116
+                };
123
                 APP.W_ScreenRecordingToolbarWindow.Initialize();
117
                 APP.W_ScreenRecordingToolbarWindow.Initialize();
124
 
118
 
125
             }
119
             }
177
         /// </summary>
171
         /// </summary>
178
         /// <param name="sender"></param>
172
         /// <param name="sender"></param>
179
         /// <param name="e"></param>
173
         /// <param name="e"></param>
180
-        private void btnBrowse_Click(object sender, RoutedEventArgs e)
174
+        private void BtnBrowse_Click(object sender, RoutedEventArgs e)
181
         {
175
         {
182
             string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
176
             string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
183
             Ofd = new System.Windows.Forms.FolderBrowserDialog();
177
             Ofd = new System.Windows.Forms.FolderBrowserDialog();
218
         /// <param name="e"></param>
212
         /// <param name="e"></param>
219
         private void BtnRed_Click(object sender, RoutedEventArgs e)
213
         private void BtnRed_Click(object sender, RoutedEventArgs e)
220
         {
214
         {
221
-        
215
+
222
             //设置 DrawingAttributes 的 Color 属性设置颜色  
216
             //设置 DrawingAttributes 的 Color 属性设置颜色  
223
             drawingAttributes.Color = Colors.Red;
217
             drawingAttributes.Color = Colors.Red;
224
         }
218
         }

Loading…
Cancel
Save