private void BtnAdd_Click(object sender, RoutedEventArgs e)
        {
            AddModify addModify = new AddModify(context);

            if (addModify.ShowDialog() == true)
            {
                // Get the result
                NamePair pair = addModify.pair;

                // Add a new line to the dictionary
                context.nameDictionary.Add(pair);

                // Save the new dictionary
                context.SaveNewDictionary();

                // Refresh the list
                context.RefreshList();
            }

            btnAdd.Focus();
        }
        private void BtnModify_Click(object sender, RoutedEventArgs e)
        {
            // Get the selection
            if (lstNames.SelectedIndex >= 0)
            {
                NamePair pair = (NamePair)lstNames.Items[lstNames.SelectedIndex];

                // Search and modify
                int index = context.nameDictionary.FindIndex((NamePair p) => (p.id == pair.id) && (p.name == pair.name));

                if (index >= 0)
                {
                    AddModify addModify = new AddModify(context, pair.id, pair.name);
                    if (addModify.ShowDialog() == true)
                    {
                        // Get the result
                        NamePair pair_mod = addModify.pair;

                        // Add a new line to the dictionary
                        context.nameDictionary[index] = pair_mod;

                        // Save the new dictionary
                        context.SaveNewDictionary();

                        // Refresh the list
                        context.RefreshList();
                    }
                    else
                    {
                        return;
                    }
                }

                // Save the new dictionary
                context.SaveNewDictionary();

                // Refresh the list
                context.RefreshList();
            }
        }