private void btnAddTopic_Click(object sender, EventArgs e) { TopicForm topic = new TopicForm(string.Empty, Common.FormMode.Add); DialogResult dr = topic.ShowDialog(); if (dr == DialogResult.OK) { bool retVal = Data.TheData.AddTopicByName(topic.TopicName, topic.TopicUrl, topic.TopicEntries); if (false == retVal) { if (_data == null) { new MyMessageBox(Constants.TITLE_ATTENTION, string.Format(Constants.TOPIC_ADD_FAILED, topic.TopicName), MessageBoxButtons.OK).ShowDialog(); } else { new MyMessageBox(Constants.TITLE_ATTENTION, string.Format(Constants.TOPIC_EXISTS, topic.TopicName), MessageBoxButtons.OK).ShowDialog(); } } } RefreshData(); }
private void btnEditTopic_Click(object sender, EventArgs e) { string topicName = lstTopics.SelectedItems[0].Text; TopicForm tf = new TopicForm(topicName, Common.FormMode.Edit); DialogResult dr = tf.ShowDialog(); if (dr == DialogResult.OK) { Topic newTopic = new Topic(); newTopic.data = tf.TopicEntries; newTopic.name = tf.TopicName; newTopic.url = tf.TopicUrl; Data.TheData.UpdateTopic(newTopic); } RefreshData(); }
private void mnuOpenTopic_Click(object sender, EventArgs e) { this.Visible = false; string topicName = lstSearchResults.SelectedItems[0].Text; TopicForm tf = new TopicForm(topicName, Common.FormMode.Edit); DialogResult dr = tf.ShowDialog(); if (dr == DialogResult.OK) { Topic newTopic = new Topic(); newTopic.data = tf.TopicEntries; newTopic.name = tf.TopicName; newTopic.url = tf.TopicUrl; Data.TheData.UpdateTopic(newTopic); } this.Visible = true; }