public void OnEditSelected()
        {
            if (!EditEnabled)
            {
                return;
            }

            if (this.SelectedPresetVoiLut == null)
            {
                this.Host.DesktopWindow.ShowMessageBox(SR.MessagePleaseSelectAnItemToEdit, MessageBoxActions.Ok);
                return;
            }

            try
            {
                PresetVoiLutConfiguration       configuration = this.SelectedPresetOperation.GetConfiguration();
                IPresetVoiLutOperationComponent editComponent = this.SelectedPresetOperation.SourceFactory.GetEditComponent(configuration);
                editComponent.EditContext = EditContext.Edit;
                PresetVoiLutOperationsComponentContainer container = new PresetVoiLutOperationsComponentContainer(GetUnusedKeyStrokes(this.SelectedPresetVoiLut), editComponent);
                container.SelectedKeyStroke = this.SelectedPresetVoiLut.KeyStroke;

                if (ApplicationComponentExitCode.Accepted != ApplicationComponent.LaunchAsDialog(this.Host.DesktopWindow, container, SR.TitleEditPreset))
                {
                    return;
                }

                PresetVoiLut preset = container.GetPresetVoiLut();
                Platform.CheckForNullReference(preset, "preset");

                List <PresetVoiLut> conflictingItems = CollectionUtils.Select <PresetVoiLut>(_voiLutPresets.Items,
                                                                                             delegate(PresetVoiLut test){ return(preset.Equals(test)); });

                if (conflictingItems.Count == 0 ||
                    (conflictingItems.Count == 1 && conflictingItems[0].Equals(this.SelectedPresetVoiLut)))
                {
                    PresetVoiLut selected = this.SelectedPresetVoiLut;

                    int index = _voiLutPresets.Items.IndexOf(selected);
                    _voiLutPresets.Items.Remove(selected);

                    if (index < _voiLutPresets.Items.Count)
                    {
                        _voiLutPresets.Items.Insert(index, preset);
                    }
                    else
                    {
                        _voiLutPresets.Items.Add(preset);
                    }

                    Selection = null;

                    this.Modified = true;
                }
                else
                {
                    this.Host.DesktopWindow.ShowMessageBox(SR.MessageNameOrKeystrokeConflictsWithExistingPreset, MessageBoxActions.Ok);
                }
            }
            catch (Exception e)
            {
                ExceptionHandler.Report(e, SR.MessageFailedToEditPreset, this.Host.DesktopWindow);
            }
        }
        public void OnAdd()
        {
            if (!AddEnabled)
            {
                return;
            }

            try
            {
                IPresetVoiLutOperationComponent addComponent = SelectedAddFactory.Factory.GetEditComponent(null);
                addComponent.EditContext = EditContext.Add;

                PresetVoiLutOperationsComponentContainer container =
                    new PresetVoiLutOperationsComponentContainer(GetUnusedKeyStrokes(null), addComponent);

                if (ApplicationComponentExitCode.Accepted != ApplicationComponent.LaunchAsDialog(this.Host.DesktopWindow, container, SR.TitleAddPreset))
                {
                    return;
                }

                PresetVoiLut preset = container.GetPresetVoiLut();
                Platform.CheckForNullReference(preset, "preset");

                List <PresetVoiLut> conflictingItems = CollectionUtils.Select <PresetVoiLut>(_voiLutPresets.Items,
                                                                                             delegate(PresetVoiLut test){ return(preset.Equals(test)); });

                if (conflictingItems.Count == 0)
                {
                    _voiLutPresets.Items.Add(preset);
                    Selection = null;

                    this.Modified = true;
                }
                else
                {
                    this.Host.DesktopWindow.ShowMessageBox(SR.MessageNameOrKeystrokeConflictsWithExistingPreset, MessageBoxActions.Ok);
                }
            }
            catch (Exception e)
            {
                ExceptionHandler.Report(e, SR.MessageFailedToAddPreset, this.Host.DesktopWindow);
            }
        }