From f7063b6fb7b46e3612afb1c6bb426c94fb92593d Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 10 一月 2023 14:44:32 +0800 Subject: [PATCH] 设备加载优化 --- HDL_ON/Entity/FunctionList.cs | 20 ++++++++++++++------ 1 files changed, 14 insertions(+), 6 deletions(-) diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs index 450ef57..2999288 100644 --- a/HDL_ON/Entity/FunctionList.cs +++ b/HDL_ON/Entity/FunctionList.cs @@ -331,16 +331,24 @@ 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); } -- Gitblit v1.8.0