private void DeleteParameters_Click(object sender, RoutedEventArgs e)
        {
            Button button = sender as Button;
            ParameterKeyValuePair param         = button.DataContext as ParameterKeyValuePair;
            LayerChainItem        selectedLayer = ChainListBox.SelectedItem as LayerChainItem;

            int index = selectedLayer.ParameterKeys.IndexOf(param.Key.Value);

            selectedLayer.ParameterKeys.RemoveAt(index);
            selectedLayer.ParameterValues.RemoveAt(index);

            Parameters.Remove(param);

            if (ParameterRemoved != null)
            {
                ParameterRemoved(this, new ParameterAddedOrRemovedEventArgs(false, selectedLayer, param));
            }
        }
        private void AddParameter_Click(object sender, RoutedEventArgs e)
        {
            ParameterKeyValuePair param         = new ParameterKeyValuePair(KeyBox.Text, ValueBox.Text);
            LayerChainItem        selectedLayer = ChainListBox.SelectedItem as LayerChainItem;

            if (selectedLayer.ParameterKeys.Contains(KeyBox.Text))
            {
                int index = selectedLayer.ParameterKeys.IndexOf(KeyBox.Text);
                selectedLayer.ParameterKeys.RemoveAt(index);
                selectedLayer.ParameterValues.RemoveAt(index);
            }
            selectedLayer.ParameterKeys.Add(KeyBox.Text);
            selectedLayer.ParameterValues.Add(ValueBox.Text);

            Parameters.Add(param);

            if (ParameterAdded != null)
            {
                ParameterAdded(this, new ParameterAddedOrRemovedEventArgs(true, selectedLayer, param));
            }
        }
 public ParameterAddedOrRemovedEventArgs(bool added, LayerChainItem layer, ParameterKeyValuePair parameter)
 {
     Added = added;
     Layer = layer;
     Parameter = parameter;
 }
        private void AddParameter_Click(object sender, RoutedEventArgs e)
        {
            ParameterKeyValuePair param = new ParameterKeyValuePair(KeyBox.Text, ValueBox.Text);
            LayerChainItem selectedLayer = ChainListBox.SelectedItem as LayerChainItem;

            if (selectedLayer.ParameterKeys.Contains(KeyBox.Text))
            {
                int index = selectedLayer.ParameterKeys.IndexOf(KeyBox.Text);
                selectedLayer.ParameterKeys.RemoveAt(index);
                selectedLayer.ParameterValues.RemoveAt(index);
            }
            selectedLayer.ParameterKeys.Add(KeyBox.Text);
            selectedLayer.ParameterValues.Add(ValueBox.Text);

            Parameters.Add(param);

            if (ParameterAdded != null)
                ParameterAdded(this, new ParameterAddedOrRemovedEventArgs(true, selectedLayer, param));
        }
 public ParameterAddedOrRemovedEventArgs(bool added, LayerChainItem layer, ParameterKeyValuePair parameter)
 {
     Added     = added;
     Layer     = layer;
     Parameter = parameter;
 }