private void createFeedGroup() { FilteredFeedFormControlComposer feedGroupComposer = new FilteredFeedFormControlComposer(); IFilteredFeedFormControlBuilder feedGroupBuilder = new FeedGroupBuilder(); feedGroupComposer.Build(feedGroupBuilder, this); FeedGroup feedGroup = feedGroupBuilder.Control as FeedGroup; //giving a reference to a method, by a lambda expression, also ivoked by the notifyer attachButton on click: this.AttachButtons[feedGroup.m_Number - 1].m_AttachButtonDelegates += (() => this.FeedGroups[feedGroup.m_Number - 1].ButtonBuildFeedFeedGroup.Enabled = true); feedGroup.Dock = DockStyle.Right; this.FeedGroups.Add(feedGroup); this.groupBoxFeedGroups.Controls.Add(feedGroup); }
private void RemoveFriendFromFeed() { User selectedFriend = this.ListBoxFriendsFeed.SelectedItem as User; FeedGroup attachedFeedGroup = this.m_Form.FeedGroups[this.m_Number - 1]; this.m_Form.ListBoxFriends.Items.Add(selectedFriend); // Add to Form friend list attachedFeedGroup.ListBoxFeedGroup.Items.Remove(selectedFriend); // Remove from attached FeedGroup friend list attachedFeedGroup.m_FeedBuilder.SetSettings(); attachedFeedGroup.TextBoxFeedGroup.Text = string.Empty; this.PictureBoxFriendFeed.Image = null; if (this.ListBoxFriendsFeed.Items.Count == 0) { this.m_Form.TabControl.TabPages.Remove(this.m_Form.TabControl.TabPages[this.m_Number]); } }