Browse Source

zhao:修改FFMPEG类

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

+ 132
- 31
Common/system/FFMpeg.cs View File

17
     /// </summary>
17
     /// </summary>
18
     public class FFMpeg
18
     public class FFMpeg
19
     {
19
     {
20
-        Process myProcess = null;
20
+        public Process myProcess = null;
21
         /// <summary>
21
         /// <summary>
22
         /// ffmpeg输出日志文件地址  每个文件2MB左右
22
         /// ffmpeg输出日志文件地址  每个文件2MB左右
23
         /// </summary>
23
         /// </summary>
28
         /// <param name="FilePath">文件存储路径</param>
28
         /// <param name="FilePath">文件存储路径</param>
29
         public void StartRecordingVideo(string FilePath)
29
         public void StartRecordingVideo(string FilePath)
30
         {
30
         {
31
+            while (myProcess != null)
32
+            {
33
+                Thread.Sleep(100);
34
+            }
31
             //路径
35
             //路径
32
-            string Path = FileToolsCommon.GetDirectoryName(FilePath) + @"\";
36
+            string Path = FileToolsCommon.GetDirectoryName(FilePath);
33
             string Extension = FileToolsCommon.GetIOExtension(FilePath);//扩展名
37
             string Extension = FileToolsCommon.GetIOExtension(FilePath);//扩展名
34
             //文件保存路径
38
             //文件保存路径
35
             string PathName = GetFilePathName(FilePath);
39
             string PathName = GetFilePathName(FilePath);
36
             Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
40
             Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
37
-            Debug.WriteLine(KillProcessArray.Length.ToString());
38
             foreach (var KillProcess in KillProcessArray)
41
             foreach (var KillProcess in KillProcessArray)
39
             {
42
             {
40
                 KillProcess.Kill();
43
                 KillProcess.Kill();
95
         /// <param name="Mp3Path">MP3音频位置</param>
98
         /// <param name="Mp3Path">MP3音频位置</param>
96
         public void StartRecordingAudio(string Mp3Path)
99
         public void StartRecordingAudio(string Mp3Path)
97
         {
100
         {
101
+            while (myProcess != null)
102
+            {
103
+                Thread.Sleep(100);
104
+            }
105
+            //文件保存路径
106
+            string PathName = GetFilePathName(Mp3Path);
98
             Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
107
             Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
99
-            Debug.WriteLine(KillProcessArray.Length.ToString());
100
             foreach (var KillProcess in KillProcessArray)
108
             foreach (var KillProcess in KillProcessArray)
101
             {
109
             {
102
                 KillProcess.Kill();
110
                 KillProcess.Kill();
107
             string MicrophoneName = GetMicrophone();
115
             string MicrophoneName = GetMicrophone();
108
             if (string.IsNullOrWhiteSpace(MicrophoneName))
116
             if (string.IsNullOrWhiteSpace(MicrophoneName))
109
             {
117
             {
110
-                myProcess.StartInfo.Arguments = "-f dshow -i audio=\"virtual-audio-capturer\" " + Mp3Path;
118
+                myProcess.StartInfo.Arguments = "-f dshow -i audio=\"virtual-audio-capturer\" " + PathName;
111
             }
119
             }
112
             else
120
             else
113
             {
121
             {
114
                 myProcess.StartInfo.Arguments = "-f dshow -i audio=\"virtual-audio-capturer\"  -f dshow -i audio=\"" +
122
                 myProcess.StartInfo.Arguments = "-f dshow -i audio=\"virtual-audio-capturer\"  -f dshow -i audio=\"" +
115
-                        MicrophoneName + "\" -filter_complex amix=inputs=2:duration=first:dropout_transition=2 " + Mp3Path;
123
+                        MicrophoneName + "\" -filter_complex amix=inputs=2:duration=first:dropout_transition=2 " + PathName;
116
             }
124
             }
117
             myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
125
             myProcess.StartInfo.UseShellExecute = false;           //不使用操作系统外壳程序启动
118
             myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
126
             myProcess.StartInfo.RedirectStandardError = true;      //重定向标准错误输出
127
         /// <summary>
135
         /// <summary>
128
         /// 暂停录制
136
         /// 暂停录制
129
         /// </summary>
137
         /// </summary>
130
-        public void SuspendFFmpeg()
138
+        public bool SuspendFFmpeg()
131
         {
139
         {
132
-            if (myProcess == null)
133
-                return;
134
-            myProcess.StandardInput.WriteLine("q");//在这个进程的控制台中模拟输入q,用于暂停录制
135
-            myProcess.Close();//关闭进程
136
-            myProcess.Dispose();//释放资源
140
+            if (myProcess != null)
141
+            {
142
+                myProcess.StandardInput.WriteLine("q");//在这个进程的控制台中模拟输入q,用于暂停录制
143
+                myProcess.Close();//关闭进程
144
+                myProcess.Dispose();//释放资源
145
+            }
146
+            #region 进程是否已经释放
147
+            bool IsRunning = true;
148
+            while (IsRunning)
149
+            {
150
+                IsRunning = false;
151
+                Process[] ProcessArray = Process.GetProcessesByName("ffmpeg");
152
+                foreach (var KillProcess in ProcessArray)
153
+                {
154
+                    IsRunning = true;
155
+                    Thread.Sleep(100);
156
+                }
157
+            }
158
+            #endregion
137
             myProcess = null;
159
             myProcess = null;
160
+            return true;
138
             //myProcess.Kill();
161
             //myProcess.Kill();
139
         }
162
         }
140
 
163
 
142
         /// 停止录制并合成文件
165
         /// 停止录制并合成文件
143
         /// </summary>
166
         /// </summary>
144
         /// <param name="FilePath">文件存储路径 必须与开始时的路径完全一致</param>
167
         /// <param name="FilePath">文件存储路径 必须与开始时的路径完全一致</param>
145
-        public void StopFFmpeg(string FilePath)
168
+        public bool StopFFmpeg(string FilePath)
146
         {
169
         {
147
             //文件完整路径
170
             //文件完整路径
148
-            if (myProcess == null)
149
-                return;
150
-            myProcess.StandardInput.WriteLine("q");//在这个进程的控制台中模拟输入q,用于暂停录制
151
-            myProcess.Close();//关闭进程
152
-            myProcess.Dispose();//释放资源
171
+            if (myProcess != null)
172
+            {
173
+                myProcess.StandardInput.WriteLine("q");//在这个进程的控制台中模拟输入q,用于暂停录制
174
+                myProcess.Close();//关闭进程
175
+                myProcess.Dispose();//释放资源
176
+            }
177
+            #region 进程是否已经释放
178
+            bool IsRunning = true;
179
+            while (IsRunning)
180
+            {
181
+                IsRunning = false;
182
+                Process[] ProcessArray = Process.GetProcessesByName("ffmpeg");
183
+                foreach (var KillProcess in ProcessArray)
184
+                {
185
+                    IsRunning = true;
186
+                    Thread.Sleep(100);
187
+                }
188
+            }
189
+            #endregion
153
             myProcess = null;
190
             myProcess = null;
154
             Thread t1 = new Thread(MergeVideoOrAudio);
191
             Thread t1 = new Thread(MergeVideoOrAudio);
155
             t1.Start(FilePath);
192
             t1.Start(FilePath);
193
+            return true;
156
             //文件合成
194
             //文件合成
157
         }
195
         }
158
 
196
 
167
         /// <param name="VideoHeight">视频高度</param>
205
         /// <param name="VideoHeight">视频高度</param>
168
         public void SynthesisVideo(string ImageListPath, string Mp3Path, string VideoSavePath, int Frequency, int VideoWidth, int VideoHeight)
206
         public void SynthesisVideo(string ImageListPath, string Mp3Path, string VideoSavePath, int Frequency, int VideoWidth, int VideoHeight)
169
         {
207
         {
170
-            Thread thread = new Thread(delegate ()
208
+            new Thread(new ThreadStart(new Action(() =>
171
             {
209
             {
172
-                //// 允许不同线程间的调用
173
-                //Control.CheckForIllegalCrossThreadCalls = false;
174
                 Thread.Sleep(500);
210
                 Thread.Sleep(500);
211
+                while (myProcess != null)
212
+                {
213
+                    Thread.Sleep(100);
214
+                }
175
                 string Extension = FileToolsCommon.GetIOExtension(VideoSavePath);//扩展名
215
                 string Extension = FileToolsCommon.GetIOExtension(VideoSavePath);//扩展名
176
                 Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
216
                 Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
177
-                Debug.WriteLine(KillProcessArray.Length.ToString());
217
+                //Debug.WriteLine(KillProcessArray.Length.ToString());
178
                 foreach (var KillProcess in KillProcessArray)
218
                 foreach (var KillProcess in KillProcessArray)
179
                 {
219
                 {
180
                     KillProcess.Kill();
220
                     KillProcess.Kill();
220
                 myProcess.WaitForExit();           //阻塞等待进程结束
260
                 myProcess.WaitForExit();           //阻塞等待进程结束
221
                 myProcess.Close();                 //关闭进程
261
                 myProcess.Close();                 //关闭进程
222
                 myProcess.Dispose();               //释放资源
262
                 myProcess.Dispose();               //释放资源
223
-                                                   //生成视频后删除图片保存列表
224
-                FileToolsCommon.DeleteDirectory(ImageListPath);
225
-            });
263
+                #region 进程是否已经释放
264
+                bool IsRunning = true;
265
+                while (IsRunning)
266
+                {
267
+                    IsRunning = false;
268
+                    Process[] ProcessArray = Process.GetProcessesByName("ffmpeg");
269
+                    foreach (var KillProcess in ProcessArray)
270
+                    {
271
+                        IsRunning = true;
272
+                        Thread.Sleep(100);
273
+                    }
274
+                }
275
+                #endregion
276
+                myProcess = null;
277
+                //生成视频后删除图片和音频保存列表
278
+                //FileToolsCommon.DeleteDirectory(ImageListPath);
279
+                //FileToolsCommon.DeleteDirectory(FileToolsCommon.GetDirectoryName(Mp3Path));
280
+
281
+                //Dispatcher.Invoke(() =>
282
+                //{
283
+                //});
284
+                //// 允许不同线程间的调用
285
+                //Control.CheckForIllegalCrossThreadCalls = false;
286
+            }))).Start();
226
         }
287
         }
227
 
288
 
228
         /// <summary>
289
         /// <summary>
229
         /// 视频音频合成
290
         /// 视频音频合成
230
         /// </summary>
291
         /// </summary>
231
         /// <param name="FilePath">存储路径</param>
292
         /// <param name="FilePath">存储路径</param>
232
-        void MergeVideoOrAudio(object FilePathobj)
293
+        public void MergeVideoOrAudio(object FilePathobj)
233
         {
294
         {
234
-            Thread.Sleep(500);
295
+            //new Thread(new ThreadStart(new Action(() =>
296
+            //{
297
+            //Dispatcher.Invoke(() =>
298
+            //{
299
+            //});
300
+            //}))).Start();
301
+
302
+            while (myProcess != null)
303
+            {
304
+                Thread.Sleep(100);
305
+            }
235
             //路径
306
             //路径
236
             string FilePath = (string)FilePathobj;
307
             string FilePath = (string)FilePathobj;
237
-            string Path = FileToolsCommon.GetDirectoryName(FilePath) + @"\";
308
+            string Path = FileToolsCommon.GetDirectoryName(FilePath);
238
             Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
309
             Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
239
-            Debug.WriteLine(KillProcessArray.Length.ToString());
240
             foreach (var KillProcess in KillProcessArray)
310
             foreach (var KillProcess in KillProcessArray)
241
             {
311
             {
242
                 KillProcess.Kill();
312
                 KillProcess.Kill();
256
             myProcess.WaitForExit();           //阻塞等待进程结束
326
             myProcess.WaitForExit();           //阻塞等待进程结束
257
             myProcess.Close();                 //关闭进程
327
             myProcess.Close();                 //关闭进程
258
             myProcess.Dispose();               //释放资源
328
             myProcess.Dispose();               //释放资源
329
+            #region 进程是否已经释放
330
+            bool IsRunning = true;
331
+            while (IsRunning)
332
+            {
333
+                IsRunning = false;
334
+                Process[] ProcessArray = Process.GetProcessesByName("ffmpeg");
335
+                foreach (var KillProcess in ProcessArray)
336
+                {
337
+                    IsRunning = true;
338
+                    Thread.Sleep(100);
339
+                }
340
+            }
341
+            #endregion
342
+            myProcess = null;
259
         }
343
         }
260
 
344
 
261
         /// <summary>
345
         /// <summary>
266
         string GetFilePathName(string FilePath)
350
         string GetFilePathName(string FilePath)
267
         {
351
         {
268
             //路径
352
             //路径
269
-            string Path = FileToolsCommon.GetDirectoryName(FilePath) + @"\";
353
+            string Path = FileToolsCommon.GetDirectoryName(FilePath);
270
             //Path.GetFileName(FilePath);//获取文件名
354
             //Path.GetFileName(FilePath);//获取文件名
271
             string Extension = FileToolsCommon.GetIOExtension(FilePath);//扩展名
355
             string Extension = FileToolsCommon.GetIOExtension(FilePath);//扩展名
272
             string tempFilePath = Path + "temp/";
356
             string tempFilePath = Path + "temp/";
295
         /// <param name="ImagePath">图片地址</param>
379
         /// <param name="ImagePath">图片地址</param>
296
         public void GenerateThumbnails(string VideoPath, string ImagePath)
380
         public void GenerateThumbnails(string VideoPath, string ImagePath)
297
         {
381
         {
382
+            while (myProcess != null)
383
+            {
384
+                Thread.Sleep(100);
385
+            }
298
             Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
386
             Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
299
-            Debug.WriteLine(KillProcessArray.Length.ToString());
300
             foreach (var KillProcess in KillProcessArray)
387
             foreach (var KillProcess in KillProcessArray)
301
             {
388
             {
302
                 KillProcess.Kill();
389
                 KillProcess.Kill();
317
             myProcess.WaitForExit();           //阻塞等待进程结束
404
             myProcess.WaitForExit();           //阻塞等待进程结束
318
             myProcess.Close();                 //关闭进程
405
             myProcess.Close();                 //关闭进程
319
             myProcess.Dispose();               //释放资源
406
             myProcess.Dispose();               //释放资源
407
+            #region 进程是否已经释放
408
+            bool IsRunning = true;
409
+            while (IsRunning)
410
+            {
411
+                IsRunning = false;
412
+                Process[] ProcessArray = Process.GetProcessesByName("ffmpeg");
413
+                foreach (var KillProcess in ProcessArray)
414
+                {
415
+                    IsRunning = true;
416
+                    Thread.Sleep(100);
417
+                }
418
+            }
419
+            #endregion
420
+            myProcess = null;
320
         }
421
         }
321
 
422
 
322
         /// <summary>
423
         /// <summary>

+ 2
- 1
Common/system/FileToolsCommon.cs View File

70
             ErrMessage = "";
70
             ErrMessage = "";
71
             try
71
             try
72
             {
72
             {
73
+                FilePathName = GetLegalPath(FilePathName);
73
                 FilePath = GetDirectoryName(FilePathName);
74
                 FilePath = GetDirectoryName(FilePathName);
74
                 FileName = GetIOFileName(FilePathName);
75
                 FileName = GetIOFileName(FilePathName);
75
             }
76
             }
671
         /// <param name="filePath">文件的绝对路径</param>          
672
         /// <param name="filePath">文件的绝对路径</param>          
672
         public static string GetDirectoryName(string filePath)
673
         public static string GetDirectoryName(string filePath)
673
         {
674
         {
674
-            string DirectoryName = (System.IO.Path.GetDirectoryName(filePath) + "\\").Replace("\\", "/");
675
+            string DirectoryName = (System.IO.Path.GetDirectoryName(filePath+ "\\") ).Replace("\\", "/");
675
             return DirectoryName;
676
             return DirectoryName;
676
         }
677
         }
677
         #endregion
678
         #endregion

+ 40
- 41
Common/system/ImageHelper.cs View File

85
         /// <returns></returns>
85
         /// <returns></returns>
86
         public static BitmapImage GetScreenshot(Rectangle ScreenSize, string ImageSavePath, long level = -1)
86
         public static BitmapImage GetScreenshot(Rectangle ScreenSize, string ImageSavePath, long level = -1)
87
         {
87
         {
88
-            try
89
-            {
90
-                System.Drawing.Size bounds = PrimaryScreen.DESKTOP;
91
-                //if (string.IsNullOrEmpty(ImageSavePath))
92
-                //{
93
-                //    ImageSavePath = GetTempImagePath();//如果为空则指定临时存储路径
94
-                //}
95
-                double scaleWidth = (bounds.Width * 1.0) / SystemParameters.PrimaryScreenWidth;
96
-                double scaleHeight = (bounds.Height * 1.0) / SystemParameters.PrimaryScreenHeight;
97
-                int width = bounds.Width;
98
-                int height = bounds.Height;
99
-                if (ScreenSize.Size != new System.Drawing.Size(0, 0))
100
-                {
101
-                    width = (int)(ScreenSize.Size.Width * scaleWidth);
102
-                    height = (int)(ScreenSize.Size.Height * scaleHeight);
103
-                }
104
-                int l = (int)(ScreenSize.X * scaleWidth);
105
-                int t = (int)(ScreenSize.Y * scaleHeight);
106
-                //if (_Bitmap != null)
107
-                //{
108
-                //    _Bitmap.Dispose();
109
-                //}
110
-                Bitmap _Bitmap = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
111
-                using (Graphics g = Graphics.FromImage(_Bitmap))
112
-                {
113
-                    g.CopyFromScreen(l, t, 0, 0, _Bitmap.Size, CopyPixelOperation.SourceCopy);
114
-                    Compress(_Bitmap, ImageSavePath, level);
115
-                }
116
-                Uri uri = new Uri(ImageSavePath, UriKind.Absolute);
117
-                BitmapImage bimg = new BitmapImage(uri);
118
-                GC.Collect();
119
-                return bimg;
120
-            }
121
-            catch (Exception ex)
122
-            {
123
-                LogHelper.WriteErrLog("【截图】(GetBitmapSource)截图失败," + ex.Message, ex);
124
-                return null;
125
-            }
88
+            //try
89
+            //{
90
+            //    System.Drawing.Size bounds = PrimaryScreen.DESKTOP;
91
+            //    //if (string.IsNullOrEmpty(ImageSavePath))
92
+            //    //{
93
+            //    //    ImageSavePath = GetTempImagePath();//如果为空则指定临时存储路径
94
+            //    //}
95
+            //    double scaleWidth = (bounds.Width * 1.0) / SystemParameters.PrimaryScreenWidth;
96
+            //    double scaleHeight = (bounds.Height * 1.0) / SystemParameters.PrimaryScreenHeight;
97
+            //    int width = bounds.Width;
98
+            //    int height = bounds.Height;
99
+            //    if (ScreenSize.Size != new System.Drawing.Size(0, 0))
100
+            //    {
101
+            //        width = (int)(ScreenSize.Size.Width * scaleWidth);
102
+            //        height = (int)(ScreenSize.Size.Height * scaleHeight);
103
+            //    }
104
+            //    int l = (int)(ScreenSize.X * scaleWidth);
105
+            //    int t = (int)(ScreenSize.Y * scaleHeight);
106
+            //    //if (_Bitmap != null)
107
+            //    //{
108
+            //    //    _Bitmap.Dispose();
109
+            //    //}
110
+            //    Bitmap _Bitmap = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
111
+            //    using (Graphics g = Graphics.FromImage(_Bitmap))
112
+            //    {
113
+            //        g.CopyFromScreen(l, t, 0, 0, _Bitmap.Size, CopyPixelOperation.SourceCopy);
114
+            //        Compress(_Bitmap, ImageSavePath, level);
115
+            //    }
116
+            //    Uri uri = new Uri(ImageSavePath, UriKind.Absolute);
117
+            //    BitmapImage bimg = new BitmapImage(uri);
118
+            //    GC.Collect();
119
+            //    return bimg;
120
+            //}
121
+            //catch (Exception ex)
122
+            //{
123
+            //    //LogHelper.WriteErrLog("【截图】(GetBitmapSource)截图失败," + ex.Message, ex);
124
+            return null;
125
+            //}
126
         }
126
         }
127
 
127
 
128
         //private static Bitmap _Bitmap = null;
128
         //private static Bitmap _Bitmap = null;
164
         {
164
         {
165
             if (level <= -1)
165
             if (level <= -1)
166
             {
166
             {
167
-                int ImageCompressionLevel = int.Parse(ConfigurationManager.AppSettings["ImageCompressionLevel"]);
167
+                int ImageCompressionLevel = int.Parse(FileToolsCommon.GetConfigValue("ImageCompressionLevel"));
168
                 level = ImageCompressionLevel;
168
                 level = ImageCompressionLevel;
169
             }
169
             }
170
             Stream s = new FileStream(destFile, FileMode.Create);
170
             Stream s = new FileStream(destFile, FileMode.Create);
336
         #endregion 图片压缩
336
         #endregion 图片压缩
337
 
337
 
338
         #region 截屏指定UI控件
338
         #region 截屏指定UI控件
339
-
340
         /// <summary>
339
         /// <summary>
341
         /// 保存图片
340
         /// 保存图片
342
         /// </summary>
341
         /// </summary>
344
         /// <param name="filePathName">图片保存地址 命名 1.png</param>
343
         /// <param name="filePathName">图片保存地址 命名 1.png</param>
345
         /// <param name="width">保存宽</param>
344
         /// <param name="width">保存宽</param>
346
         /// <param name="height">保存高</param>
345
         /// <param name="height">保存高</param>
347
-        private void SaveUIToImage(FrameworkElement ui, string filePathName, int width, int height)
346
+        public static void SaveUIToImage(FrameworkElement ui, string filePathName, int width, int height)
348
         {
347
         {
349
             try
348
             try
350
             {
349
             {

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

10
     <add key="VideoSavePath" value="D:\星火微课" />
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
+    <!--图片压缩质量-->
14
+    <add key="ImageCompressionLevel" value="50"/>
13
   </appSettings>
15
   </appSettings>
14
 </configuration>
16
 </configuration>

+ 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  Cursor="Hand" 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="" FontSize="16" Foreground="#333333" Padding="5,12,2,2" Width="319" Height="42" BorderBrush="{x:Null}" BorderThickness="0"/>
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"/>
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  Cursor="Hand" 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  Cursor="Hand" 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

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

34
         /// <param name="e"></param>
34
         /// <param name="e"></param>
35
         private void BtnDown_Click(object sender, RoutedEventArgs e)
35
         private void BtnDown_Click(object sender, RoutedEventArgs e)
36
         {
36
         {
37
-
37
+            System.Environment.Exit(0);
38
         }
38
         }
39
         /// <summary>
39
         /// <summary>
40
         /// 浏览
40
         /// 浏览
76
                 System.Windows.MessageBox.Show("路径不可为空!");
76
                 System.Windows.MessageBox.Show("路径不可为空!");
77
                 return;
77
                 return;
78
             }
78
             }
79
-            if (!FileToolsCommon.IsLegalPath(txbExplainName.Text.Trim(), out string ErrMessage))
80
-            {
81
-                System.Windows.MessageBox.Show(ErrMessage);
82
-            }
79
+            //if (!FileToolsCommon.IsLegalPath(txbStoragePath.Text.Trim(), out string ErrMessage))
80
+            //{
81
+            //    System.Windows.MessageBox.Show(ErrMessage);
82
+            //    return;
83
+            //}
83
             string PathName = FileToolsCommon.GetLegalPath(txbStoragePath.Text) + txbExplainName.Text.Trim() + "/";
84
             string PathName = FileToolsCommon.GetLegalPath(txbStoragePath.Text) + txbExplainName.Text.Trim() + "/";
84
             if (FileToolsCommon.IsExistDirectory(PathName))
85
             if (FileToolsCommon.IsExistDirectory(PathName))
85
             {
86
             {

+ 3
- 3
XHWK.WKTool/FileDirectoryWindow.xaml View File

21
             <Border Grid.Row="0" Background="#2D8CF0">
21
             <Border Grid.Row="0" Background="#2D8CF0">
22
                 <Grid  MouseLeftButtonDown="Window_MouseLeftButtonDown">
22
                 <Grid  MouseLeftButtonDown="Window_MouseLeftButtonDown">
23
                     <TextBlock Text="文件目录" Foreground="#FFFFFF" FontSize="16" Padding="10,13,0,0"/>
23
                     <TextBlock Text="文件目录" Foreground="#FFFFFF" FontSize="16" Padding="10,13,0,0"/>
24
-                    <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"/>
24
+                    <Button  Cursor="Hand" 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
                 </Grid>
25
                 </Grid>
26
             </Border>
26
             </Border>
27
            <!--第二行 内容-->
27
            <!--第二行 内容-->
30
             </Grid>
30
             </Grid>
31
             <!--第三行 删除 上传 按钮-->
31
             <!--第三行 删除 上传 按钮-->
32
             <StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Center">
32
             <StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Center">
33
-                <Button x:Name="btnDelete" Content="删除" FontSize="18" Foreground="#FFFFFF" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Width="115" Height="45" Margin="0,0,30,0">
33
+                <Button  Cursor="Hand" x:Name="btnDelete" Content="删除" FontSize="18" Foreground="#FFFFFF" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Width="115" Height="45" Margin="0,0,30,0">
34
                     <Button.Template>
34
                     <Button.Template>
35
                         <ControlTemplate TargetType="{x:Type Button}">
35
                         <ControlTemplate TargetType="{x:Type Button}">
36
                             <Border
36
                             <Border
46
                         </ControlTemplate>
46
                         </ControlTemplate>
47
                     </Button.Template>
47
                     </Button.Template>
48
                 </Button>
48
                 </Button>
49
-                <Button x:Name="btnUpload" Content="上传" FontSize="18" Foreground="#FFFFFF" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Width="115" Height="45" Margin="30,0,0,0">
49
+                <Button  Cursor="Hand" x:Name="btnUpload" Content="上传" FontSize="18" Foreground="#FFFFFF" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Width="115" Height="45" Margin="30,0,0,0">
50
                     <Button.Template>
50
                     <Button.Template>
51
                         <ControlTemplate TargetType="{x:Type Button}">
51
                         <ControlTemplate TargetType="{x:Type Button}">
52
                             <Border
52
                             <Border

+ 3
- 3
XHWK.WKTool/LoginWindow.xaml View File

23
             <Border Grid.Row="0" Background="#2D8CF0">
23
             <Border Grid.Row="0" Background="#2D8CF0">
24
                 <Grid>
24
                 <Grid>
25
                     <TextBlock Text="登录星火微课系统" Foreground="#FFFFFF" FontSize="16" Padding="10,13,0,0"/>
25
                     <TextBlock Text="登录星火微课系统" Foreground="#FFFFFF" FontSize="16" Padding="10,13,0,0"/>
26
-                    <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
+                    <Button  Cursor="Hand" 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"/>
27
                 </Grid>
27
                 </Grid>
28
             </Border>
28
             </Border>
29
             <!--第二行 登陆 账号-->
29
             <!--第二行 登陆 账号-->
43
                 </Border>
43
                 </Border>
44
             </StackPanel>
44
             </StackPanel>
45
             <StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Left" Margin="20,0,0,0">
45
             <StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Left" Margin="20,0,0,0">
46
-                <Button Grid.Row="3" Height="20" Width="20" Content="√" FontSize="13" >
46
+                <Button  Cursor="Hand" Grid.Row="3" Height="20" Width="20" Content="√" FontSize="13" >
47
                     <Button.Template>
47
                     <Button.Template>
48
                         <ControlTemplate TargetType="{x:Type Button}">
48
                         <ControlTemplate TargetType="{x:Type Button}">
49
                             <Border
49
                             <Border
63
             </StackPanel>
63
             </StackPanel>
64
             
64
             
65
             <!--第五行 开始按钮-->
65
             <!--第五行 开始按钮-->
66
-            <Button Grid.Row="4" 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">
66
+            <Button  Cursor="Hand" Grid.Row="4" 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">
67
                 <Button.Template>
67
                 <Button.Template>
68
                     <ControlTemplate TargetType="{x:Type Button}">
68
                     <ControlTemplate TargetType="{x:Type Button}">
69
                         <Border
69
                         <Border

Loading…
Cancel
Save