Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5999981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:37:43+00:00 2026-05-23T00:37:43+00:00

I am creating an application that the user will be able to setup a

  • 0

I am creating an application that the user will be able to setup a series of functions to run on an object (image manipulation stuff).

Each different function has either no configurable options, or its own uniques set of options.

This is hard to explain, so let me show a simple example:

  1. Image opened (always happens)
  2. Remove border (two options)
  3. Despeckle image (5 options)
  4. Crop image (10 options)
  5. Save image

The problem is that I need to allow the user to create a custom series of cleanup functions that will be used to process images in bulk.

What is the best way to go about this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:37:43+00:00Added an answer on May 23, 2026 at 12:37 am

    I’d highly recommend you look into the Command Pattern:

    • http://www.codeproject.com/KB/architecture/Command_Pattern.aspx

    Essentially, this involves creating “Command” subclasses for each type of action the user can perform – and pushing them unto a stack once the command has been executed.

    Each command knows how to “do” itself, and also “undo” itself.

    Thus, undo is a relatively straight forward process of popping commands off the stack, and calling the undo method on them.

    Because each instance of a Command can contain it’s own state (“options”), you can create exactly the commands you want to use ahead of time, and “batch” them to get the result you are looking for.

    pseudo-code:

    public class ImageEditor
    {
         public Stack<Command> undoList = new Stack<Command>();
         public void executeCommand(Command command)
         {
               command.performAction(this);
               undoList.push(command);
         }
         public void undo()
         {
               undoList.peek().undoAction(this);
               undoList.pop();
         }
    }
    
    public interface ICommand
    {
         void performAction(ImageEditor editor);
         void undoAction(ImageEditor editor);
    }
    
    public class CreateBorderCommand : ICommand
    {
         public int BorderWidth { get; set; }
    
         private Border MyBorderBox { get; set; }
    
         public void performAction(ImageEditor editor)
         {
               MyBorderBox = new Border(BorderWidth, editor.frame);
               editor.addElement(MyBorderBox);
         }
         public void undoAction(ImageEditor editor)
         {
               editor.removeElement(MyBorderBox);     
         }
    }
    

    Later on:

    ImageEditor editor = new ImageEditor();
    editor.executeCommand(new CreateBorderCommand() { BorderWidth = 10 });
    ...
    

    If you really want, you could make it a little more involved, and make all of the command definitions serializable – allowing you to create a list of them and read in the list and execute them later.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating an application that will store a hierarchical collection of items in an
I am creating a small application that will be deployed on Window. The database
I am creating an application in .NET that will serve as a second UI
I am creating a desktop/client application that will be installed on +/- 5 PCs,
I'm creating a web application that will involve habitual file uploading and retrieval (PDFs,
I am creating an application that manages multiple instances of an external utility, supplying
We are creating an XBAP application that we need to have rounded corners in
I am creating a .NET application (C#) that needs to use a lot of
I'm creating an installation script for an application that I'm developing and need to
I am creating a C# Windows Mobile application that I need to programmatically invoke

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.