tangxu
2024-12-16 23fadc9cb0c09b665a1bbcef7eaf16f916045dc4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#region Imports
 
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
 
#endregion
 
namespace DPumpHydr.WinFrmUI.RLT.Child.Metro
{
    #region MetroItemCollectionChild
 
    public class MetroItemCollection : Collection<object>
    {
        public event EventHandler ItemUpdated;
 
        public delegate void EventHandler(object sender, EventArgs e);
 
        public void AddRange(IEnumerable<object> items)
        {
            foreach (object item in items)
            {
                Add(item);
            }
        }
 
        protected new void Add(object item)
        {
            base.Add(item);
            ItemUpdated?.Invoke(this, null);
        }
 
        protected override void InsertItem(int index, object item)
        {
            base.InsertItem(index, item);
            ItemUpdated?.Invoke(this, null);
        }
 
        protected override void RemoveItem(int value)
        {
            base.RemoveItem(value);
            ItemUpdated?.Invoke(this, null);
        }
 
        protected new void Clear()
        {
            base.Clear();
            ItemUpdated?.Invoke(this, null);
        }
 
        protected override void ClearItems()
        {
            base.ClearItems();
            ItemUpdated?.Invoke(this, null);
        }
    }
 
    #endregion
}