How do I use a window as splash screen in WPF? - c#

I would like to use a regular window for splash screen, so no PNG splash screen but a normal window where I can add some bitmaps on.
What is the best way: to keep in app.xaml the loading of the main screen and put the splash screen in the constructor or somewhere in an event handler?
The splash scren itself is quite easy, just has some labels, a link, a few images and just waits a few seconds before closing, no actions to be done while waiting.

Specifically for a splash screen, it is very important to make use of the functionality introduced in .NET 3.5 for this purpose. If you simply use a vanilla Window it can take quite some time for the WPF stack to initialize, and in the interim the user will not be seeing any feedback for their "launch the app" action.
Of course this does not satisfy the requirements of the question ("use a regular window"), but if it's not acceptable I would recommend using an different technology than WPF entirely because of the problem mentioned above.

I have myself designed my WPF app dynamic splash screen in which there was an animation, dynamic software Number which changed for each and every software, a label which was updated every 1/2 ms to show some random filename in the sofware directory.
To be frank i used this link to create mine
http://www.codeproject.com/Articles/38291/Implement-Splash-Screen-with-WPF
There are other links which i can provide you
http://www.codeproject.com/Articles/116875/WPF-Loading-Splash-Screen
http://www.olsonsoft.com/blogs/stefanolson/post/A-better-WPF-splash-screen.aspx

Related

WP8 - How to disable the app Splash Screen for certain pages?

I have an app that uses a Splash Screen when it opens up, and it works fine.
The problem is that I've added a couple of pages that can be accessed via two live tiles, and the point is to let the user istantly load a certain section of the app without having to load the whole MainPage.xaml page, which is quite heavy to load.
These two pages are really simple and load almost istantly, but the app loads the Splash Screen anyways, and I don't like that.
Is there a way to "disable" the splash screen for a specific page?
Via C# or directly from the XAML, I don't know.
I enabled the Splash Screens simply by adding the SplashScreenImage.screen-WXGA.jpg (720p and 1080p as well) to the project main directory.
Thanks! :)
Sergio
No. You can't disable the splash screen. What you can do is to minimize all initialization work your app has to do so that the splash screen is shown for a minimum of time.
Sergio,
You can simulate a splash screen and decide based on how you were activated to show it or not. This sample shows one way to do it: https://code.msdn.microsoft.com/windowsapps/Splash-screen-sample-89c1dc78/
I would show it for the main xaml and others that take a long time to load and dismiss it in code.

C# Desktop App Bar (Somewhat Like a taskbar)

I've been googling a lot for this one and I can't seem to find anything. Maybe it's the way that I'm wording it. So basically what I'm looking to do in C# using Windows Forms, is create a form and have it essentially take the shape of the taskbar and do the same functions as the taskbar, but it will sit above the task bar or at the top of the screen.
It can't be "ON TOP" (I'm not trying to block user buttons like the close button of a program they are using).
Autohide would be a plus.
This is the main thing I'm after:
It needs to act just like the task bar. When you maximize any other window, the taskbar does not go over the top of the window, even though it is set to "on top".
You'll want to use an Appbar to do this:
http://msdn.microsoft.com/en-us/library/cc144177.aspx
For more information, check out here and here and here.
If you don't want to deal with C++ and Native Code (as #FKunecke correctly proposed) then you'll not find anything predefined for this. What you can do is create a form for your bar and make the visualization calculations by hand, then you can set the screen location of it. That's all. Not forcing the bar form to stay on top will not hide the other app forms so you'll get that for free.
Now, to fully implement what you want there are some problems you need to deal with, such as Taskbar location and height. Then you'll need to use some native code tricks.

c#.net splash screen loading

I'm developing a C#.NET (4.0) WinForms application. On startup I want to have a splash screen that fills a series of datagridviews on a different form.
At the moment the main form loads that data into the DataGridViews on Form_Load but this makes the Form hang there while this is happening.
So how do I call the method that loads the values to the DataGridView from the splash screen?
I'm rather new to C#.NET, I'm trying to move away from VB.
I would have the splash screen launch the real form where the DataGridViews are, and in that form put the data loading method on its own thread. For a nice and simple and beginner way, use a BackgroundWorker. For more advanced control use Threading.
How to use background worker.
Threading Class Docs
Very good tutorial on threading
EDIT:
As you mentioned in your comment it sounds like you still don't want the form to even appear until its done loading in the data. The easy way to do this is have the main form be hidden from startup, and in the on-load event launch the splash screen, and then when the method that does the data loading returns, set the visibility to true and close the splash screen form.
There are many ways to have a form start hidden. Here is a good forum question with lot of answers on different ways to do it.

Can I use the splashScreenImage to all my app pages?

I'm writing an application for wp7 with several pages, and i want to the splash screen image at the load of every page i have in the app - so the user would figure out he needs to wait a few seconds.
The default splash screen image is fine for me, but i don't know how to do it.
thanks for any help!
You can customize your own splashscreen dont need to use the default
Use the Loading method for the page which should be located on a panel on the left side of Visual Studio's Screen
You can do this by loading the SplashScreen Image on load of every page for some predefined time. And meanwhile other tasks can be done on Background threads (if they are not related to UI).
Also if you want to show a loader to User, you can create a Grid with some Background (semi transparent) and a Progress Bar on it. You can set its Visisbility true before any process which will take time and then hide it after process ends and Application is ready for user..

C#: What is the ideal method of adding a splash screen to a project?

I'm going to input a splash screen to an application I'm currently working on that only consists of one form which we will call frmMain for now. I want to implement a splash screen (frmSplash) but need advice as to what would be the best way to implement it. The purpose of the splash screen will be to load necessary settings into textboxes, checkboxes, etc. based on the last settings of when the program was last closed. Here's my question.
Should I let the main form load, but keep it invisible to the user and then call the splash screen which will run and then load all the settings into the main form?
If so how would I do the above? Load the frmSplash in the frmMain_Load event? I plan to keep the splash screen visible for at least 3 seconds. How would I give it the pause effect so that it stays up for 3 seconds while it recovers the settings from the settings file?
Yes, it is a good practice to use a splash screen to hide form initialization. Here is a pretty good tutorial that should get you up and running:
Creating a Splash Screen in C#
It's probably cleaner not to load the settings in the splash form, but to keep that just for display. Display the splash form and load the settings in the main form.
I would suggest going the other way. Have frmSplash start up, parse the settings and pass them on to a new hidden frmMain. And once frmMain has finished loading (or after 3 seconds) show it.
Or just have the splash screen create a hidden frmMain and show it once it's done loading and in a valid state.
There's an example here, and one with better explanations here.
Note that neither of these examples perform any kind of "pre-loading", but you can do all that in the main thread while the splash thread is doing its eye-candy work.
Hopefully this is the kind of thing you're looking for. Good luck!
Here's a canned version you can try: Autorun Action Splash

Categories

Resources