?? treenodecontactcollection.cs
字號:
?namespace Imps.Client.Pc.UIContactList
{
using Imps.Client.Pc.BizControls;
using Imps.Common;
using System;
using System.Collections;
using System.Collections.Generic;
public class TreeNodeContactCollection : ICollection<TreeNodeContact>, IEnumerable<TreeNodeContact>, IEnumerable
{
private List<TreeNodeContact> _col = new List<TreeNodeContact>();
public void Add(TreeNodeContact item)
{
this._col.Add(item);
}
public void Add(NodeKey nodeKeyValue, int groupId)
{
TreeNodeContact item = new TreeNodeContact(nodeKeyValue, groupId);
this._col.Add(item);
}
public void Add(NodeKey nodeKeyValue, string uri)
{
TreeNodeContact item = new TreeNodeContact(nodeKeyValue, uri);
this._col.Add(item);
}
public void Clear()
{
this._col.Clear();
}
public bool Contains(TreeNodeContact item)
{
return this._col.Contains(item);
}
public void CopyTo(TreeNodeContact[] array, int arrayIndex)
{
throw new NotSupportedException();
}
public int? FindContactGroupId(NodeKey nodeKeyValue)
{
foreach (TreeNodeContact contact in this._col)
{
if (!contact.IsContactNode && (contact.NodeKeyValue == nodeKeyValue))
{
return new int?(contact.ContactGroupId);
}
}
return null;
}
public NodeKey FindContactGroupNodeKey(int contactGroupId)
{
foreach (TreeNodeContact contact in this._col)
{
if (!contact.IsContactNode && (contact.ContactGroupId == contactGroupId))
{
return contact.NodeKeyValue;
}
}
return null;
}
public NodeKeyCollection FindContactNodeKey(string uri)
{
if (!new IicUri(uri).IsValid)
{
return null;
}
NodeKeyCollection keys = new NodeKeyCollection();
foreach (TreeNodeContact contact in this._col)
{
if (contact.IsContactNode && (contact.ContactUri == uri))
{
keys.Add(contact.NodeKeyValue);
}
}
return keys;
}
public string FindContactUri(NodeKey nodeKeyValue)
{
foreach (TreeNodeContact contact in this._col)
{
if (contact.IsContactNode && (contact.NodeKeyValue == nodeKeyValue))
{
return contact.ContactUri;
}
}
return string.Empty;
}
public IEnumerator<TreeNodeContact> GetEnumerator()
{
return this._col.GetEnumerator();
}
public void Remove(NodeKey nodeKey)
{
for (int i = this._col.Count - 1; i >= 0; i--)
{
if (this._col[i].IsContactNode && (this._col[i].NodeKeyValue == nodeKey))
{
this._col.RemoveAt(i);
}
}
}
public bool Remove(TreeNodeContact item)
{
return (this.Contains(item) && this._col.Remove(item));
}
public void Remove(int groupId)
{
for (int i = this._col.Count - 1; i >= 0; i--)
{
if (!this._col[i].IsContactNode && (this._col[i].ContactGroupId == groupId))
{
this._col.RemoveAt(i);
}
}
}
public void Remove(string contactUri)
{
for (int i = this._col.Count - 1; i >= 0; i--)
{
if (this._col[i].IsContactNode && (this._col[i].ContactUri == contactUri))
{
this._col.RemoveAt(i);
}
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
public int Count
{
get
{
return this._col.Count;
}
}
public bool IsReadOnly
{
get
{
return this._col.IsReadOnly;
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -