コード例 #1
0
 /// <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);
         }
     }
 }
コード例 #2
0
 /// <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();
     }
 }
コード例 #3
0
    /// <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);
        }
    }
コード例 #4
0
 /// <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;
             }
         }
     }
 }
コード例 #5
0
    /// <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();
        }
    }
コード例 #6
0
    /// <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);
        }
    }