Skip to main content

Microsoft Silverlight

Unanswered Question Custom Splash Screen inconsistent loadingRSS Feed

(0)

gbducci
gbducci

Member

Member

0 points

2 Posts

Custom Splash Screen inconsistent loading

I created a simple splash screen that seems to load intermittently.
Sometimes the splash screen loads and then the xap is properly instantiated, other times the splash screen and the xap does not load at all (it doesn't even hit Application_Startup).   In other words I click on F5 it loads properly, I click on F5 again and Kaboom nothing.

This problem only occurs when using a custom splash screen and is reproducible on many machines.  We tried with IE8\IE7 and run the site from IIS, not from the dev environment.  Tried with SL2 and SL3 with the same result. 

I read somewhere that it may be caused by the fact that the xap is ready before the splash screen.  Can someone confirm that this is in fact a bug in Silverlight?

BTW, our xap file is well over >3MB and the splash is less than 1K.

Source code...

Splash screen (MySplash.xaml):

<Grid xmlns="http://schemas.microsoft.com/client/2007"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <StackPanel VerticalAlignment="Center">
    <Grid>
      <Rectangle x:Name="progressBarBackground" Fill="White" Stroke="Black" StrokeThickness="1" Height="30" Width="200"></Rectangle>
      <Rectangle x:Name="progressBar" Fill="Yellow" Height="28" Width="0"></Rectangle>
    </Grid>
    <TextBlock x:Name="progressText" HorizontalAlignment="Center" Text="0% downloaded ..."></TextBlock>
  </StackPanel> 
</Grid> 


Object tag:

 <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
                <param name="source" value="../ClientBin/myXap.xap" />
                <param name="onError" value="onSilverlightError" />
                <param name="background" value="#333333" />
                <param name="minRuntimeVersion" value="3.0.40624.0" />
                <param name="autoUpgrade" value="true" />
                <param name="windowless" value="true"/>
                <param name="SplashScreenSource" value="MySplash.xaml" />
                <param name="onsourcedownloadprogresschanged" value="onSourceDownloadProgressChanged" />

                </object>

 js event

function onSourceDownloadProgressChanged(sender, eventArgs) {
        sender.findName("progressText").Text = Math.round((eventArgs.progress * 100)) + "% downloaded ...";
        sender.findName("progressBar").Width = eventArgs.progress * sender.findName("progressBarBackground").Width;
}
 

ken tucker
ken tucker

All-Star

All-Star

16356 points

2,499 Posts

Re: Custom Splash Screen inconsistent loading

 The xap file is cached in the temporary internet files like images on the person viewing websites computer.  If the xap file is in the temporary internet files and is the same version on the web it uses the local copy.  When the local copy is available the splash screen will not be visible

gbducci
gbducci

Member

Member

0 points

2 Posts

Re: Custom Splash Screen inconsistent loading

Thanks Ken for your quick reply, but... 

I know the xap file is cached on the client side and that the splash will not show when the local copy is available.  My problem is not necessarly with the splash screen but rather that the application never starts.  In other words it does not always fire the application_Startup event of my app.xaml.cs file.

 What is strange is that if I do not use a custom splash screen the application_Startup event is always fired.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities