How to animate image in splash screen for windows phone? - c#

I am working on windows phone app in which I need to animate an object in the splash screen. In the below image you can see that, as soon as the splash screen appears. The ball.png bounces and only after completing the bounce, the app continues into the application. How to do this task?

You have to follow thoses steps to create an animated splashscreen :
You have to create a new Page on your application (called
SplashScreen.xaml) and set it as your 'HomePage'.
You create a storyboard to build your animation.
You subscribe to the Loaded event of the SplashScreen page, and start your
storyboard.
When the storyboard is done (subscribe to the Completed event), you can navigate to your
Homepage.
Hope it helps !

Use Extended Splash Screen and set the animation to the image. For more details visit here.

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.

Centering a image when the application is ran

I have this application I made where when you click on the exe a Image Pops up that says Checking for Updates and if there isn't any it runs the main codes. But every time I click on it the image ends up somewhere random in the screen, is there a way to center the image in the screen to prevent it from doing that?
If your VS project type is a Windows Form Application you can just view the forms designer and set the StartPosition to CenterScreen or CenterParent
VS2010 WinForms (+ I assume) supports a splash screen. Add a form (a splash screen template is available) and in the Project properties select the new form. The Splash Screen appears center screen.
The splash screen will display until your startup form exits the Load event - or you can just end the app if you don't have anything more to do. Not sure what the code would be for a console app.

Creating an animated splash screen like office 2010

How can I create an animated splash screen like the one in Office 2010 using C#?
Is this question about winforms or wpf?
If it's about wpf:
An animated splash screen is not more than a wpf window showing while your "Main Window" is loading. You can design this splash window with Expression Blend as explained by wischi.
You can also have a look at this code project.
For creating some kind of a loading animation: A Simple WPF Loading Animation
Just create a window with an animation defined in xaml and show it while your application is loading -> animated splash screen.
In Winforms:
You may have to override the paint method of a form to create an animation. But it's still showing another window which contains an animation while another window is loading.
I recommend using WPF for modern application design and your splashscreen problem.
Expression Blend is a nice tool for creating animations and xaml designs. But you can also design animations by writing plain xaml as well
Expression Blend Tutorials
Animation Using Expression Blend: How to create an animation
Animation Using Expression Blend: How to start animations on events
MSDN Info
Animation Overview
Using Winforms it will be much more complicated. The entire GUI is rendered by the CPU (no GPU support) but you can create a custom usercontrol and overwrite the Paint event and use GDI for drawing, but this will be much more complicated then using wpf.
if you want to make a dynamic animated splash screen like Office 2010 , i recommend you to use WPF and never think about WinForms to make dynamic animation with code !
but if you are determined of using WinForms you have to be tricky , and use one of this tricks :
• put a Flash ActiveX Object , and make your animation with Flash then link them together
• if you are good with WPF and Silverlight you can make your animation with Silverlight and view it in a WebBrowser Control , You may also use Flash or HTML5
A detailed guide for a splashscreen is here:
eExample splashscreen
Another example
Although the basics is:
1) Create a splashscreen, show it, close/dispose it
private void SplashForm()
{
SplashForm newSplashForm = new SplashForm();
newSplashForm.ShowDialog();
newSplashForm.Dispose();
}
2) Run the splashscreen on a seperate thread/backgroundworker
Thread t1 = new Thread(new ThreadStart(SplashForm));
t1.Start();
Thread.Sleep(5000); // 5 seconds
t1.Abort();
Thread.Sleep(1000);
In Winforms, the simplest way is using a PictureBox with an animated Gif on a splashscreen.
This way allows you to spend more time on your animation than your code.
In WPF it is very easy just right click on project > add new item > splash screen. This
is simple example explaining 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..

Using a .GIF animation as the splash screen in WP7 application

I have an animated .GIF image that I created with http://ajaxload.info/ and some editing. I would like to set the resulting icon as the splash screen in my app, which can take a few seconds to load.I don't think that I can set the icon as the SplashScreenImage.jpg (GIF != JPG) and I'm not sure how to view the image as a MediaElement either. (I would show the image while the main Canvas was loading.) DOes anyone have any links/code on how to set both the SplashScreenImage to use the .GIF AND how to use the .GIF in a XAML page (from code-behind)?
Silverlight doesn't support GIF files. There are a couple of things you could do. Firstly, you could create the same animation in Blend (as a Storyboard). Or, you could display a WebBrowser control which does render GIF files.
As you mentioned, you can't change the SplashScreen image. It has to be a jpeg and there's no getting around this. What you could do, however, is have your app load your page with your animation in a PopUp. On a separate thread, you can load your main page and then use a dispatcher to push this on to the UI thread. There is an example of how to do this in this blog post.

Categories

Resources