Actually I sort of changed my mind. Here's a better way to do this:

Implement a new private method in StateMachine called "private void SetCurrentState(StateMachine.State newState)". This method is to be called from "HandleMouseRelease", and your "RequestTogglePanMode":

```
SetCurrentState(StateMachine.State newState)
{
    if (newState == this.currentState)
        return; // No state changes.

    if (newState == State.None && (this.currentState != None))
    {
        switch(newState)
        {
            case State.WindowSelection:
                CancelWindowSelection();
                return;
            case State.NodeReposition:
                CancelNodeReposition();
                return;

            ...
        }
    }
}
```