Under basic conditions glucose is oxidized while methylene blue is reduced, changing from blue to colorless. The reduction reaction can be reversed by shaking the flask which forces oxygen into solution, which oxidizes the methylene blue, thus turning it back to blue. If the flask is let sit, the oxygen will come out of solution making the solution colorless and ready to shake again.