15.02.2015 Views

C# 4 and .NET 4

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

silverlight out-of-Browser applications ❘ 1113<br />

}<br />

var dotnet = plugin.content.ScriptKey;<br />

var input = document.getElementById("text1").value;<br />

var output = dotnet.ToUpper(input);<br />

document.getElementById("text1").value = output;<br />

If you don’t plan to make your web site solely with Silverlight but want to mix in ASP.<strong>NET</strong> or HTML<br />

features <strong>and</strong> enhance it with Silverlight, the browser integration features come in very h<strong>and</strong>y.<br />

silVerlighT ouT-of-broWser aPPliCaTions<br />

Since version 3 of Silverlight, Silverlight<br />

applications can also run out of browser.<br />

The application can be installed from a user<br />

without administrator privileges. However, the<br />

application is still restricted to a security s<strong>and</strong>box<br />

<strong>and</strong> doesn’t have full trust on the client system.<br />

What is the advantage of a Silverlight out-ofbrowser<br />

application compared to WPF With<br />

Silverlight, it’s not necessary to install the .<strong>NET</strong><br />

Framework, only the Silverlight runtime that’s<br />

installed with the browser plugin is necessary.<br />

Because this plugin is available on different<br />

platforms, out-of-browser applications can run<br />

on many more platforms than WPF applications.<br />

With the Silverlight project settings of Visual<br />

Studio 2010, you can click the check box to<br />

enable running the application out of the browser<br />

<strong>and</strong> change out-of-browser settings as shown in<br />

Figure 38-6. With these settings, you can define<br />

application icons, title, description, <strong>and</strong> also<br />

if GPU acceleration should be used, which can<br />

be a great performance advantage with special<br />

graphics. By marking the check box for Show<br />

install menu, an installation option for the user<br />

is available on clicking the right mouse button on<br />

the Silverlight control.<br />

figure 38-6<br />

You can control installation <strong>and</strong> updates from the Silverlight application, as demonstrated next with the<br />

project OutOfBrowserDemo <strong>and</strong> a user interface that contains two Button <strong>and</strong> a TextBlock control. The<br />

first button, installButton, has the event h<strong>and</strong>ler method OnInstall() associated with it so that<br />

the user can install the application on the client system, <strong>and</strong> the button updateButton with the event<br />

h<strong>and</strong>ler OnUpdate() to check for available updates.<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!