NotifyBufferChangedEventArgs.cs 1.85 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FLY.OBJComponents.Common
{
    public interface INotifyBufferChanged<T>
    {
        //
        // 摘要:
        //     当集合更改时发生。
        event NotifyBufferChangedEventHandler<T> BufferChanged;
    }

    public delegate void NotifyBufferChangedEventHandler<T>(object sender, NotifyBufferChangedEventArgs<T> e);

    public class NotifyBufferChangedEventArgs<T> : EventArgs
    {
潘栩锋's avatar
潘栩锋 committed
21 22 23
        /// <summary>
        /// 动作
        /// </summary>
潘栩锋's avatar
潘栩锋 committed
24
        public NotifyBufferChangedAction Action { get; set; }
潘栩锋's avatar
潘栩锋 committed
25 26 27
        /// <summary>
        /// 被修改的数据,可能为空,需要再向Buffer 获取
        /// </summary>
28
        public IEnumerable<T> Items { get; set; }
潘栩锋's avatar
潘栩锋 committed
29 30 31
        /// <summary>
        /// 最后一条记录ID
        /// </summary>
32
        public int EndingID { get; set; }
潘栩锋's avatar
潘栩锋 committed
33 34 35 36 37 38 39 40 41 42 43 44
        /// <summary>
        /// 当前修改数据量
        /// </summary>
        public int Count { get; set; }
        /// <summary>
        /// 列表最后一条记录
        /// </summary>
        public int BufferNewestID { get; set; }
        /// <summary>
        /// 列表总数据量
        /// </summary>
        public int BufferCount { get; set; }
潘栩锋's avatar
潘栩锋 committed
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
    }

    public enum NotifyBufferChangedAction
    {
        //
        // 摘要:
        //     向集合中添加了一个或多个项。
        Add = 0,
        //
        // 摘要:
        //     从集合中移除了一个或多个项。
        Remove = 1,
        //
        // 摘要:
        //     在集合中替换了一个或多个项。
        Replace = 2,
        //
        // 摘要:
        //     集合的内容发生显著更改。
        Reset = 4,
        /// <summary>
        /// 刚连接上
        /// </summary>
        IsConnected=5
    }
}