systemfixedcontactgroup.cs

来自「破解的飞信源代码」· CS 代码 · 共 106 行

CS
106
字号
namespace Imps.Client.Pc.BizControls
{
    using Imps.Client.Core;
    using System;
    using System.Runtime.CompilerServices;

    public class SystemFixedContactGroup
    {
        private ContactCollection _contacts;
        private int _id;
        private IsBelongDelegete _isBelong;
        private string _name;
        private User _owner;
        private int _sortIndex;

        public event EventHandler InfoChanged;

        public SystemFixedContactGroup(User owner, int id, string name, int sortIndex, IsBelongDelegete isBelongDelegete)
        {
            this._owner = owner;
            this._isBelong = isBelongDelegete;
            this._name = name;
            this._id = id;
            this._sortIndex = sortIndex;
            this._contacts = new ContactCollection();
        }

        public bool IsBelong(Contact contact)
        {
            if (this._isBelong != null)
            {
                return this._isBelong(contact);
            }
            return false;
        }

        public bool UpdateBelong(Contact contact)
        {
            if (this.IsBelong(contact))
            {
                if (this.Contacts[contact.Uri.Raw] == null)
                {
                    this.Contacts.Add(contact);
                    if (this.InfoChanged != null)
                    {
                        this.InfoChanged(this, EventArgs.Empty);
                    }
                }
                return true;
            }
            if (this.Contacts[contact.Uri.Raw] != null)
            {
                this.Contacts.Remove(contact);
                if (this.InfoChanged != null)
                {
                    this.InfoChanged(this, EventArgs.Empty);
                }
            }
            return false;
        }

        public ContactCollection Contacts
        {
            get
            {
                return this._contacts;
            }
        }

        public int Id
        {
            get
            {
                return this._id;
            }
        }

        public string Name
        {
            get
            {
                return this._name;
            }
        }

        public User Owner
        {
            get
            {
                return this._owner;
            }
        }

        public int SortIndex
        {
            get
            {
                return this._sortIndex;
            }
        }

        public delegate bool IsBelongDelegete(Contact contact);
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?