public IEnumerable <ManageableProgressive> AddRange(IEnumerable <IProgressive> progressives) { var mp = progressives.Select(x => new ManageableProgressive(this, x)).ToArray(); lock (this) { var @new = new ManageableProgressive[Count + mp.Length]; var i = 0; foreach (var item in _items) { if (item != null) { @new[i] = item; i++; } } foreach (var m in mp) { m.ProgressCompleted += Item_ProgressCompleted; m.ProgressValueChanged += Item_ProgressValueChanged; @new[i] = m; i++; } Count = Count + mp.Length; _items = @new; } return(mp); }
public ManageableProgressive Add(IProgressive progressive) { var mp = new ManageableProgressive(this, progressive); mp.ProgressCompleted += Item_ProgressCompleted; mp.ProgressValueChanged += Item_ProgressValueChanged; lock (this) { var @new = new ManageableProgressive[Count + 1]; var i = 0; foreach (var item in _items) { if (item != null) { @new[i] = item; i++; } } @new[i] = mp; Count = Count + 1; _items = @new; } return(mp); }