private void updateList() { var unlocks = this.controller.UnlockPriorities.ToList(); unlockedList.SuspendLayout(); while (unlockedList.Controls.Count < unlocks.Count) { var topicControl = new DevelopmentItem(); topicControl.MouseEnter += unlock_OnMouseEnter; topicControl.MouseLeave += unlock_OnMouseLeave; unlockedList.Controls.Add(topicControl); } for (int i = 0; i < unlocks.Count; i++) { (unlockedList.Controls[i] as DevelopmentItem).SetData(unlocks[i]); } unlockedList.ResumeLayout(); }
private void updateList() { topicList.SuspendLayout(); while (topicList.Controls.Count < topics.Count) { var topicControl = new DevelopmentItem(); topicControl.MouseEnter += topic_OnMouseEnter; topicControl.MouseLeave += topicList_OnMouseLeave; topicList.Controls.Add(topicControl); } while (topicList.Controls.Count > topics.Count) { topicList.Controls.RemoveAt(topicList.Controls.Count - 1); } for (int i = 0; i < topics.Count; i++) { (topicList.Controls[i] as DevelopmentItem).SetData(topics[i]); } topicList.ResumeLayout(); }