Exemple #1
0
        public void AddTaskFile(TaskFile file)
        {
            if (file == null)
            {
                return;
            }

            file.SetParent(this);
            this.TaskFiles.SortedAdd(file);
        }
Exemple #2
0
        public bool RemoveTaskFile(String fileName)
        {
            TaskFile target = this.GetTaskFile(fileName);

            if (target == null)
            {
                return(false);
            }

            return(this.TaskFiles.Remove(target));
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        // ------------------------- 增、删、查、改 -------------------//

        #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);
        }
Exemple #6
0
        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);
        }