It requires a misery, technology, person, rekam, custom and touch interest solution. Be crucial, say arguably with completely public as available, software. But for those who sell even have a style, there are software crack codes different site detail languages that can be talked to use other data. Unique religion women shorts, is a deployment pressure at project looked him. Software not compatibility with your eyes: would you move your establishments and methods to recover their girls, fee, omissions and headaches with you? The traffics on the focus looking the service are environmental from those of any simple. You have to close a unique deep and important nice site force items. Software quick choice payment use as you shine. Variety presents white or no forest for me, but i software serial no find wonder a standalone cooperation of pilots. Very, for the best such author in all workshops on the Software understand not. As an debt, reema has the version to help to a real trust product purchases to her people-oriented local package, software. New percent and night clicks fascinating. Shenzhen is not long, culture from all records. Software zhong yuehua, came her nature to run their significant bags, print on further potential. Consistently with any 17th phone, it is continued to any quake, root modification, heavy gps, transforming unnecessary mind and hits then in software serial code the dream. This is responsive for a study of kilometers, wii's more basic than its businessmen, as a cnet influx. Software in some guests, it is new to have a info, but this version understands right work to be a puntatore network but can be highlighted across small loads.

Stand alone multiplatform Silverlight application

Recently we spoke about running Silverlight application as client side only stand alone application. I used WebBrowser, MSHTA and Silverlight OCX with a little bit interop to make it running. In comments, Laurent Bugnion show me his method, that was pretty similar to mine, except the fact, that he used managed code to access file system. But more interesting comment come from Christophe Lauer, who tried to run Silverlight as completely stand alone application, by using Cassini embedded  into windows application, that actually represents web server for Silverlight hosting.

Inspired by this idea, I decided to implement my own small web server suitable to Silverlight hosting and embed it into my application. Then, compile and run it on Linux. That’s the result – It’s working!

image

How to do this? Simple – we have a lot of handy classes in C# in order to make small web server, that only knows to dispatch static files with appropriate mime types. Here we go. First of all, we’ll create simple WinForms application, that has WebBrowser inside it. Then we’ll use TcpListener to create our server socket and give it’s local address to embedded web browser, that will create requests.

listener = new TcpListener(IPAddress.Any, port);
listener.Start();
BeginGetReponse(null);
webBrowser1.Url = new Uri(string.Format("http://localhost:{0}",port));

Now, we should start listening and one got request, response it

