Silverlight onload is not getting called

View: New views
3 Messages — Rating Filter:   Alert me  

Silverlight onload is not getting called

by adhi.r :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
I'm using silverlight with ironpython with huge amount of modules, the problem is some times the onload method of Silverlight is not getting called hence the silverlight UI components are not getting displayed. I'm using IsolatedStorage, and when I clear the storage and do refresh its working. Can anyone help for this problem.

Adhi

Re: Silverlight onload is not getting called

by Jimmy Schementi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Silverlight doesn't have a "onload" method, that's only in JavaScript, "window.onload". All IronPython code is run on Silverlight's System.Window.Application.Startup event, so you won't see that fired in IronPython since it has already occurred. However, you can hook the "Loaded" event on UserControl to see when all the controls are loaded.

Isolated Storage shouldn't have anything to do with loading the app, unless there's an exception being raised when you're accessing Isolated Storage. Make sure your HTML page sets "initParams" to "reportErrors=errorLocation" to see any exceptions that you don't catch.

Feel free to post the code which causes this error so I can track down the exact error.

~js

> -----Original Message-----
> From: users-bounces@... [mailto:users-
> bounces@...] On Behalf Of adhi.r
> Sent: Saturday, June 27, 2009 12:09 AM
> To: users@...
> Subject: [IronPython] Silverlight onload is not getting called
>
>
> Hi,
> I'm using silverlight with ironpython with huge amount of modules, the
> problem is some times the onload method of Silverlight is not getting called
> hence the silverlight UI components are not getting displayed. I'm using
> IsolatedStorage, and when I clear the storage and do refresh its working.
> Can anyone help for this problem.
>
> Adhi
> --
> View this message in context: http://www.nabble.com/Silverlight-onload-is-
> not-getting-called-tp24230948p24230948.html
> Sent from the IronPython mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> Users@...
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

_______________________________________________
Users mailing list
Users@...
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Re: Silverlight onload is not getting called

by adhi.r :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jimmy, thanks for your reply. Actually I meant onload event of Silverlight control only. In the onload method I'm calling a init() function
which will get the Silverlight control which I'll use it to call the managed code through C# interface. I agree that Isolated Storage shouldn't have
anything to do with loading the app, (I'm not getting any errors, I've set the initParams) but if I deleted the application storage and do the refresh
with out any other changes, the onload() function is getting called. Also during that problem the UI elements of Silverlight also not getting displayed
and if I call the init() function explicitly the Silverlight control is getting assigned and I'm able to call the managed code. But still the UI
elements are not displaying.

Here is my code related to the problem
<script>
function onLoad()
{
        log(null, 'SL Onload calling init', 'info')
        init();
        log(null, 'SL onLoad calling getPage', 'info')
        getPage('modeldesign.html');
}

function init()
{
        ///alert('Loding SL')
        control = document.getElementById('SilverLight');
        instance = control.Content.instance
        primarySession = control.Content.primarySession
        secondarySession = control.Content.secondarySession
        $(".portlet").load();
}

</script>
<div id='errorLocation' style="font-size: small;color: Gray;"></div>
<div id="progressbar" class="progressbar">
        <object id = "SilverLight" data="data:application/x-silverlight," type="application/x-silverlight-2" width="300px" height="22px">
                  <param name="source" value="orangescape.xap"/>
                  <param name="splashscreensource" value="SplashScreen.xaml"/>
                  <param name="onSourceDownloadProgressChanged" value="onSourceDownloadProgressChanged" />
                  <param name="onSourceDownloadComplete" value="onSourceDownloadComplete" />
                  <param name="onload" value="onLoad"/>
                  <param name="background" value="transparent" />
                  <param name="onerror" value="onSilverlightError"/>
                  <param name="initParams" value="reportErrors=errorLocation"/>
                  <param name="windowless" value="true"/>
        </object>
</div>
So if I call the init explicitly except UI the control objects are working fine.

adhi

Jimmy Schementi wrote:
Silverlight doesn't have a "onload" method, that's only in JavaScript, "window.onload". All IronPython code is run on Silverlight's System.Window.Application.Startup event, so you won't see that fired in IronPython since it has already occurred. However, you can hook the "Loaded" event on UserControl to see when all the controls are loaded.

Isolated Storage shouldn't have anything to do with loading the app, unless there's an exception being raised when you're accessing Isolated Storage. Make sure your HTML page sets "initParams" to "reportErrors=errorLocation" to see any exceptions that you don't catch.

Feel free to post the code which causes this error so I can track down the exact error.

~js

> -----Original Message-----
> From: users-bounces@lists.ironpython.com [mailto:users-
> bounces@lists.ironpython.com] On Behalf Of adhi.r
> Sent: Saturday, June 27, 2009 12:09 AM
> To: users@lists.ironpython.com
> Subject: [IronPython] Silverlight onload is not getting called
>
>
> Hi,
> I'm using silverlight with ironpython with huge amount of modules, the
> problem is some times the onload method of Silverlight is not getting called
> hence the silverlight UI components are not getting displayed. I'm using
> IsolatedStorage, and when I clear the storage and do refresh its working.
> Can anyone help for this problem.
>
> Adhi
> --
> View this message in context: http://www.nabble.com/Silverlight-onload-is-
> not-getting-called-tp24230948p24230948.html
> Sent from the IronPython mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com