xaml - C# pause thread pause whole application -
i wish make little splash screen loading text. white screen launches when code finishes, why that?
code:
public partial class splashscreen : page { public splashscreen() { initializecomponent(); } private void page_loaded(object sender, routedeventargs e) { loading.content = "loading"; thread.sleep(500); loading.content = "loading."; thread.sleep(500); loading.content = "loading.."; thread.sleep(500); loading.content = "loading..."; thread.sleep(500); //when gets here page can seen, not loading... "animation: } }
xaml:
<viewbox> <grid> <image x:name="overview_picture" source="/wpf_unity;component/images/splash.jpg" /> <label horizontalalignment="center" x:name="loading" fontsize="54" content="loading..." foreground="#a09c9d" rendertransformorigin="0.5,0.5" verticalalignment="bottom" fontfamily="pack://application:,,,/fonts/#univers lt std 57 cn" fontweight="bold" margin="0,0,0,400" /> </grid> </viewbox>
this because doing sleeps on main thread. suggest start seperate (worker-)thread handling splashscreen.
Comments
Post a Comment