private void ManageScheduledStateEvent(UpdateEvent evt) { if (PopStateCount > 0) { while (PopStateCount > 0) { StateStack.Pop().Dispose(); PopStateCount--; } if (StateStack.Count > 0) StateStack.Peek().Resume(evt); } if (NewStateScheduled != null) { if (StateStack.Count > 0) StateStack.Peek().Pause(evt); StateStack.Push(NewStateScheduled); NewStateScheduled.ZOrder = (ushort)StateStack.Count; NewStateScheduled.Resume(evt); NewStateScheduled = null; } }
public void SchedulePushState(State newState) { if (NewStateScheduled != null) throw new Exception("New state is already scheduled."); NewStateScheduled = newState; }