private void DeleteRef_Click(object sender, RoutedEventArgs e) { if (foundVersionModel == null) { MessageBox.Show("软件错误,请联系管理员"); return; } if (foundVersionModel.versionList.Count != 0) { if (NoAskNsg.Show("删除非空引用将删除其下所有版本,确认删除吗?", "删除引用") == false) { return; } } //MessageBox.Show("正在删除"); //以后还要在这里实现删除的时候连带所有的引用一并删除!!! if (MainFolder.AskDeleteAllRef(foundVersionModel.FileName, null, "") == false) { return; } MainFolder.CommitDeleteRef(foundVersionModel.FileName, null); refManager.DeleteRef(foundVersionModel.FileName); Versions.Remove(foundVersionModel); ShowFolderTree(); ShowVersionTree(); }
public bool AskDeleteAllRef(String tarFileName, String tarVersionName, String FatherPath) { switch (Type) { case Type_File: if (FileName.Equals(tarFileName)) { if (tarVersionName == null) //忽略版本信息 { if (NoAskNsg.Show("确认删除:" + FatherPath + FileName, "删除确认") == false) { return(false); } } else { if (VersionName.Equals(tarVersionName)) { if (NoAskNsg.Show("确认删除:" + FatherPath + FileName, "删除确认") == false) { return(false); } } } } break; case Type_Folder: foreach (FileAndFolderModel child in Children) { if (child.AskDeleteAllRef(tarFileName, tarVersionName, FatherPath + FolderName + "/") == false) { return(false); } } break; } return(true); }