| | |
| | | if (checkRepeat == true) |
| | | { |
| | | //检测重复 |
| | | for (int i = 0; i < Functions.Count; i++) |
| | | var same = Functions.FindAll((obj) => obj.deviceId == tempFunction.deviceId); |
| | | if(same!= null) |
| | | { |
| | | if (Functions[i].deviceId == tempFunction.deviceId) |
| | | foreach(var sameTemp in same) |
| | | { |
| | | //先移除掉再加 |
| | | Functions.RemoveAt(i); |
| | | Functions.Add(tempFunction); |
| | | return; |
| | | Functions.Remove(sameTemp); |
| | | } |
| | | } |
| | | //for (int i = 0; i < Functions.Count; i++) |
| | | //{ |
| | | // if (Functions[i].deviceId == tempFunction.deviceId) |
| | | // { |
| | | // //先移除掉再加 |
| | | // Functions.RemoveAt(i); |
| | | // Functions.Add(tempFunction); |
| | | // return; |
| | | // } |
| | | //} |
| | | } |
| | | Functions.Add(tempFunction); |
| | | } |