private void AddPublishProfileButton_Click(object sender, EventArgs e) { ProfileSelectionForm form = new ProfileSelectionForm(); if (form.ShowDialog() == DialogResult.OK) { var selectedProfiles = form.SelectedProfiles; if (selectedProfiles.Count > 0) { RaisePropertyChangedEvent(new System.ComponentModel.PropertyChangedEventArgs("natsplugin")); } foreach (var p in selectedProfiles) { if (_plugin.Publishes.FirstOrDefault(x => x.Profile == p) == null) { Publish pub = new Publish() { Profile = p, Subject = "*" }; _plugin.Publishes.Add(pub); ProfileSubjectControl c = new ProfileSubjectControl(pub, _plugin); c.PropertyChanged += ProfileSubjectPropertyChanged; publishPanel.Controls.Add(c); } } } }
private void AddSubscribeProfileButton_Click(object sender, EventArgs e) { ProfileSelectionForm form = new ProfileSelectionForm(); if (form.ShowDialog() == DialogResult.OK) { var selectedProfiles = form.SelectedProfiles; foreach (var p in selectedProfiles) { if (_plugin.Subscribes.FirstOrDefault(x => x.Profile == p) == null) { Subscribe sub = new Subscribe() { Profile = p, Subject = "*" }; _plugin.Subscribes.Add(sub); ProfileSubjectControl c = new ProfileSubjectControl(sub, _plugin); c.PropertyChanged += ProfileSubjectPropertyChanged; subscribePanel.Controls.Add(c); } } } }