Splite code from wpf, make it support other platform
Splite code from wpf, make it support other platform