Navigation


Markus on Development and Publishing

This is Markus Egger's professional blog, which covers topics such as development, publishing, and business in general. As the publisher of CoDe and CoDe Focus magazines, and as the President and Chief Software Architect of EPS Software Corp., Markus shares his insights and opinions on this blog.

Content Area Footer

Wednesday, August 25, 2010
Auto-Updating a Silverlight Out-Of-Browser App

Silverlight supports Out-Of-Browser operation, meaning you can build an app that runs very much like a desktop application. You enable this via a simple setting in the properties of the Silverlight control. Once you have an OOB app, you can either start it as a stand alone app, or, if the app is originally launched within a browser as part of a page, users can right-click on it and choose to “install the app locally”.

I really like this feature. But I was surprised to learn that an app taken out of the browser does not automatically update itself when a newer version is available on the server. It always seems to me that is the quintessential modus operandi in Silverlight. After all, in the web browser, when you navigate to a site with a Silverlight control, you automatically and always get the latest version of that control. Versions that have been cashed from prior visits are only used if the version is still up to date. Not so for OOB Silverlight apps. You can publish new versions all you want, the client (by default) has the version that was originally installed.

So what do you do to fix this problem? Well, luckily it turns out you can simply add a few lines of code to the app’s constructor to enable updating. Add the following code to your App class’ constructor (in App.xaml.cs) to get auto-updating:

if (Current.IsRunningOutOfBrowser)
{
    Current.CheckAndDownloadUpdateCompleted += (sender, e) =>
        {
            if (e.Error == null && e.UpdateAvailable)
                MessageBox.Show("New version! Please restart!");
        };
    Current.CheckAndDownloadUpdateAsync();
}

So the whole constructor part of the app class should now look like this:

public partial class App : Application
{
    public App()
    {
        Startup += Application_Startup;
        Exit += Application_Exit;
        UnhandledException += Application_UnhandledException;

        InitializeComponent();

        if (Current.IsRunningOutOfBrowser)
        {
            Current.CheckAndDownloadUpdateCompleted += (sender, e) =>
                {
                    if (e.Error == null && e.UpdateAvailable)
                        MessageBox.Show("New version! Please restart!");
                };
            Current.CheckAndDownloadUpdateAsync();
        }
    }
    // …

There you go! Live is good again :-)



Posted @ 10:13 AM by Egger, Markus (markus@code-magazine.com) -
Comments (1138)


Tuesday, August 24, 2010
Microsoft Expression Web 4 SuperPreview Rocks!

I have long been a user – a fan even – if the Microsoft Expression product line. However, I use mostly the XAML related tools, such as Expression Blend and Expression Design. As it turns out, I have so far completely overlooked a hidden gem: Expression SuperPreview.

SuperPreview is a tool that allows you to view web pages the way they appear in different browsers. The basic idea is that you open a URL in SuperPreview and pick the browsers you would like to see. This includes some of the browsers you have installed on your machine (in my case, it can show IE6, IE7, IE8, IE8 rendered in IE7 mode, and FireFox 3.6.8). I also have Chrome and Safari installed, but I guess those are not included. What is pretty cool however, is that there now is a SuperPreview online feature that’s in BETA. This allows connecting to an online rendering service (free) that shows even more formats that are not native to Windows. I have no idea what will ultimately be included in this, but in the current beta, it can show a view of Safari on the Mac, which I otherwise could not test on my Windows machine. Hopefully, there will be more added in the future.

The different views SuperPreview provides are very cool too. There are side-by-side comparisons of various renderings. You can even overlay 2 renderings to see the exact differences between the different browsers. Very cool!

I also like the option of setting a screen size to simulate smaller screen resolutions than I personally run. Plus, the zoom feature is very nice as well. This way, you can see more of your web site, or more easily compare the site. Zooming works in SuperPreview regardless of whether the browser actually supports it or not.

I will def. be using this tool going forward. I find it much easier to verify my sites work with multiple browsers and versions using SuperPreview than going to each browser manually. Many I simply do not even have (like IE6).



Posted @ 3:30 AM by Egger, Markus (markus@code-magazine.com) -
Comments (890)


 

 

 

 

 

 

 

Syndication RSS 2.0 RSS 2.0

All My Blogs:
My personal blogs:
Dev and Publishing Dev and Publishing
Travel and Internat. Living Travel and Internat. Living
Other blogs I contribute to:
Milos Blog (US) Milos Blog (US)
VFPConv. Dev Blog (US) VFPConv. Dev Blog (US)
VFPConv. Dev Blog (DE) VFPConv. Dev Blog (DE)

 

Blog Archives
All Blog Posts

2015
    September (1)
2012
    September (1)
    April (1)
    March (1)
2011
    October (1)
    June (3)
    May (1)
    March (2)
    February (2)
    January (2)
2010
    December (3)
    November (2)
    October (2)
    September (1)
    August (2)
    July (1)
    June (1)
    April (3)
    March (1)
    February (5)
    January (1)
2009
    October (4)
    September (2)
    August (1)
    July (1)
    May (4)
    April (6)
    February (1)
    January (1)
2008
    December (3)
    November (11)
    October (8)
    September (1)
    July (1)
    June (3)
    May (3)
    April (6)
    March (6)
    February (4)
2007
    December (1)
    November (1)
    October (5)
    September (1)
    August (1)
    July (6)
    June (3)
    May (3)
    April (1)
    March (2)
    January (2)
2006
    December (3)
    November (4)
    October (1)
    September (2)
    August (2)
    July (4)
    June (1)
    May (2)
    April (10)
    March (2)
    February (3)
    January (1)
2005
    December (6)
    November (7)
    October (6)
    September (8)
    August (10)
    July (6)
    June (9)

 

 

 

This Blog is powered by MilosTM Collaboration Components.