Common code for windows apps