/// <summary> /// 删除子项的标记 /// </summary> /// <param name="key"></param> /// <param name="childFlag"></param> public void DeletChildFlag(EnumRedPoint key, int childFlag) { if (redList.ContainsKey((int)key)) { List <int> ls = null; redList.TryGetValue((int)key, out ls); if (ls != null) { int isHave = -1; for (int i = 0; i < ls.Count; i++) { if (ls[i] == childFlag) { isHave = i; break; } } if (isHave != -1) { ls.RemoveAt(isHave); } if (ls.Count < 1) { DeletType(key); } } else { DeletType(key); } } }
/// <summary> /// 从列表中移除整个大类 /// </summary> /// <param name="key"></param> /// <param name="rd"></param> public void DeletType(EnumRedPoint key) { if (redList.ContainsKey((int)key)) { redList.Remove((int)key); NotifyChange(); } }
/// <summary> /// 获取大类里子项的所有标记返回boollist按传进来的顺序反回自己区分.没有匹配反回null /// </summary> /// <param name="key"></param> /// <returns></returns> public List <bool> GetChildList(EnumRedPoint key, params int[] ChildKey) { if (ChildKey.Length <= 0) { return(null); } List <int> ls = null; List <bool> isShow = null; if (redList.ContainsKey((int)key)) { redList.TryGetValue((int)key, out ls); } if (ChildKey.Length > 0 && ls != null) { isShow = new List <bool>(); for (int i = 0; i < ChildKey.Length; i++) { bool isHave = false; for (int j = 0; j < ls.Count; j++) { if (ChildKey[i] == ls[j]) { isHave = true; break; } } if (isHave) { isShow.Add(true); } else { isShow.Add(false); } } return(isShow); } else { return(null); } }
/// <summary> /// 服务器返回数据添加到字典中或用于客户端更新字典状态 /// </summary> /// <param name="key"></param> /// <param name="rd"></param> public void Add(EnumRedPoint key, List <int> rd) { if (GetunlockFunction((int)key) != -1) { if (DataDefine.isSkipFunction || FunctionOpenMng.GetInstance().GetFunctionOpen(GetunlockFunction((int)key))) { if (!redList.ContainsKey((int)key)) { redList.Add((int)key, rd); } else { //List<int> ls = null; //redList.TryGetValue((int)key, out ls); //ls = rd; if (rd != null) { redList[(int)key] = rd; } } } } else { if (!redList.ContainsKey((int)key)) { redList.Add((int)key, rd); } else { //List<int> ls = null; //redList.TryGetValue((int)key, out ls); //ls = rd; if (rd != null) { redList[(int)key] = rd; } } } }
/// <summary> /// 添加子项的标记 /// </summary> /// <param name="key"></param> /// <param name="childFlag"></param> public void AddChildFlag(EnumRedPoint key, int childFlag) { List <int> ls = null; if (redList.ContainsKey((int)key)) { redList.TryGetValue((int)key, out ls); bool isHave = false; if (ls != null) { for (int i = 0; i < ls.Count; i++) { if (ls[i] == childFlag) { isHave = true; break; } } if (!isHave) { ls.Add(childFlag); } } else { redList.Remove((int)key); ls = new List <int>(); ls.Add(childFlag); Add(key, ls); } } else { ls = new List <int>(); ls.Add(childFlag); Add(key, ls); NotifyChange(); } }
/// <summary> /// 获取大类里面单一子项的标记列表. /// </summary> /// <param name="key"></param> /// <returns></returns> public bool GetChildList(EnumRedPoint key, int childKey) { List <int> ls = null; if (redList.ContainsKey((int)key)) { redList.TryGetValue((int)key, out ls); if (ls != null) { bool isHave = false; for (int i = 0; i < ls.Count; i++) { if (ls[i] == childKey) { isHave = true; } } if (isHave) { return(true); } else { return(false); } } else { return(false); } } else { return(false); } }