/// <summary> /// 删除操作 /// </summary> /// <param name="oper"></param> /// <returns></returns> public bool Delete(ElectrodeCAMTreeInfo info) { if (info.Program is ProgramOperationName) { ProgramOperationName temp = info.Program as ProgramOperationName; if (this.template.Programs.Exists(a => a.Equals(temp))) { this.template.DeleteProgram(temp); GetTreeInfo(); return(true); } else { return(false); } } if (info.Program is AbstractCreateOperation) { AbstractCreateOperation temp = info.Program as AbstractCreateOperation; if (info.Parent != null && info.Parent.Program is ProgramOperationName) { ProgramOperationName tp = info.Parent.Program as ProgramOperationName; if (tp.Oper.Exists(a => a.Equals(temp))) { tp.DeleteOperationNameModel(temp); GetTreeInfo(); return(true); } } } return(false); }
/// <summary> /// 向上移动 /// </summary> /// <param name="info"></param> /// <returns></returns> public bool MoveUp(ElectrodeCAMTreeInfo info) { if (info.Program is ProgramOperationName) { ProgramOperationName temp = info.Program as ProgramOperationName; int count = this.template.Programs.FindIndex(a => a.Equals(temp)); if (this.template.Programs.Exists(a => a.Equals(temp))) { if (count != 0 && count != -1) { this.template.DeleteProgram(count); this.template.AddProgram(temp, count - 1); GetTreeInfo(); return(true); } } else { return(false); } } if (info.Program is AbstractCreateOperation) { AbstractCreateOperation temp = info.Program as AbstractCreateOperation; if (info.Parent != null && info.Parent.Program is ProgramOperationName) { ProgramOperationName tp = info.Parent.Program as ProgramOperationName; int count = tp.Oper.FindIndex(a => a.Equals(temp)); if (tp.Oper.Exists(a => a.Equals(temp))) { if (count != 0 && count != -1) { tp.DeleteOperationNameModel(temp); tp.AddOperationNameModel(temp, count - 1); GetTreeInfo(); return(true); } } } } return(false); }