private void AddEffect(ImageEffect imageEffect, ImageEffectPreset preset = null) { pauseUpdate = true; ListViewItem lvi = new ListViewItem(imageEffect.GetType().GetDescription()); lvi.Checked = imageEffect.Enabled; lvi.Tag = imageEffect; if (lvEffects.SelectedIndices.Count > 0) { int index = lvEffects.SelectedIndices[lvEffects.SelectedIndices.Count - 1] + 1; lvEffects.Items.Insert(index, lvi); if (preset != null) { preset.Effects.Insert(index, imageEffect); } } else { lvEffects.Items.Add(lvi); if (preset != null) { preset.Effects.Add(imageEffect); } } lvi.EnsureVisible(); lvi.Selected = true; pauseUpdate = false; }
private void AddEffect(ImageEffect imageEffect) { ListViewItem lvi = new ListViewItem(imageEffect.GetType().GetDescription()); lvi.Checked = imageEffect.Enabled; lvi.Tag = imageEffect; if (lvEffects.SelectedIndices.Count > 0) { lvEffects.Items.Insert(lvEffects.SelectedIndices[lvEffects.SelectedIndices.Count - 1] + 1, lvi); } else { lvEffects.Items.Add(lvi); } lvEffects.Focus(); lvi.EnsureVisible(); lvi.Selected = true; }