|
@@ -1482,18 +1482,36 @@ namespace XHWK.WKTool
|
1482
|
1482
|
{
|
1483
|
1483
|
if (IsModify)
|
1484
|
1484
|
{
|
|
1485
|
+ try
|
|
1486
|
+ {
|
|
1487
|
+ bool isName = ModifyPathName(pageData.menuList[Subscript].FileGuid, pageData.menuList[Subscript].VideoName, out string Errmessage);
|
|
1488
|
+ if (!isName)
|
|
1489
|
+ {
|
|
1490
|
+ MessageWindow.Show(Errmessage);
|
|
1491
|
+ }
|
|
1492
|
+ }
|
|
1493
|
+ catch (Exception ex)
|
|
1494
|
+ {
|
|
1495
|
+ LogHelper.WriteErrLog("XHMicroLessonSystemWindow(BtnModify_Click)" + ex.Message, ex);
|
|
1496
|
+ }
|
|
1497
|
+ IsModify = false;
|
1485
|
1498
|
pageData.menuList[Subscript].IsEnabled = false;
|
|
1499
|
+ listView1.DataContext = pageData;
|
1486
|
1500
|
}
|
1487
|
|
- List<System.Windows.Controls.Button> buttons = FindChilds<System.Windows.Controls.Button>(listView1, "btnModify");
|
1488
|
|
- for (int i = 0; i < buttons.Count; i++)
|
|
1501
|
+ else
|
1489
|
1502
|
{
|
1490
|
|
- if (buttons[i] == sender)
|
|
1503
|
+ List<System.Windows.Controls.Button> buttons = FindChilds<System.Windows.Controls.Button>(listView1, "btnModify");
|
|
1504
|
+ for (int i = 0; i < buttons.Count; i++)
|
1491
|
1505
|
{
|
1492
|
|
- pageData.menuList[i].IsEnabled = true;
|
1493
|
|
- Subscript = i;
|
1494
|
|
- IsModify = true;
|
|
1506
|
+ if (buttons[i] == sender)
|
|
1507
|
+ {
|
|
1508
|
+ pageData.menuList[i].IsEnabled = true;
|
|
1509
|
+ Subscript = i;
|
|
1510
|
+ IsModify = true;
|
|
1511
|
+ }
|
1495
|
1512
|
}
|
1496
|
1513
|
}
|
|
1514
|
+
|
1497
|
1515
|
}
|
1498
|
1516
|
|
1499
|
1517
|
private int MouseNumber = 0;
|
|
@@ -1654,32 +1672,46 @@ namespace XHWK.WKTool
|
1654
|
1672
|
private bool ModifyPathName(string FileGuid, string NewName, out string Errmessage)
|
1655
|
1673
|
{
|
1656
|
1674
|
Errmessage = "";
|
1657
|
|
- Model_Video model_Video = APP.VideoList.Find(x => x.FileGuid == FileGuid);
|
1658
|
|
- string filePathName = model_Video.VideoPath;
|
1659
|
|
- string filePath = FileToolsCommon.GetDirectoryName(filePathName);
|
1660
|
|
- string newFilePathName = filePath + NewName;
|
1661
|
|
- //缩略图
|
1662
|
|
- string ThumbnailPath = filePath + "ThumbnailPath/";
|
1663
|
|
- FileToolsCommon.CreateDirectory(ThumbnailPath);
|
1664
|
|
- //缩略图存储位置
|
1665
|
|
- string ThumbnailPathName = ThumbnailPath + NewName.Replace(".", "") + ".JPG";
|
1666
|
|
- if (FileToolsCommon.IsExistFile(newFilePathName))
|
1667
|
|
- {
|
1668
|
|
- Errmessage = "文件已存在,请重新修改文件名!";
|
1669
|
|
- return false;
|
1670
|
|
- }
|
1671
|
|
- else
|
|
1675
|
+ foreach(Model_WKData WKData in APP.WKDataList)
|
1672
|
1676
|
{
|
1673
|
|
- //修改文件名
|
1674
|
|
- FileToolsCommon.Copy(filePathName, newFilePathName);
|
1675
|
|
- model_Video.VideoPath = newFilePathName;
|
1676
|
|
- //修改缩略图名
|
1677
|
|
- FileToolsCommon.DeleteFile(ThumbnailPathName);
|
1678
|
|
- FileToolsCommon.Copy(model_Video.ThumbnailPath, ThumbnailPathName);
|
1679
|
|
- model_Video.ThumbnailPath = ThumbnailPathName;
|
1680
|
|
- APP.SaveWkData();
|
1681
|
|
- return true;
|
|
1677
|
+ if (WKData.VideoList.Exists(x => x.FileGuid == FileGuid))
|
|
1678
|
+ {
|
|
1679
|
+
|
|
1680
|
+ Model_Video model_Video = WKData.VideoList.Find(x => x.FileGuid == FileGuid);
|
|
1681
|
+
|
|
1682
|
+ string filePathName = model_Video.VideoPath;
|
|
1683
|
+ string filePath = FileToolsCommon.GetDirectoryName(filePathName);
|
|
1684
|
+ string newFilePathName = filePath + NewName;
|
|
1685
|
+ //缩略图
|
|
1686
|
+ string ThumbnailPath = filePath + "ThumbnailPath/";
|
|
1687
|
+ FileToolsCommon.CreateDirectory(ThumbnailPath);
|
|
1688
|
+ //缩略图存储位置
|
|
1689
|
+ string ThumbnailPathName = ThumbnailPath + NewName.Replace(".", "") + ".JPG";
|
|
1690
|
+ if (FileToolsCommon.IsExistFile(newFilePathName))
|
|
1691
|
+ {
|
|
1692
|
+ Errmessage = "文件已存在,请重新修改文件名!";
|
|
1693
|
+ return false;
|
|
1694
|
+ }
|
|
1695
|
+ else
|
|
1696
|
+ {
|
|
1697
|
+ //修改文件名
|
|
1698
|
+ FileToolsCommon.Copy(filePathName, newFilePathName);
|
|
1699
|
+ model_Video.VideoPath = newFilePathName;
|
|
1700
|
+ //修改缩略图名
|
|
1701
|
+ FileToolsCommon.DeleteFile(ThumbnailPathName);
|
|
1702
|
+ FileToolsCommon.Copy(model_Video.ThumbnailPath, ThumbnailPathName);
|
|
1703
|
+ model_Video.ThumbnailPath = ThumbnailPathName;
|
|
1704
|
+ APP.SaveWkData();
|
|
1705
|
+ return true;
|
|
1706
|
+ }
|
|
1707
|
+ }
|
|
1708
|
+ else
|
|
1709
|
+ {
|
|
1710
|
+ continue;
|
|
1711
|
+ }
|
1682
|
1712
|
}
|
|
1713
|
+ Errmessage = "视频文件有改动,当前文件不存在,请关闭后重新打开“我的”";
|
|
1714
|
+ return false;
|
1683
|
1715
|
}
|
1684
|
1716
|
|
1685
|
1717
|
#endregion
|