Fixed OnUserStateChanged method in mainwindow.