private void InputsMouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { if (this.Inputs.SelectedValue == null) { return; } var kvp = (KeyValuePair <string, string>) this.Inputs.SelectedValue; var editor = new KeyValueEditor(this.customInputType, kvp.Key, kvp.Value) { Owner = Window.GetWindow(this), Title = "Edit Custom Input" }; if (editor.ShowDialog() == true) { if (!string.IsNullOrEmpty(editor.Key) && !string.IsNullOrEmpty(editor.Value)) { var newKvp = new KeyValuePair <string, string>(editor.Key, editor.Value); if (!this.customInputs.ContainsKey(newKvp.Key)) { this.customInputs.RemoveAt(this.Inputs.SelectedIndex); this.customInputs.Add(newKvp); OnItemChanged(); } } } }
private void InputsAddClick(object sender, System.Windows.RoutedEventArgs e) { var editor = new KeyValueEditor(this.customInputType) { Owner = Window.GetWindow(this), Title = "New Custom Input" }; if (editor.ShowDialog() == true) { if (!string.IsNullOrEmpty(editor.Key) && !string.IsNullOrEmpty(editor.Value)) { var kvp = new KeyValuePair <string, string>(editor.Key, editor.Value); if (!this.customInputs.ContainsKey(kvp.Key)) { this.customInputs.Add(kvp); OnItemChanged(); } } } }