Example #1
0
 private void lvEffects_ItemChecked(object sender, ItemCheckedEventArgs e)
 {
     if (e.Item != null && e.Item.Tag is ImageEffect)
     {
         ImageEffect imageEffect = (ImageEffect)e.Item.Tag;
         imageEffect.Enabled = e.Item.Checked;
         UpdatePreview();
     }
 }
Example #2
0
        private void tsmiEffectClick(object sender, EventArgs e)
        {
            ToolStripMenuItem tsmi = sender as ToolStripMenuItem;

            if (tsmi != null && tsmi.Tag is Type)
            {
                Type        type        = (Type)tsmi.Tag;
                ImageEffect imageEffect = (ImageEffect)Activator.CreateInstance(type);
                AddEffect(imageEffect);
                UpdatePreview();
            }
        }
Example #3
0
        private void tsmiEffectClick(object sender, EventArgs e)
        {
            ImageEffectPreset preset = GetSelectedPreset();

            if (preset != null)
            {
                if (sender is ToolStripMenuItem tsmi && tsmi.Tag is Type type)
                {
                    ImageEffect imageEffect = (ImageEffect)Activator.CreateInstance(type);
                    AddEffect(imageEffect, preset);
                    UpdatePreview();
                }
            }
        }
Example #4
0
        private void btnDuplicate_Click(object sender, EventArgs e)
        {
            if (lvEffects.SelectedItems.Count > 0)
            {
                ListViewItem lvi = lvEffects.SelectedItems[0];

                if (lvi.Tag is ImageEffect)
                {
                    ImageEffect imageEffect      = (ImageEffect)lvi.Tag;
                    ImageEffect imageEffectClone = imageEffect.Copy();
                    AddEffect(imageEffectClone);
                    UpdatePreview();
                }
            }
        }
Example #5
0
        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;
        }
Example #6
0
        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;
        }