stop refresh when app is not active.
TODO: refer this, do onpaint in another thread.