public void AddItem() { var item = new SimpleSummaryItemControl(this); item.ItemNumber = _itemsCollection.Count() + 1; item.Changed += OnItemChanged; _itemsCollection.Add(item); pnMain.Controls.Add(item); RefreshItems(); pnMain.ScrollControlIntoView(item); ItemCollectionChanged?.Invoke(this, EventArgs.Empty); }
public void LoadItems(IEnumerable<SimpleSummaryItemState> itemStates) { _itemStates.Clear(); _itemStates.AddRange(itemStates); _itemsCollection.Clear(); pnMain.Controls.Clear(); foreach (var itemState in _itemStates) { var item = new SimpleSummaryItemControl(this); item.ItemNumber = _itemsCollection.Count + 1; item.LoadSavedState(itemState); item.Changed += OnItemChanged; _itemsCollection.Add(item); pnMain.Controls.Add(item); } RefreshItems(); pnMain.ScrollControlIntoView(_itemsCollection[0]); }
public void LoadItems(IEnumerable <SimpleSummaryItemState> itemStates) { _itemStates.Clear(); _itemStates.AddRange(itemStates); _itemsCollection.Clear(); pnMain.Controls.Clear(); foreach (var itemState in _itemStates) { var item = new SimpleSummaryItemControl(this); item.ItemNumber = _itemsCollection.Count + 1; item.LoadSavedState(itemState); item.Changed += OnItemChanged; _itemsCollection.Add(item); pnMain.Controls.Add(item); } RefreshItems(); pnMain.ScrollControlIntoView(_itemsCollection[0]); }