public void AddActiveOfferToFlowLayoutPanel(ActiveOffer offer, FlowLayoutPanel flowLayoutPanel) { if (flowLayoutPanel.InvokeRequired) { AddActiveOfferToFlowLayoutPanelCallback d = new AddActiveOfferToFlowLayoutPanelCallback(AddActiveOfferToFlowLayoutPanel); Invoke(d, new object[] { offer, flowLayoutPanel }); } else { flowLayoutPanel.Controls.Add(offer); } }
private void updateOffers() { List <Offer> allOffers = OfferHandler.LoadOffers(); List <Offer> activeOffers = new List <Offer>(); List <Offer> inactiveOffers = new List <Offer>(); foreach (Offer offer in allOffers) { if (offer.isActive) { activeOffers.Add(offer); } else { inactiveOffers.Add(offer); } } if (!offerListsAreEqual(activeOffers, activeOffersLoaded)) // TODO: Should work with List.Equals { activeOffersFlowLayout.Controls.Clear(); foreach (Offer offer in activeOffers) { ActiveOffer activeOffer = new ActiveOffer(offer); AddActiveOfferToFlowLayoutPanel(activeOffer, activeOffersFlowLayout); } activeOffersLoaded = activeOffers; } if (!offerListsAreEqual(inactiveOffers, inactiveOffersLoaded)) // TODO: Should work with List.Equals { inactiveOffersFlowLayout.Controls.Clear(); foreach (Offer offer in inactiveOffers) { InactiveOffer inactiveOffer = new InactiveOffer(offer); AddInactiveOfferToFlowLayoutPanel(inactiveOffer, inactiveOffersFlowLayout); } inactiveOffersLoaded = inactiveOffers; } updateOffersPadding(); updateNewOfferNotifyIcons(); updateCanReplyNotifyIcons(); updateActiveChangedNotifyIcons(); updatePlacementChangedNotifyIcons(); }