succeeding in switch between MainPage and SleepPage via navigation bar