Exemplo n.º 1
0
        public void Remove(K _key, V _ValueToRemove)
        {
            List <V> tempValues;

            if (map.TryGetValue(_key, out tempValues))
            {
                if (tempValues.Remove(_ValueToRemove))
                {
                    RemoveValue?.Invoke(_ValueToRemove);

                    if (tempValues.Count == 0)
                    {
                        RemoveKey?.Invoke(_key);
                        map.Remove(_key);
                    }
                }
                else
                {
                    Console.WriteLine("The value " + _ValueToRemove + " could not be found in association with " + _key);
                }
            }
            else
            {
                Console.WriteLine("The key " + _key + " could not be found");
            }
        }
        private void contextMenuItem_PreviewMouseUp(object sender, MouseButtonEventArgs e)
        {
            APIKeyEntity removingKey = keysList.SelectedItem as APIKeyEntity;

            RemoveKey?.Invoke(sender, removingKey.KeyValue);
        }