public bool TryChangeState(double windowWidth) { var next = StateList.LastOrDefault(q => q.Value < windowWidth); if (next.Key == CurrentState) { return(false); } else { CurrentState = next.Key; return(true); } }