add the logic of ui handler

handle the event to UI thread