|
@@ -22,8 +22,19 @@ namespace XHWK.WKTool
|
22
|
22
|
/// 视频模型
|
23
|
23
|
/// </summary>
|
24
|
24
|
List<Model_Video> model_VideoList =null;
|
|
25
|
+ /// <summary>
|
|
26
|
+ /// 数据列表
|
|
27
|
+ /// </summary>
|
25
|
28
|
internal FileDirectoryData pageData = new FileDirectoryData();
|
26
|
29
|
/// <summary>
|
|
30
|
+ /// 下标
|
|
31
|
+ /// </summary>
|
|
32
|
+ private int Subscript = 0;
|
|
33
|
+ /// <summary>
|
|
34
|
+ /// 是否是修改状态
|
|
35
|
+ /// </summary>
|
|
36
|
+ private bool IsModify = false;
|
|
37
|
+ /// <summary>
|
27
|
38
|
/// 文件目录
|
28
|
39
|
/// </summary>
|
29
|
40
|
public FileDirectoryWindow()
|
|
@@ -36,6 +47,8 @@ namespace XHWK.WKTool
|
36
|
47
|
/// </summary>
|
37
|
48
|
public void Initialize()
|
38
|
49
|
{
|
|
50
|
+ MouseNumber = 0;
|
|
51
|
+ IsModify = false;
|
39
|
52
|
//加载视频列表
|
40
|
53
|
LoadingVideoList();
|
41
|
54
|
int i = 1;
|
|
@@ -78,7 +91,9 @@ namespace XHWK.WKTool
|
78
|
91
|
pageData.menuList.Add(new FileDirectoryModel()
|
79
|
92
|
{
|
80
|
93
|
SerialNumber = i,
|
81
|
|
- VideoName = Common.system.FileToolsCommon.GetIOFileName(videoinfo.VideoPath),
|
|
94
|
+ VideoName = Common.system.FileToolsCommon.GetIOFileName(videoinfo.VideoPath).Replace(".MP4", "").Replace(".FLV", "").Replace("AVI", "").Trim(),
|
|
95
|
+ Name = Common.system.FileToolsCommon.GetIOFileName(videoinfo.VideoPath).Replace(".MP4", "").Replace(".FLV", "").Replace("AVI", "").Trim(),
|
|
96
|
+ FilePath = videoinfo.VideoPath.Replace(FileToolsCommon.GetIOFileName(videoinfo.VideoPath), "").Trim(),
|
82
|
97
|
VideoDuration = 0,
|
83
|
98
|
VideoSize = videoinfo.VideoSize,
|
84
|
99
|
VideoTime = videoinfo.RSTime,
|
|
@@ -86,9 +101,10 @@ namespace XHWK.WKTool
|
86
|
101
|
Path = videoinfo.VideoPath,
|
87
|
102
|
Colour = colour,
|
88
|
103
|
Visi = vis,
|
89
|
|
- Coll=cos,
|
90
|
|
- FileGuid= videoinfo.FileGuid,
|
91
|
|
- }) ; ;
|
|
104
|
+ Coll = cos,
|
|
105
|
+ FileGuid = videoinfo.FileGuid,
|
|
106
|
+ VideoType = videoinfo.VideoType.ToString()
|
|
107
|
+ }); ;
|
92
|
108
|
i++;
|
93
|
109
|
}
|
94
|
110
|
txbSum.Text = pageData.menuList.Count.ToString();
|
|
@@ -99,21 +115,31 @@ namespace XHWK.WKTool
|
99
|
115
|
/// </summary>
|
100
|
116
|
public void LoadingVideoList()
|
101
|
117
|
{
|
|
118
|
+ try
|
|
119
|
+ {
|
|
120
|
+ model_VideoList = new List<Model_Video>();
|
|
121
|
+ foreach (Model_WKData Vdata in APP.WKDataList)
|
|
122
|
+ {
|
|
123
|
+ if (Vdata.VideoList == null)
|
|
124
|
+ continue;
|
|
125
|
+ foreach (Model_Video videoinfo in Vdata.VideoList)
|
|
126
|
+ {
|
|
127
|
+ if (string.IsNullOrWhiteSpace(videoinfo.VideoPath))
|
|
128
|
+ {
|
|
129
|
+ continue;
|
|
130
|
+ }
|
|
131
|
+ if (string.IsNullOrWhiteSpace(videoinfo.VideoSize) || videoinfo.VideoSize == "0 MB")
|
|
132
|
+ {
|
|
133
|
+ videoinfo.VideoSize = FileToolsCommon.GetFileSizeByMB(videoinfo.VideoPath).ToString() + " MB";
|
|
134
|
+ }
|
|
135
|
+ model_VideoList.Add(videoinfo);
|
|
136
|
+ }
|
|
137
|
+ }
|
|
138
|
+ }
|
|
139
|
+ catch (Exception ex)
|
|
140
|
+ {
|
102
|
141
|
|
103
|
|
- //model_VideoList = new List<Model_Video>();
|
104
|
|
- //foreach(Model_WKData Vdata in APP.WKDataList)
|
105
|
|
- //{
|
106
|
|
- // if (Vdata.VideoList == null)
|
107
|
|
- // continue;
|
108
|
|
- // foreach(Model_Video videoinfo in Vdata.VideoList)
|
109
|
|
- // {
|
110
|
|
- // if (string.IsNullOrWhiteSpace(videoinfo.VideoSize)|| videoinfo.VideoSize=="0 MB")
|
111
|
|
- // {
|
112
|
|
- // videoinfo.VideoSize = FileToolsCommon.GetFileSizeByMB(videoinfo.VideoPath).ToString() + " MB";
|
113
|
|
- // }
|
114
|
|
- // model_VideoList.Add(videoinfo);
|
115
|
|
- // }
|
116
|
|
- //}
|
|
142
|
+ }
|
117
|
143
|
}
|
118
|
144
|
/// <summary>
|
119
|
145
|
/// 关闭
|
|
@@ -140,6 +166,7 @@ namespace XHWK.WKTool
|
140
|
166
|
/// <param name="e"></param>
|
141
|
167
|
private void BtnUpload_Click(object sender, RoutedEventArgs e)
|
142
|
168
|
{
|
|
169
|
+ pageData.menuList[Subscript].IsEnabled = false;
|
143
|
170
|
List<Button> buttons = FindChilds<Button>(listView1, "btnUpload");
|
144
|
171
|
for (int i = 0; i < buttons.Count; i++)
|
145
|
172
|
{
|
|
@@ -172,6 +199,7 @@ namespace XHWK.WKTool
|
172
|
199
|
/// <param name="e"></param>
|
173
|
200
|
private void BtnDelete_Click(object sender, RoutedEventArgs e)
|
174
|
201
|
{
|
|
202
|
+ pageData.menuList[Subscript].IsEnabled = false;
|
175
|
203
|
List<Button> buttons = FindChilds<Button>(listView1, "btnDelete");
|
176
|
204
|
for (int i = 0; i < buttons.Count; i++)
|
177
|
205
|
{
|
|
@@ -208,6 +236,7 @@ namespace XHWK.WKTool
|
208
|
236
|
/// <param name="e"></param>
|
209
|
237
|
private void BtnPlay_Click(object sender, RoutedEventArgs e)
|
210
|
238
|
{
|
|
239
|
+ pageData.menuList[Subscript].IsEnabled = false;
|
211
|
240
|
List<Button> buttons = FindChilds<Button>(listView1, "btnPlay");
|
212
|
241
|
for (int i = 0; i < buttons.Count; i++)
|
213
|
242
|
{
|
|
@@ -283,15 +312,109 @@ namespace XHWK.WKTool
|
283
|
312
|
/// <param name="e"></param>
|
284
|
313
|
private void BtnModify_Click(object sender, RoutedEventArgs e)
|
285
|
314
|
{
|
|
315
|
+ if(IsModify)
|
|
316
|
+ {
|
|
317
|
+ pageData.menuList[Subscript].IsEnabled = false;
|
|
318
|
+ }
|
|
319
|
+
|
286
|
320
|
List<Button> buttons = FindChilds<Button>(listView1, "btnModify");
|
287
|
321
|
for (int i = 0; i < buttons.Count; i++)
|
288
|
322
|
{
|
289
|
323
|
if (buttons[i] == sender)
|
290
|
324
|
{
|
291
|
325
|
pageData.menuList[i].IsEnabled = true;
|
|
326
|
+ Subscript = i;
|
|
327
|
+ IsModify = true;
|
292
|
328
|
}
|
293
|
329
|
}
|
294
|
330
|
}
|
|
331
|
+ int MouseNumber = 0;
|
|
332
|
+ /// <summary>
|
|
333
|
+ /// 鼠标按下
|
|
334
|
+ /// </summary>
|
|
335
|
+ /// <param name="sender"></param>
|
|
336
|
+ /// <param name="e"></param>
|
|
337
|
+ private void Window_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
|
|
338
|
+ {
|
|
339
|
+ //if(IsModify)
|
|
340
|
+ //{
|
|
341
|
+ // if(MouseNumber>0&& pageData.menuList.Count> Subscript)
|
|
342
|
+ // {
|
|
343
|
+ // pageData.menuList[Subscript].IsEnabled = false;
|
|
344
|
+ // try
|
|
345
|
+ // {
|
|
346
|
+ // if(!pageData.menuList[Subscript].Name.Equals(pageData.menuList[Subscript].VideoName))
|
|
347
|
+ // {
|
|
348
|
+
|
|
349
|
+ // string tempPath = pageData.menuList[Subscript].VideoName + pageData.menuList[Subscript].VideoType;
|
|
350
|
+ // tempPath = pageData.menuList[Subscript].Path.Replace(tempPath, "").Trim();
|
|
351
|
+ // tempPath = tempPath + pageData.menuList[Subscript].Name;
|
|
352
|
+ // FileToolsCommon.MoveDirectory(pageData.menuList[Subscript].Path, tempPath,out string Message);
|
|
353
|
+ // }
|
|
354
|
+ // }
|
|
355
|
+ // catch (Exception ex)
|
|
356
|
+ // {
|
|
357
|
+ // MessageBox.Show("无法修改视频名称!" + ex.Message);
|
|
358
|
+ // return;
|
|
359
|
+ // }
|
|
360
|
+ // }
|
|
361
|
+ // MouseNumber++;
|
|
362
|
+ //}
|
|
363
|
+ }
|
|
364
|
+
|
|
365
|
+ private void Window_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
|
366
|
+ {
|
|
367
|
+ //if (IsModify)
|
|
368
|
+ //{
|
|
369
|
+ // if (MouseNumber > 2 && pageData.menuList.Count > Subscript)
|
|
370
|
+ // {
|
|
371
|
+ // pageData.menuList[Subscript].IsEnabled = false;
|
|
372
|
+ // try
|
|
373
|
+ // {
|
|
374
|
+ // if (!pageData.menuList[Subscript].Name.Equals(pageData.menuList[Subscript].VideoName))
|
|
375
|
+ // {
|
|
376
|
+ // MouseNumber = 0;
|
|
377
|
+ // string tempPath = pageData.menuList[Subscript].FilePath + pageData.menuList[Subscript].VideoName+"."+ pageData.menuList[Subscript].VideoType;
|
|
378
|
+ // if(FileToolsCommon.IsExistFile(tempPath))
|
|
379
|
+ // {
|
|
380
|
+ // MessageBox.Show("文件名已存在!");
|
|
381
|
+ // return;
|
|
382
|
+ // }
|
|
383
|
+ // foreach (Model_WKData wKData in APP.WKDataList)
|
|
384
|
+ // {
|
|
385
|
+ // if (wKData.VideoList == null)
|
|
386
|
+ // continue;
|
|
387
|
+ // if (wKData.VideoList.Exists(x => x.FileGuid == pageData.menuList[Subscript].FileGuid))
|
|
388
|
+ // {
|
|
389
|
+ // try
|
|
390
|
+ // {
|
|
391
|
+ // //FileToolsCommon.DeleteFile(wKData.VideoList.Find(x => x.FileGuid == pageData.menuList[Subscript].FileGuid).VideoPath);
|
|
392
|
+ // //FileToolsCommon.DeleteFile(wKData.VideoList.Find(x => x.FileGuid == pageData.menuList[Subscript].FileGuid).ThumbnailPath);
|
|
393
|
+ // //wKData.VideoList.Remove(wKData.VideoList.Find(x => x.FileGuid == pageData.menuList[Subscript].FileGuid));
|
|
394
|
+ // //Initialize();
|
|
395
|
+ // //return;
|
|
396
|
+ // }
|
|
397
|
+ // catch (Exception ex)
|
|
398
|
+ // {
|
|
399
|
+ // MessageBox.Show("无法删除视频!" + ex.Message);
|
|
400
|
+ // return;
|
|
401
|
+ // }
|
|
402
|
+ // }
|
|
403
|
+ // }
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+ // FileToolsCommon.Copy(pageData.menuList[Subscript].Path, tempPath);
|
|
407
|
+ // }
|
|
408
|
+ // }
|
|
409
|
+ // catch (Exception ex)
|
|
410
|
+ // {
|
|
411
|
+ // MessageBox.Show("无法修改视频名称!" + ex.Message);
|
|
412
|
+ // return;
|
|
413
|
+ // }
|
|
414
|
+ // }
|
|
415
|
+ // MouseNumber++;
|
|
416
|
+ //}
|
|
417
|
+ }
|
295
|
418
|
}
|
296
|
419
|
public class FileDirectoryData : NotifyModel
|
297
|
420
|
{
|
|
@@ -427,5 +550,17 @@ namespace XHWK.WKTool
|
427
|
550
|
/// 唯一编号
|
428
|
551
|
/// </summary>
|
429
|
552
|
public string FileGuid { get; set; }
|
|
553
|
+ /// <summary>
|
|
554
|
+ /// 视频类型
|
|
555
|
+ /// </summary>
|
|
556
|
+ public string VideoType { get; set; }
|
|
557
|
+ /// <summary>
|
|
558
|
+ /// 初始名称
|
|
559
|
+ /// </summary>
|
|
560
|
+ public string Name { get; set; }
|
|
561
|
+ /// <summary>
|
|
562
|
+ /// 文件路径
|
|
563
|
+ /// </summary>
|
|
564
|
+ public string FilePath { get; set; }
|
430
|
565
|
}
|
431
|
566
|
}
|