Beispiel #1
0
        private void RemoveKeyword_Click(object sender, RoutedEventArgs e)
        {
            Keyword currentKeyword = KeywordLB.SelectedItem as Keyword;
            bool    bSuccess       = false;

            if (currentKeyword is null)
            {
                MessageBox.Show("Please select a keyword to be deleted.");
            }
            else
            {
                bSuccess = st.DeleteKeyword(currentKeyword);
                if (bSuccess)
                {
                    MessageBox.Show("The keyword: " + currentKeyword.KeywordName + " has been deleted from the keyword list");
                    Keywords.Remove(currentKeyword);
                    KeywordLB.Items.Refresh();
                    KeywordTB.Clear();
                }
            }
        }
Beispiel #2
0
        private void UpdateKeyword_Click(object sender, RoutedEventArgs e)
        {
            Keyword currentKeyword = KeywordLB.SelectedItem as Keyword;
            bool    bSuccess       = false;

            if (currentKeyword is null)
            {
                MessageBox.Show("Please select a keyword to be deleted.");
            }
            else
            {
                bSuccess = st.UpdateKeyword(currentKeyword, KeywordTB.Text);
                if (bSuccess)
                {
                    MessageBox.Show("The keyword: " + currentKeyword.KeywordName + " has been updated to: " + KeywordTB.Text);
                    Keywords.Where(name => name.KeywordName == currentKeyword.KeywordName).First().KeywordName = KeywordTB.Text;
                    KeywordLB.Items.Refresh();
                    KeywordTB.Clear();
                }
            }
        }