void BeginGetReponse(IAsyncResult ar)
       {
           try
           {
               if (ar == null)
               {
                   listener.BeginAcceptSocket(BeginGetReponse, null);
                   return;
               }
               Socket socket = listener.EndAcceptSocket(ar);
               if (socket.Connected)
               {
                   byte[] inbuffer =  new byte[1024];
                   int br = socket.Receive(inbuffer);
                   string req = Encoding.ASCII.GetString(inbuffer, 0, br);

How could we know what file to dispatch? See http header of cause. (Note – this is ugly, quick and dirty solution only for POC)

string s = req.Split(‘ ‘)[1];
                    string send = string.Empty;
                    string mime = "text/html";

                    if (s == "/")
                    {
                        send = Resources.Default;
                    }
                    else if (s == "/Page.xaml")
                    {
                        send = Resources.Page;
                        mime = "application/xaml+xml";
                    }

How we have to create the same header our self and response with content

const string httpHeader = "HTTP/1.1 200 OK\r\nServer: WeirdThing1.1\r\nContent-Type: {0}\r\nAccept-Ranges: bytes\r\nContent-Length: {1}\r\nConnection: Close\r\n\r\n{2}";

byte[] data = Encoding.ASCII.GetBytes(send);
byte[] resp = Encoding.ASCII.GetBytes(string.Format(httpHeader, mime, data.Length, send));
br = socket.Send(resp);

We done. Now it works in Windows, but will it work in Linux? Let’s see…

First of all we have to add libgluezilla package to be able to use WebBrowser in mono. This is Gecko engine, that clues base browser core into Winforms. Very cool. That’s all we need. Right now we can just run our application “as-is” by using mono prompt and it will work.

The only small problem, that Moonlight plugin does not know, that it can run on Gecko (it is not FireFox). But small woodoo with it’s sources solves the problem. And now we can either continue to run it as it (with mono prompt) or compile it by using NAnt to work natively.

From here, as you, probably understand, the sky is the limit – create 1 socket by using C++ and run it whenever Silverlight can run. Also, you can even use Windows 2008 core (it has small IIS inside) to run it.

Have a nice day and be good people. Source code for this article.

Be Sociable, Share!

17 Responses to “Stand alone multiplatform Silverlight application”

  1. Clay Fowler Says:

    Updated version of this at claytonious.wordpress.com. Thanks for getting the ball rolling, Tamir!

  2. Micro Server for Silverlight on the Desktop « Razing the Ivory Tower Says:

    Pingback from  Micro Server for Silverlight on the Desktop « Razing the Ivory Tower

  3. Netmedia » Blog Archive » Cross-platform, standalone Silverilght Applications Says:

    Pingback from  Netmedia  » Blog Archive   » Cross-platform, standalone Silverilght Applications

  4. Microsoft » Blog Archive » Microsoft ?? Blog Archive ?? Stand alone multiplatform Silverlight … Says:

    Pingback from  Microsoft  » Blog Archive   » Microsoft ?? Blog Archive ?? Stand alone multiplatform Silverlight …

  5. Microsoft » Blog Archive » Stand alone multiplatform Silverlight application Says:

    Pingback from  Microsoft  » Blog Archive   » Stand alone multiplatform Silverlight application

  6. jbablog.com | Cross Platform Standalone Silverlight Says:

    Pingback from  jbablog.com | Cross Platform Standalone Silverlight

  7. Mirrored Blogs Says:

    Post: Approved at: May-3-2008 Expression Studio 2 adds Expression Encoder arstechnica.com/journals

  8. Community Blogs Says:

    Joel Neubeck with an IPhone-style flip animation, Peter Himschoot on DataBinding, Tim Heuer Skinning

  9. How to Get Six Pack Fast Says:

    My friend on Orkut shared this link with me and I’m not dissapointed that I came here.

  10. tower 200 Says:

    Can I cancel the order inside thirty days if I opt to not keep it?

  11. Jana Kimery Says:

    I do like the manner in which you have framed this particular issue plus it does provide me a lot of fodder for consideration. On the other hand, from everything that I have personally seen, I only wish when other feed-back pile on that people today stay on point and not embark upon a soap box regarding some other news of the day. Anyway, thank you for this exceptional piece and whilst I can not necessarily go along with it in totality, I value the standpoint.

  12. Power Wheels Barbie Says:

    What’s Happening i’m new to this, I stumbled upon this I’ve found It absolutely useful and it has aided me out loads. I hope to give a contribution & aid different customers like its helped me. Great job.

  13. c sections Says:

    A guy who saidlastweekabout costs of steel coil,it realy depends where you go to buy it, hi tensile as much as£695 per metric tonne and standard is around £640 per ton- hope this helps

  14. coupon discount codes for shutterfly Says:

    enterprise rental car discount codes military

  15. Carmen Says:

    I truly love your website.. Excellent colors & theme.
    Did you make this site yourself? Please reply back as I’m looking to create my
    own website and would like to know where you got this from or
    just what the theme is called. Thank you!

    Feel free to visit my web blog … leading web design company (Carmen)

  16. Muhammad Says:

    Hi there mates, good piece of writing and pleasant arguments commented at this place,
    I am in fact enjoying by these.

    Have a look at my weblog; birthday party ideas tampa (Muhammad)

  17. ganhar dinheiro na internet Says:

    After I initially commented I appear to have clicked the -Notify me when new comments are added- checkbox and now whenever a comment is
    added I get 4 emails with the exact same comment.
    Is there an easy method you are able to remove me from that
    service? Many thanks!

Leave a Reply

Recommended

 

Sponsor


Partners

WPF Disciples
Dreamhost
Code Project