Sign in to follow this  
apocalypse_k40

[.net] Load Screen [Help Request]

Recommended Posts

apocalypse_k40    122
Hi guys, I want to add a load screen in my application with c#. How can I make a load screen appear with percentage while my application is doing its job at background ? Thanks for your helps and best regards !

Share this post


Link to post
Share on other sites
Machaira    1033
Depends on how you're loading your data. Are you doing it in such a way that you know what percentage is loading? If not, just throw up a "Now loading..." screen with some animation to let the user know the app hasn't locked up.

Share this post


Link to post
Share on other sites
juanpaco    150
You're going to have to spin a background worker thread too if you want to have your program doing something and have your progress screen update itself. The reason is because if it's all on a single thread of execution, your UI code will put up the window and then be busy in the functions loading your data rather than being able to respond to requests to redraw itself with the updated state of the progress bar.

.NET provides some really nice classes for dealing with multi-threading issues. I can direct you to some pages specifically on it if you need more help, otherwise I'd just suggest a google search on something like "c# .net multithreading" or going to msdn.microsoft.com and searching on "c# thread." While it's considered bad practice to have a thread that didn't create a UI object make changes to the UI state, .NET 1.x didn't enforce that. However, if you try having a background thread update something in your UI in 2.0, it will throw an exception. You can get around that with delegate and calling invoke. I don't know your familiarity with C#, so that may all have been really confusing. If you need any more help, I'd be happy to try and clarify.

Share this post


Link to post
Share on other sites
apocalypse_k40    122
Really thanks,

@Machaira, that is right, I want just throw up a "Now loading..." screen with some animation to let the user know the app hasn't locked up..

@juanpaco, I tried to create a thread and make this newly created thread to show the GUI while the base app was loading files, but never see the GUI and also get a lot of bugs.. I am familiar (but not an expert) with C# but multithreading is a nightmare u know ;), so I'll appreciate any more help..

Thanks a lot

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this