private void bnSetPublisher_Click(object sender, EventArgs e) { FormSelectPublisher selectPublisher = new FormSelectPublisher(true); if (selectPublisher.ShowDialog() == DialogResult.OK) { tbPublisher.Text = selectPublisher.SelectedPublisher; // Ensure that this publisher is in the publisher filter otherwise this application could disapp[ear SettingsDAO lwDataAccess = new SettingsDAO(); string publisherFilter = lwDataAccess.GetPublisherFilter(); if ((publisherFilter != "") && (!publisherFilter.Contains(tbPublisher.Text))) { publisherFilter = publisherFilter + ";" + tbPublisher.Text; lwDataAccess.SetPublisherFilter(publisherFilter); } } }
/// <summary> /// Called as we attempt to exit from this form - we need to save any changes made to the /// list of filtered publishers /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bnOK_Click(object sender, EventArgs e) { // Construct the updated filter string foreach (String publisher in lbFilteredPublishers.Items) { // ...add to the filter if (_publisherFilter == "") { _publisherFilter = publisher; } else { _publisherFilter = _publisherFilter + ";" + publisher; } } // ...and save the publisher filter back to the database SettingsDAO lwDataAccess = new SettingsDAO(); lwDataAccess.SetPublisherFilter(_publisherFilter); }