/// <summary> /// Удалить набор операторов /// </summary> /// <param name="nodes">Список</param> public void RemoveNodes(IEnumerable <Node> nodes) { foreach (var node in nodes) { CodeList.Remove(node); } }
string GetRandomCode(int index) { if (CodeList.Count < 1) { return(string.Empty); } else if (CodeList[index] != null) { var temp = CodeList[index]; CodeList.Remove(temp); return(temp); } return(GetRandomCode(new Random(index).Next(0, CodeList.Count))); }
void Request(string code) { if (code != null && code.Equals(string.Empty) == false) { int param = DeadLine ? 4 : (code.Length > 6 ? (code.Substring(5, 3).Equals("000") ? 1 : 2) : 3); ITRs tr = (ITRs)catalogTR[param]; tr.Value = code; tr.RQName = string.Concat(code, ";", GetRetention(param, code)); tr.PrevNext = 0; request.RequestTrData(new Task(() => { InputValueRqData(tr); SendCount?.Invoke(this, new NotifyIconText(CodeList.Count, code)); })); return; } else if (CodeList.Count < 50) { foreach (var str in CodeList) { if (str == null || str.Equals(string.Empty)) { CodeList.Remove(str); } } } if (CodeList.Count == 0) { SendCount?.Invoke(this, new NotifyIconText(CodeList.Count, code)); CodeList = null; GC.Collect(); return; } Request(GetRandomCode(new Random().Next(0, CodeList.Count))); }
/// <summary> /// Удалить оператор /// </summary> /// <param name="node">Оператор</param> public bool RemoveNode(Node node) { return(CodeList.Remove(node)); }