Ibraheem Osama Mohamed (ابراهيم اسامه محمد)

Welcome to my blog :)

Orchard CMS and Silverlight

leave a comment »

This post will help you to add a Silverlight project in Orchard CMS like in this picture.(If you are not familiar with Orchard CMS Click here )

1)Open Orchard CMS , log in and navigate to the Dashboard.


2) Then navigate to media and add a new Folder name it Silverlight or whatever you want 🙂


3)After adding the folder open the folder and add the .xap file(Silverlight file) as a Media

4)Now we add the Silverlight Project to the Orchard Folders so we need to put it in a page. Add new Page or edit existing page


5) Click HTML in the page body so you can edit the page as HTML.

6)A new empty windows now opened add to it HTML that run the .xap file but take care of some thing the location of the .xap will be /Media/Default/Silverlight/file.xap not the location in your computer 🙂
This is the code that run the .xap (I changed the color of the location in HTML to red so you can now where to change the location to your .xap file location )

<script type=”text/javascript”>// <![CDATA[
function onSilverlightError(sender, args) {
var appSource = “”;
if (sender != null && sender != 0) {
appSource = sender.getHost().Source;
}

var errorType = args.ErrorType;
var iErrorCode = args.ErrorCode;

if (errorType == “ImageError” || errorType == “MediaError”) {
return;
}

var errMsg = “Unhandled Error in Silverlight Application ” + appSource + “\n”;

errMsg += “Code: ” + iErrorCode + ” \n”;
errMsg += “Category: ” + errorType + ” \n”;
errMsg += “Message: ” + args.ErrorMessage + ” \n”;

if (errorType == “ParserError”) {
errMsg += “File: ” + args.xamlFile + ” \n”;
errMsg += “Line: ” + args.lineNumber + ” \n”;
errMsg += “Position: ” + args.charPosition + ” \n”;
}
else if (errorType == “RuntimeError”) {
if (args.lineNumber != 0) {
errMsg += “Line: ” + args.lineNumber + ” \n”;
errMsg += “Position: ” + args.charPosition + ” \n”;
}
errMsg += “MethodName: ” + args.methodName + ” \n”;
}

throw new Error(errMsg);
}
// ]]></script>
<center>
<table id=”ctl00_MainTable” style=”width: 800px;” border=”0″>
<tbody>
<tr>
<td colspan=”8″><form name=”aspnetForm” id=”aspnetForm” action=”Default.aspx” method=”post”>
<div><center>
<table border=”0″>
<tbody>
<tr align=”center”>
<td align=”center”>
<div id=”silverlightControlHost”>/Media/Default/Silverlight/RashdanItFirstMakeOfAnimation.xap” /> Get Microsoft Silverlight </div>
</td>
</tr>
</tbody>
</table>
</center></div>
</form></td>
</tr>
</tbody>
</table>
</center>

7)Now the page will look like :-
8)Save the page and enjoy your animations 🙂

Ibraheem Osama Mohamed
@IbraheemOsamaMo

Advertisements

Written by Ibraheem Osama Mohamed

June 15, 2012 at 2:18 pm

Posted in CMS, Orchard, Silverlight

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: