|
@@ -2,6 +2,7 @@
|
2
|
2
|
|
3
|
3
|
using System;
|
4
|
4
|
using System.Threading;
|
|
5
|
+using System.Threading.Tasks;
|
5
|
6
|
using System.Windows;
|
6
|
7
|
using System.Windows.Forms;
|
7
|
8
|
using System.Windows.Input;
|
|
@@ -17,9 +18,12 @@ namespace XHWK.WKTool
|
17
|
18
|
public partial class CreateAMicroLessonWindow : Window
|
18
|
19
|
{
|
19
|
20
|
#region 字段
|
|
21
|
+
|
20
|
22
|
private FolderBrowserDialog ofd;
|
21
|
23
|
private DialogResult result;
|
22
|
|
- #endregion
|
|
24
|
+
|
|
25
|
+ #endregion 字段
|
|
26
|
+
|
23
|
27
|
/// <summary>
|
24
|
28
|
/// 创建微课
|
25
|
29
|
/// </summary>
|
|
@@ -27,7 +31,7 @@ namespace XHWK.WKTool
|
27
|
31
|
{
|
28
|
32
|
InitializeComponent();
|
29
|
33
|
ResizeMode = ResizeMode.NoResize;
|
30
|
|
-
|
|
34
|
+
|
31
|
35
|
//if (!APP.CheckScreenCapturerRecorder())
|
32
|
36
|
//{
|
33
|
37
|
// MessageWindow.Show("首次运行需安装环境,请在确定后依次点击“English-OK-Next>-Next>Install”完成安装!");
|
|
@@ -40,22 +44,26 @@ namespace XHWK.WKTool
|
40
|
44
|
}
|
41
|
45
|
|
42
|
46
|
#region 轮播图
|
|
47
|
+
|
43
|
48
|
/// <summary>
|
44
|
49
|
/// 图片宽度,每次切换的宽度
|
45
|
50
|
/// </summary>
|
46
|
|
- double ImgWidth = 502.00;
|
|
51
|
+ private double ImgWidth = 502.00;
|
|
52
|
+
|
47
|
53
|
/// <summary>
|
48
|
54
|
/// 轮播时移动增加的宽度
|
49
|
55
|
/// </summary>
|
50
|
|
- double ImgMove = 1;
|
|
56
|
+ private double ImgMove = 1;
|
|
57
|
+
|
51
|
58
|
/// <summary>
|
52
|
59
|
/// 当前展示的图片序号Index从0开始
|
53
|
60
|
/// </summary>
|
54
|
|
- int ImgNumIndex = 0;
|
|
61
|
+ private int ImgNumIndex = 0;
|
|
62
|
+
|
55
|
63
|
/// <summary>
|
56
|
64
|
/// 加载录播图
|
57
|
65
|
/// </summary>
|
58
|
|
- void LoadingCarouseImg()
|
|
66
|
+ private void LoadingCarouseImg()
|
59
|
67
|
{
|
60
|
68
|
new Thread(new ThreadStart(new Action(() =>
|
61
|
69
|
{
|
|
@@ -71,14 +79,15 @@ namespace XHWK.WKTool
|
71
|
79
|
});
|
72
|
80
|
}))).Start();
|
73
|
81
|
}
|
|
82
|
+
|
74
|
83
|
/// <summary>
|
75
|
84
|
/// 轮播图
|
76
|
85
|
/// </summary>
|
77
|
|
- void CarouseImg()
|
|
86
|
+ private void CarouseImg()
|
78
|
87
|
{
|
79
|
88
|
new Thread(new ThreadStart(new Action(() =>
|
80
|
89
|
{
|
81
|
|
- while(true)
|
|
90
|
+ while (true)
|
82
|
91
|
{
|
83
|
92
|
for (double i = ImgMove; i < ImgWidth; i += ImgMove)
|
84
|
93
|
{
|
|
@@ -86,8 +95,8 @@ namespace XHWK.WKTool
|
86
|
95
|
{
|
87
|
96
|
if (Math.Abs(i + ImgMove) < ImgWidth)
|
88
|
97
|
{
|
89
|
|
- //图片移动轮播
|
90
|
|
- SplCarouse.Margin = new Thickness(SplCarouse.Margin.Left - ImgMove, 0, 0, 0);
|
|
98
|
+ //图片移动轮播
|
|
99
|
+ SplCarouse.Margin = new Thickness(SplCarouse.Margin.Left - ImgMove, 0, 0, 0);
|
91
|
100
|
}
|
92
|
101
|
else
|
93
|
102
|
{
|
|
@@ -120,27 +129,33 @@ namespace XHWK.WKTool
|
120
|
129
|
break;
|
121
|
130
|
}
|
122
|
131
|
}
|
123
|
|
-
|
124
|
132
|
}))).Start();
|
125
|
133
|
}
|
|
134
|
+
|
126
|
135
|
/// <summary>
|
127
|
136
|
/// 轮播图切换
|
128
|
137
|
/// </summary>
|
129
|
|
- /// <param name="sender"></param>
|
130
|
|
- /// <param name="e"></param>
|
|
138
|
+ /// <param name="sender">
|
|
139
|
+ /// </param>
|
|
140
|
+ /// <param name="e">
|
|
141
|
+ /// </param>
|
131
|
142
|
private void TimesCarouse_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
132
|
143
|
{
|
133
|
144
|
//SplCarouse
|
134
|
145
|
//ImgCarouse1
|
135
|
146
|
}
|
136
|
|
- #endregion
|
|
147
|
+
|
|
148
|
+ #endregion 轮播图
|
137
|
149
|
|
138
|
150
|
#region 事件
|
|
151
|
+
|
139
|
152
|
/// <summary>
|
140
|
153
|
/// 关闭
|
141
|
154
|
/// </summary>
|
142
|
|
- /// <param name="sender"></param>
|
143
|
|
- /// <param name="e"></param>
|
|
155
|
+ /// <param name="sender">
|
|
156
|
+ /// </param>
|
|
157
|
+ /// <param name="e">
|
|
158
|
+ /// </param>
|
144
|
159
|
private void BtnDown_Click(object sender, RoutedEventArgs e)
|
145
|
160
|
{
|
146
|
161
|
MessageBoxResult dr = MessageWindow.Show("确定退出系统?", "提示", MessageBoxButton.OKCancel);
|
|
@@ -153,11 +168,14 @@ namespace XHWK.WKTool
|
153
|
168
|
return;
|
154
|
169
|
}
|
155
|
170
|
}
|
|
171
|
+
|
156
|
172
|
/// <summary>
|
157
|
173
|
/// 浏览
|
158
|
174
|
/// </summary>
|
159
|
|
- /// <param name="sender"></param>
|
160
|
|
- /// <param name="e"></param>
|
|
175
|
+ /// <param name="sender">
|
|
176
|
+ /// </param>
|
|
177
|
+ /// <param name="e">
|
|
178
|
+ /// </param>
|
161
|
179
|
private void BtnBrowse_Click(object sender, RoutedEventArgs e)
|
162
|
180
|
{
|
163
|
181
|
//string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
|
|
@@ -175,15 +193,20 @@ namespace XHWK.WKTool
|
175
|
193
|
}
|
176
|
194
|
}
|
177
|
195
|
}
|
178
|
|
- bool IsPressButton = false;
|
|
196
|
+
|
|
197
|
+ private bool IsPressButton = false;
|
|
198
|
+
|
179
|
199
|
/// <summary>
|
180
|
200
|
/// 开始
|
181
|
201
|
/// </summary>
|
182
|
|
- /// <param name="sender"></param>
|
183
|
|
- /// <param name="e"></param>
|
184
|
|
- private void BtnStart_Click(object sender, RoutedEventArgs e)
|
|
202
|
+ /// <param name="sender">
|
|
203
|
+ /// </param>
|
|
204
|
+ /// <param name="e">
|
|
205
|
+ /// </param>
|
|
206
|
+ private async void BtnStart_Click(object sender, RoutedEventArgs e)
|
185
|
207
|
{
|
186
|
208
|
#region 防止连击
|
|
209
|
+
|
187
|
210
|
if (IsPressButton)
|
188
|
211
|
{
|
189
|
212
|
return;
|
|
@@ -197,8 +220,11 @@ namespace XHWK.WKTool
|
197
|
220
|
IsPressButton = false;
|
198
|
221
|
}))).Start();
|
199
|
222
|
}
|
200
|
|
- #endregion
|
|
223
|
+
|
|
224
|
+ #endregion 防止连击
|
|
225
|
+
|
201
|
226
|
#region 合法性判断
|
|
227
|
+
|
202
|
228
|
if (string.IsNullOrWhiteSpace(txbExplainName.Text.Trim()))
|
203
|
229
|
{
|
204
|
230
|
MessageWindow.Show("讲解名称不可为空!");
|
|
@@ -218,83 +244,77 @@ namespace XHWK.WKTool
|
218
|
244
|
MessageWindow.Show("路径无法访问,解决方案:\r\n1,检查路径是否可访问。\r\n2,关闭杀毒软件或信任软件。");
|
219
|
245
|
return;
|
220
|
246
|
}
|
221
|
|
- #endregion
|
|
247
|
+
|
|
248
|
+ #endregion 合法性判断
|
|
249
|
+
|
222
|
250
|
LblCreate.Visibility = Visibility.Visible;
|
223
|
251
|
string wkpath = FileToolsCommon.GetLegalPath(txbStoragePath.Text) + txbExplainName.Text.Trim() + "/";
|
224
|
252
|
string StoragePath = txbStoragePath.Text;
|
225
|
|
- new Thread(new ThreadStart(new Action(() =>
|
|
253
|
+ string WkName = txbExplainName.Text;
|
|
254
|
+ await Task.Run(() =>
|
226
|
255
|
{
|
227
|
|
- //读取微课数据
|
228
|
|
- APP.ReadWkData(wkpath);
|
229
|
|
- if (APP.WKData == null)
|
|
256
|
+ try
|
230
|
257
|
{
|
231
|
|
- Dispatcher.Invoke(() =>
|
|
258
|
+ //读取微课数据
|
|
259
|
+ APP.ReadWkData(wkpath);
|
|
260
|
+ if (APP.WKData == null)
|
232
|
261
|
{
|
233
|
|
- APP.WKData = new Model.Model_WKData
|
|
262
|
+ APP.WKData = new Model_WKData
|
234
|
263
|
{
|
235
|
264
|
WkPath = wkpath,
|
236
|
|
- WkName = txbExplainName.Text,
|
|
265
|
+ WkName = WkName,
|
237
|
266
|
WkCreateDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
|
238
|
267
|
};
|
239
|
|
- });
|
240
|
|
- }
|
241
|
|
- //创建文件夹
|
242
|
|
- FileToolsCommon.CreateDirectory(APP.WKData.WkPath);
|
243
|
|
- FileToolsCommon.DeleteDirectory(wkpath + "temp");
|
244
|
|
- FileToolsCommon.DeleteDirectory(wkpath + "temprs");
|
245
|
|
- //存储文件
|
246
|
|
- FileToolsCommon.SetConfigValue("VideoSavePath", StoragePath);
|
247
|
|
- APP.ReadDrawData();
|
248
|
|
- #region 微课不允许有多个视频 废弃
|
249
|
|
- ////判断微课是否存在,存在则询问
|
250
|
|
- //if (APP.WKDataList != null&& APP.WKDataList.Count>0)
|
251
|
|
- //{
|
252
|
|
- // if (APP.WKDataList.Exists(x => x.WkName == APP.WKData.WkName))
|
253
|
|
- // {
|
254
|
|
- // MessageBoxResult dr = MessageWindow.Show("此微课已存在是否覆盖?", "提示", MessageBoxButton.OKCancel);
|
255
|
|
- // if (dr == MessageBoxResult.OK)
|
256
|
|
- // {
|
257
|
|
- // FileToolsCommon.DeleteDirectory(APP.WKData.WkPath);
|
258
|
|
- // FileToolsCommon.CreateDirectory(APP.WKData.WkPath);
|
259
|
|
- // APP.WKDataList.RemoveAll(x => x.WkName == APP.WKData.WkName);
|
260
|
|
- // }
|
261
|
|
- // else
|
262
|
|
- // {
|
263
|
|
- // return;
|
264
|
|
- // }
|
265
|
|
- // }
|
266
|
|
- //}
|
267
|
|
- #endregion
|
|
268
|
+ }
|
268
|
269
|
|
269
|
|
- Dispatcher.Invoke(() =>
|
270
|
|
- {
|
271
|
|
- if (APP.W_XHMicroLessonSystemWindow == null)
|
|
270
|
+ try
|
272
|
271
|
{
|
273
|
|
- //double proportion = 1036.0 / 1276.0;
|
274
|
|
- APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();
|
275
|
|
- //APP.W_XHMicroLessonSystemWindow.Width = proportion * (PrimaryScreen.ScaleScreenSize().Height-40);
|
276
|
|
- //APP.W_XHMicroLessonSystemWindow.Height =/*1276-*/ PrimaryScreen.ScaleScreenSize().Height-40;
|
277
|
|
- //APP.W_XHMicroLessonSystemWindow .Topmost = true;
|
|
272
|
+ //创建文件夹
|
|
273
|
+ FileToolsCommon.CreateDirectory(APP.WKData.WkPath);
|
|
274
|
+ FileToolsCommon.DeleteDirectory(wkpath + "temp");
|
|
275
|
+ FileToolsCommon.DeleteDirectory(wkpath + "temprs");
|
278
|
276
|
}
|
279
|
|
- APP.W_XHMicroLessonSystemWindow.Show();
|
280
|
|
- LblCreate.Visibility = Visibility.Hidden;
|
281
|
|
- Hide();
|
282
|
|
- });
|
283
|
|
- }))).Start();
|
|
277
|
+ catch (Exception ex)
|
|
278
|
+ {
|
|
279
|
+ LogHelper.WriteErrLog("【微课创建课程】文件夹创建删除失败:" + ex.Message, ex);
|
|
280
|
+ }
|
|
281
|
+
|
|
282
|
+ //存储文件
|
|
283
|
+ FileToolsCommon.SetConfigValue("VideoSavePath", StoragePath);
|
|
284
|
+
|
|
285
|
+ APP.ReadDrawData();
|
|
286
|
+ }
|
|
287
|
+ catch (Exception ex)
|
|
288
|
+ {
|
|
289
|
+ LogHelper.WriteErrLog("【微课创建课程】读取课堂数据失败:" + ex.Message, ex);
|
|
290
|
+ }
|
|
291
|
+ });
|
|
292
|
+
|
|
293
|
+ if (APP.W_XHMicroLessonSystemWindow == null)
|
|
294
|
+ {
|
|
295
|
+ APP.W_XHMicroLessonSystemWindow = new XHMicroLessonSystemWindow();
|
|
296
|
+ }
|
|
297
|
+ APP.W_XHMicroLessonSystemWindow.Show();
|
|
298
|
+ LblCreate.Visibility = Visibility.Hidden;
|
|
299
|
+ Hide();
|
284
|
300
|
}
|
285
|
301
|
|
286
|
302
|
private double screeHeight = SystemParameters.FullPrimaryScreenHeight;
|
287
|
303
|
private double screeWidth = SystemParameters.FullPrimaryScreenWidth;
|
|
304
|
+
|
288
|
305
|
/// <summary>
|
289
|
306
|
/// 窗体移动
|
290
|
307
|
/// </summary>
|
291
|
|
- /// <param name="sender"></param>
|
292
|
|
- /// <param name="e"></param>
|
|
308
|
+ /// <param name="sender">
|
|
309
|
+ /// </param>
|
|
310
|
+ /// <param name="e">
|
|
311
|
+ /// </param>
|
293
|
312
|
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
294
|
313
|
{
|
295
|
314
|
DragMove();
|
296
|
315
|
}
|
297
|
|
- #endregion
|
|
316
|
+
|
|
317
|
+ #endregion 事件
|
298
|
318
|
|
299
|
319
|
/// <summary>
|
300
|
320
|
/// 检测APP更新
|
|
@@ -340,10 +360,12 @@ namespace XHWK.WKTool
|
340
|
360
|
}
|
341
|
361
|
}).Start();
|
342
|
362
|
}
|
|
363
|
+
|
343
|
364
|
/// <summary>
|
344
|
365
|
/// 应用更新
|
345
|
366
|
/// </summary>
|
346
|
|
- /// <param name="app"></param>
|
|
367
|
+ /// <param name="app">
|
|
368
|
+ /// </param>
|
347
|
369
|
private void appUpdateShow(Model_App app)
|
348
|
370
|
{
|
349
|
371
|
AppUpdateWin win = new AppUpdateWin(app)
|
|
@@ -353,9 +375,10 @@ namespace XHWK.WKTool
|
353
|
375
|
};
|
354
|
376
|
win.Show();
|
355
|
377
|
}
|
|
378
|
+
|
356
|
379
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
357
|
380
|
{
|
358
|
381
|
getNewApp();
|
359
|
382
|
}
|
360
|
383
|
}
|
361
|
|
-}
|
|
384
|
+}
|