If you don't want to use Workflow foundation you can create your workflow as implementation of GOF State pattern.
Simple implementation:
public class Workflow
{
internal IState Current { get; set; }
public void Start()
{
Current = new StartState();
Current.Start(this);
}
public void DoSomething()
{
Current.DoSomething(this);
}
public void DoSomethingElse()
{
Current.DoSomethingElse(this);
}
}
public interface IState
{
Start(Workflow context);
DoSomething(Workflow context);
DoSeomethingElse(Workflow context);
}
public abstract BaseState : IState
{
public virtual void Start(Workflow context)
{
throw new InvalidStateOperationException();
}
public virtual void DoSomething(Workflow context)
{
throw new InvalidStateOperationException();
}
public virtual void DoSomethingElse(Workflow context)
{
throw new InvalidStateOperationException();
}
}
public class StartState : BaseState
{
public override void Start(Worklfow context)
{
// Do something
context.Current = new OtherState();
}
}
This is juse very basic implementation. You can futher extend it. You can add other set of methods like CanDoSomething, you can maintain collection of created State instances because State instance is stateless so you don't need to create new instnace each time you move to the state etc.