I'm aware of these two questions which explain why I can't have a protected/private method in an interface, what I'm trying to work out is how to control from where my methods are called, briefly:
public class EditField : IEditField
{
public EditField() {}
public EditField(IStateMachine stateMachine) {}
public void Action_Commit() {}
public void Action_Undo() {}
}
Consumers can use the default IStateMachine, or roll their own.
I was wondering if there is any way to ensure that Action_ methods are only called from within an IStateMachine, so that consumers don't start messing around with state stuff. I suspect there's no way of doing this, but wondered if I'm missing something. I'm not a Design Pattern guru.