UWP Customized Splash Screen Sample - c#

I want to create a splash screen in UWP. I want do more than just center an image in the screen. I thought it would be a lot more straight forward. I saw these articles:
https://learn.microsoft.com/en-us/previous-versions/windows/apps/hh868191(v=win.10)
https://code.msdn.microsoft.com/windowsapps/Splash-Screen-in-Universal-42c0b57a
When I first opened up this sample, I thought that it worked... But, it doesn't actually do anything. It's actually just a furphy. If you look carefully at the screen, it actually just shows an image (defined in the manifest) for a second or two as the app is starting up, and then when the app is loaded, it switches to the extended screen with a progress ring. I've seen samples where people turn on the splash screen image, but that's not want I need to achieve. Part of the problem is that UWP app startup time is terrible even on fast machines. Even blank apps with nothing in them take several seconds to start up.
Is there a UWP sample floating around that actually a) cuts out the splash image from the manifest, and b) allows us to replace it with something else?
Note: I do not wish to remove the splash screen. I want to customize it.

The main splash screen (centered splash screen image defined in the package.appxmanifest) will always be displayed unless you make it optional - while even in this case it will be shown to the user when the app doesn't load immediately.
To make the splash screen optional, you have to open the manifest file as XML, add the following namespace declaration:
<Package
...
xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5">
And then add the uap5:optional attribute to your splash screen:
<uap:SplashScreen ... uap5:Optional="true" />
You can implement an extended splash screen, which is described in the articles you linked. If you postpone all initialization for the extended splash screen, it is quite likely that the optional default splash screen will not display at all.
However, although the samples only show the same image with progress ring, you can put any content you want on the extended splash screen, you are in full control of it because it is a normal Page.

Related

Take a screenshot behind window in C# WinForm

I'm working on an app in c# windows forms, I have a form called Form1 with a button, and after click this button the idea is to take a screenshoot of everything behind it except the Form1 itself (without minimizing Form1).
Any idea or suggestion?
Thank you!
If you want a solution without hiding, moving, minimizing etc., you need the following approach:
EnumWindows() to iterate all windows. This will give you the windows top to bottom.
Don't forget to exclude your own window
Exclude windows that are invisible. Check out GetWindowLongPtr with GWL_STYLE and compare against WS_VISIBLE
GetWindowRect() to get their size
PrintWindow() to get a bitmap of the window, no matter whether it's in the background
Create a bitmap with the size of the VirtualScreen
Paint the windows in reverse order (bottom to top) using DrawImage()
I found that this is quite fast (514 ms on a 2560x1440 screen with 20 visible windows to draw).
Limitations:
since it sends a WM_PRINT message to the application, you can not capture applications that are "not responding"
For me, Firefox does not render well. It's missing page contents.
For me, control panel content appears black, although it's there when getting a screenshot of the whole screen.
you can use hard code. Actually light shot and other tools working such as. When you click to screenshot button you may close the form window after the event and reopen it. it is the basic way of solution...
Please check this way: How can i capture the screen without the Form?

WPF SplashScreen using external image

I need to make my SplashScreen show image from hard drive (since i will use several images, which may be changed outside of project). But WPF SplashScreen accepts only resource files, present in this or another assembly.
So, how can i solve it? Maybe, there is some way to create temporary resource file during runtime?
The best way to accomplish this goal is to not use the splash screen feature at all.
Create a new XAML window and size it to the size you want your splash screen to be. You can then use to reference the image you'd like to. This can also be done from code-behind now when loading.
When you're ready, have your main window launch the splash screen as the first thing it does. Let it load everything you need, and then show the main window and close the splash screen window.
This way you have full control over your "splash screen" because it's just another window that you're loading.
The one downside of this is that it might have a very small (.5 second or so) delay because WPF has to load before the window can show. An actual splashscreen is not WPF so it will show immediately. This has never been an issue for me.
I don't think this can be done as you want, however, it could be possible to create a separate assembly, which can be changed out whenever you want, which would contain the resource, using:
SpashScreen(Assembly, string);

C# launch form when images fully loaded

I'm making C# application design with images, but when I launch it, I see loading images (~1sec), so how to make simple loader, when images (background, logo, etc..) fully loads, to show my app? I know it's possible but I don't know how to. Thanks so much!
This sounds like standard behaviour. The controls get painted one by one in z-order and if one is slow the rest may appear to flicker.
You could try double buffering the whole form as shown here:
How to fix the flickering in User controls
Alternatively you could suspend the layout while everything is drawn and resume it afterwards:
How do I suspend painting for a control and its children?

How to change or remove splash screen in windows 8.1?

I am working on windows 8.1 app and I found that it contains default splash screen which we can't remove. Is there a way we can remove it something similar to windows phone 8. I want a splash screen which loads until a particular process is completed (example zip extraction,editing resources etc). I also did some research and found that Extended Splash Screen will help but if I add a progress ring, people using the app will know the difference that there are two screens. Please anyone suggest what will be the best approach?
You need to go to the Package.manifest, through Visual Studio, and change the splash screen value. Here is a link to the Xaml version and the steps:
Open your app in Visual Studio 2013.
From Solution Explorer, open the "Package.appxmanifest".
Open the Visual Assets tab, select Splash Screen and you'll see the "Assets\SplashScreen.png" path in the Splash Screen field which you can change to whatever you want.
Then you can use the Extend Splash Screen functionality to continue the screen until your app is ready.
The splash screen is an image in the root folder of the project. you can edit it in any image editor.
While you cannot remove the splashscreen, one option is to use a screen shot of your main page as a splashscreen, this way giving the impression that the app starts quickly.
In your Visual Studio Solution, Right click "package.phone.appxmanifest" --> View Code and comment this line: <m3:SplashScreen Image="images\SplashScreenPhone.png" /> . And the default splashscreen in windows app will be removed. Note: Manifest file name might defer for phone and windows app.

How to display something similar like the splash screen during a 10-30 sec load document process in a WPF application?

My WPF application has an import file function. Sometimes the process takes 1-2 sec but sometimes it is 20-30 sec. For this cases I would like to display something similar as the built in splash screen, and disable any UI interaction.
Although I know I can display a borderless modal window with a custom background image, before I reinvent the wheel I am asking if there is a better idea, or pre-written (open source) component for it.
I also have doubt how can I implement this delayed thing. I mean I do not want to show and disappear this window for 1-2 secs, just for cases that take longer. Well this is a separate topic I know but both questions belong to the question to be solved in the title.
Thanks in advance.
I would use the BusyIndicator control of the Extended WPF Toolkit. It disables the background so user can't use the application while it's displayed. You also have a DisplayAfter property to delay the visibility of the control.

Categories