public void AddTaskFile(TaskFile file) { if (file == null) { return; } file.SetParent(this); this.TaskFiles.SortedAdd(file); }
public bool RemoveTaskFile(String fileName) { TaskFile target = this.GetTaskFile(fileName); if (target == null) { return(false); } return(this.TaskFiles.Remove(target)); }
public override int CompareTo(ViNamedObject other) { TaskFile target = other as TaskFile; // 如果执行顺序小于等于0,则说明该Task是随机添加上去的,在排序的时候需要放到后面; if (this.ExectionOrder > 0 && target.ExectionOrder > 0) { return(this.ExectionOrder - target.ExectionOrder); } return(this.ExectionOrder > 0 ? -1 : 1); }
// ------------------------- 增、删、查、改 -------------------// #region Task 的增删查改操作 public void AddTaskFile(String fileName, int order = 0) { if (String.IsNullOrEmpty(fileName)) { return; } fileName = Path.GetFileNameWithoutExtension(fileName); TaskFile file = new TaskFile(fileName, order); file.SetParent(this); this.TaskFiles.SortedAdd(file); }
public bool HasLinked(String fileName) { TaskFile target = null; foreach (var item in this.Tasks) { target = item.GetTaskFile(fileName); if (target != null) { break; } } return(target != null); }
public bool RenameTaskFile(String oldFileName, String newFileName) { if (String.IsNullOrEmpty(oldFileName) || String.IsNullOrEmpty(newFileName)) { return(false); } TaskFile target = this.GetTaskFile(oldFileName); if (target == null) { return(false); } newFileName = Path.GetFileNameWithoutExtension(newFileName); target.Name = newFileName; return(true); }