[IronPython] Silverlight onload is not getting called

adhi.r adhi.ramanathan at orangescape.com
Tue Jun 30 08:48:22 CEST 2009


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>
&lt;div id='errorLocation' style="font-size: small;color:
Gray;"&gt;&lt;/div&gt;
&lt;div id="progressbar" class="progressbar"&gt;
	&lt;object id = "SilverLight" data="data:application/x-silverlight,"
type="application/x-silverlight-2" width="300px" height="22px"&gt;
		  &lt;param name="source" value="orangescape.xap"/&gt;
		  &lt;param name="splashscreensource" value="SplashScreen.xaml"/&gt;
		  &lt;param name="onSourceDownloadProgressChanged"
value="onSourceDownloadProgressChanged" /&gt;
		  &lt;param name="onSourceDownloadComplete"
value="onSourceDownloadComplete" /&gt;
		  &lt;param name="onload" value="onLoad"/&gt;
		  &lt;param name="background" value="transparent" /&gt;
		  &lt;param name="onerror" value="onSilverlightError"/&gt;
		  &lt;param name="initParams" value="reportErrors=errorLocation"/&gt;
		  &lt;param name="windowless" value="true"/&gt;
	&lt;/object&gt;
&lt;/div&gt;
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 at lists.ironpython.com [mailto:users-
>> bounces at lists.ironpython.com] On Behalf Of adhi.r
>> Sent: Saturday, June 27, 2009 12:09 AM
>> To: users at 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 at lists.ironpython.com
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> 
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> 
> 

-- 
View this message in context: http://www.nabble.com/Silverlight-onload-is-not-getting-called-tp24230948p24266952.html
Sent from the IronPython mailing list archive at Nabble.com.




More information about the Ironpython-users mailing list