Extensions made easy 1.11 : navigation sample explained

I uploaded a new sample to the MSDN gallery that shows off some of the latest features of Extensions Made Easy today.

Before you grab it, make sure you have the latest version of Extensions Made Easy installed.

Next up, download the sample, unzip it and open it.  You might want to press F5 to build and run the sample, before diving into the code.

1. Deep linking.

Deep linking in SilverLight is a technique where the user can interact with your SilverLight application through the URL in the web browser.  In my case, one of my customers has a LightSwitch application with close to 150 different screens.  They thought it would be nice if they could send each other links that not only open that application, but immediately have it navigate to the correct screen. I ported this code to the EME extension, so that anyone can use it in his/her LightSwitch applications.

Once you are running the application, change the URL in the browser and add “?NavigateTo=ScreenFour” as an argument.  If you are running the sample from within Visual Studio (and you probably are), you are likely to see that Visual Studio already added the arguments “?IsLaunchedByVS=True&AuthenticationType=None”, just add “&navigateto=screenfour” to the end.

You will have to trim spaces, but the arguments are case-insensitive.

The code is really easy to explain: there is no code.  Just install and activate the latest version of Extensions Made Easy, and start deep linking…

2. The EasyNavigation API.

Besides this deep linking, Extensions Made Easy also has an API that the developers can use to navigate in their LightSwitch applications with greater ease.

The API should need no explaining…

public interface IEasyNavigationModel : System.ComponentModel.INotifyPropertyChanged
bool NavigateTo(string screen);

void NavigateToWebPage(string webPage);

bool CanNavigateForward { get; }

void NavigateForward();

bool CanNavigateBackward { get; }

void NavigateBackward();


If you want to see the code in action, flip the solution editor from “Logical View” to “File view” and open the Client project.  There’s four classes, they all extend from the EasyCommandExporter to show a global command in the Button ribbon.

Each of them starts by getting the IEasyNavigationModel implementation by asking it to the VsExportProviderService

 this.navigationModel = VsExportProviderService.GetExportedValue<IEasyNavigationModel>();

Then, you’ll find that each class uses only a little bit of code to interact with the IEasyNavigationModel:

  • NavigateToScreenFiveCommand shows you how easy it is to open a screen using the “NavigateTo” method.  It will open the screen, or simply set it as the selected screen if it should already be opened…
  • LeaveFeedBackCommand shows you how you can navigate outside of the LightSwitch application to a particular webpage.  Feel free to leave some feedback there.  It runs on the main LightSwitch dispatcher, just for show…
  • NavigateBackCommand and NavigateForwardCommand show you how easy it is to navigate back and forward through the recently opened screens.  Because it might not always be possible to navigate back or forward, these two commands also make use of the new EasyCommandExporter’s IsEnabled property to enable or disable theirselves.

5 thoughts on “Extensions made easy 1.11 : navigation sample explained

  1. Hmmm . . . We need to read off the LSML metadata to sync up all the Screens in each revision of our apps into a datase that has all of the Screens in each modular app.

    Then we’d like to implement a more robust custom menu selection system that is defined at runtime by a user level admin.

    The app level (custom) databased menu system would have (custom – more robust) user Roles defined once and a user (defined once) that would work with multiple modules.

    Some of our users use web versions of the software some IIS Desktop versions.

    Would some of what you’ve done here help us achieve these goals?

    Currently, I am hand syncing LSML Screens into the database with new apps and revisions. We are using the build in navigation system with the Screen CanRun methods just “saying-no” to the LS Screens that our databased (custom) Roles shouldn’t see on their Menus.

    This isn’t too much of a hassle and does about what we need until v2 comes out.

    When v2 comes out, I see what new toys we have to play with and figure out what should be done with v2 until v3.

    However, when I see some low hanging fruit, I’ll go ahead and grab it now.

    A few weeks ago, Michael W. created a shell that we bought that didn’t have the out-of-the-box Menu system.

    We have also using the Screen Collections metadata sync’d to database records to give users English queries and drive PreprocessQuery code – but that is another story.

    I’d also like to know how long your browser app load download time is for your app with 150 windows and how many DataSource Entities are included in the sngle app – it is isn’t too much to ask, please.

    • Hey Garth,

      I read your reply & also your amazing reply on the MSDN forums, and I feel you and I have a lot of common ideas ( / beliefs) on how LS could be improved to be used in B2B markets, to deploy multi-modular enterprise applications…

      I know John Kears from Avenade did some research on how to use PRISM (region manager etc) to download LS XAPs asynchrouneously and combine them at runtime, but we hit quite a few brick walls there. Hopefully in the future John, me or anyone will succeed in such a deployment solution.

      Meanwhile, because of the questions I have been getting (you, Micheal, other people aswell) about my actual LS projects, I decided to write a blogpost about my flagship LS application 🙂 I’m currently finishing some of the last details, and will then submit it to the CodeProject LS Start contest, and blog about it.
      I use some “unusual” techiques to keep the load time really low, depending on the computer hardware & connection speed, it takes 3-6 seconds after entering the URL, to download the XAP, load the silverlight application, let LightSwitch load the applicationmodule, shell, theme, etc and present the login screen to the user.

      I hàve been really busy programming LightSwitch, but am lacking a serious amount of hours per day to share/blog/publish extensions/…

      Hang on tight, LightSwitch is really young and I’m absolutely convinced it will only get better from now on!

  2. Pingback: Extensions made easy: Change log « Jan Van der Haegen's blog

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 )

Connecting to %s