Showing posts with label Silverlight. Show all posts
Showing posts with label Silverlight. Show all posts

Thursday, 28 February 2008

First Silverlight Facebook App - My City

I have just added this First Silverlight Facebook application - My City. Unfortunately you can add only one citizen a day. So, yep, here is my city with one factory worker!

image

Tuesday, 8 January 2008

Tuesday, 18 December 2007

Deploying Silverlight Application - Why Blank?!

Yesterday we have deployed a Silverlight 1.0 application onto a Window Server 2003 machine. The deployment seems very easy (well you only need to create an application in IIS), however when we try to load the application, the screen was blank.

We need to add new MIME type for the application to recognize XAML:

Properties > HTTP Headers Tab


Clicks "MIME Types...", and click "New"
Add extension ".xaml" with type "application/xaml+xml"

Tuesday, 27 November 2007

Basic Silverlight 1.0 (javascript) - Load another XAML

I keep things simple in this blog, because when I search on web, I would like to find simple explanations and examples, not a sophisticated one. I can write a sophisticated one once I know the basic.

It is easy to load another xaml onto the existing one -  if you have not use 1.1 before 1.0. Since I have developed 1.1 first, I actually found it confusing in the first place, anyway.

Here is a simple Page.xaml, named "Page", have a canvas, and a TextBlock:

<Canvas
xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="970" Height="616"
Background="White"
x:Name="Page"
>
<TextBlock x:Name="RandomButton" Width="36.258" Height="14.1" TextWrapping="Wrap"
Canvas.Left="19.639" Canvas.Top="110.283">
<Run FontFamily="Arial" FontSize="12" FontWeight="Bold"
Foreground="#FFFFFFFF" Text="Random"/>
</TextBlock>
</Canvas>


In the javascript "code behind" I add an event listener to the RandomButton textblock. I want to load Random.xaml onto this page when I click on RandomButton.

if (!window.Trash)
window.Trash = {};

Trash.Page = function() {}

Trash.Page.prototype =
{
handleLoad: function(control, userContext, rootElement)
{
this.control = control;
this.root = control.content.findName("Page");
this.RandomButton = control.content.findName("HomeButton");
this.RandomButton.addEventListene("MouseLeftButtonUp",
this.Random_onMouseLeftButtonUp);
}
}


We are going to send request for the xaml, and add it to the page asynchronously after it is loaded.

Trash.Page.prototype.Random_onMouseLeftButtonUp = function(sender, e)
{
Control_Send(sender.getHost(), "Random.xaml");
}

function Control_Send(host, control_path)
{
var downloader = host.createObject("downloader");
downloader.addEventListener("completed", Control_DownloaderCompleted);
downloader.open("GET", control_path);
downloader.send();
}

function Control_DownloaderCompleted(sender, e)
{
var xamlItem = sender.getResponseText("");

var host = sender.getHost();
var page = host.content.findName("Page");
var control = host.content.createFromXaml(xamlItem, true);

page.children.Add(control);
}


That's it!

Friday, 2 November 2007

Silverlight (Orcas) - Mouse Events Not Working?!

I know this sounds stupid, but I was having a problem with mouse events.

So what happened was I have another control on top of the one that has mouse events. The control on top has a canvas as big as the one underneath, but a transparent background. Well, "transparent" <> "not exists", it's like a piece of glass on top. I forgot.

So if you find your mouse events not working, check if there is a piece of transparent control on top of it!

Thursday, 4 October 2007

Expression around the Clock

I went to Expression around the Clock this morning with Warner and I am happy that finally I have a chance to meet Nas. The content of August de los Reyes's talk was a bit unexpected, but I am a philosophy student so of course I love it. Two  things really have caught my attention were Seadragon and Photosynth.  I have seen Seadragon before, but not Photosynth. It's very cool, so I tried out the Photosynth tech preview after I got back to the office.

Go to the Photosynth site and have a look. :)

Monday, 1 October 2007

Silverlight project

I am so excited because we have finally started our first small silverlight project. Unfortunately (or fortunately?!) I am not involved in any development. I am only overseeing the project (for my own interest sake), not even managing it. That's cool, more people (girls!) get a chance to expose to the technology. Warner's design for the website is excellent. I love it so much, really can't wait to see the final product.


Since I don't get a chance to do the development part but I am too keen, therefore I have created a super simple silverlight example today after I have setup the development environment for those girls. Well, I am not a designer and I can only draw stickman, so the example site only consists of a moving rectangle and a moving ellipse. Don't expect to much from me, haha.


Will show you all once it's done. :)