Reduction of methylene blue
The color change results from the reversible oxidation-reduction reaction of the methylene blue indicator.  In alkaline solutions, glucose is oxidized to D-gluconic acid or alpha-D-gluconolactone.

$\ce{HOCH2(CHOH)4CHO + 3OH- -&gt; HOCH2(CHOH)4CO2 + 2H2O + 2e-}$

In the course of this reaction, methylene blue is reduced from the blue (oxidized) form to the colorless (reduced) form. 

  

Shaking the flask dissolves $\ce{O2}$ in the solution, which oxidizes the indicator back to the blue (oxidized) form.