public void LoadItems() { _itemsCollection.Clear(); pnMain.Controls.Clear(); if (ViewSettingsManager.Instance.SimpleSummaryState.ItemsState.Count > 0) { foreach (var itemState in ViewSettingsManager.Instance.SimpleSummaryState.ItemsState) { var item = new SimpleSummaryItemControl(this); item.ItemNumber = _itemsCollection.Count() + 1; item.LoadSavedState(itemState); _itemsCollection.Add(item); pnMain.Controls.Add(item); } } else { var firstItem = new SimpleSummaryItemControl(this); firstItem.ItemNumber = _itemsCollection.Count() + 1; _itemsCollection.Add(firstItem); pnMain.Controls.Add(firstItem); var secondItem = new SimpleSummaryItemControl(this); secondItem.ItemNumber = _itemsCollection.Count() + 1; _itemsCollection.Add(secondItem); pnMain.Controls.Add(secondItem); } RefreshItems(); pnMain.ScrollControlIntoView(_itemsCollection[0]); }
public void AddItem() { var item = new SimpleSummaryItemControl(this); item.ItemNumber = _itemsCollection.Count() + 1; _itemsCollection.Add(item); pnMain.Controls.Add(item); RefreshItems(); pnMain.ScrollControlIntoView(item); TabHomeMainPage.Instance.SlideSimpleSummary.UpdateTotalValues(); TabHomeMainPage.Instance.SlideSimpleSummary.UpdateOutputState(); }