You are here:   Blog
Register   |  Login

Oct 23

Written by: Michael Washington
10/23/2011 1:30 PM  RssIcon

image

Creating a Blank LightSwitch Shell was previously covered in Running a LightSwitch Application With A Blank Shell. However, that article was written before the Visual Studio LightSwitch 2011 Extensibility Toolkit was released, so it is not in the easier to modify format that this project is in.

In addition, the Blank LightSwitch Shell does not contain Save and Refresh buttons. These buttons are important in that they allow a user to easily save data on any Tab that is opened, or to Refresh the Screen if they want to reset any unsaved changes.

Note: You can download and install the completed Shell from the Visual Studio Gallery.

 

Creating The Basic Shell

image

We will first start with Walkthrough: Creating a Shell Extension.

 

image

We name our Extension project MinimalShellExtension.

We then follow the directions in Walkthrough: Creating a Shell Extension.

 

image

When we debug the project, we first enable the Extension.

 

image

Next, we select MinimalShell as the Shell.

 

image

The Shell will appear.

(note: you can get a download of the project at this stage from the Downloads page)

 

The Minimal Shell

Our objective now, is to implement these features:

  • Only display Save and Refresh buttons (display the Design button only if in debug mode)
  • Allow a Shell Logo be displayed in upper right hand corner
  • Automatically load the Default Screen
  • Do not allow the Default Screen to be closed

 

image

We update the contents of MinimalShell.xaml and the MinimalShell.xaml.cs file. 

 

image

Now, when we run our test application, we have our Minimal Shell.

 

image

You can set a .jpeg or .png image that is no larger than 200 (width) by 50 (height) as the LightSwitch Shell Logo Image.

 

image

The Logo will appear in the upper right corner of the Shell.

 

image

The Shell will also not allow the Default Screen to be closed.

 

image

Note, to see the application without the Design Screen button, switch to Release Mode (in Build / Configuration Manager).

 

Accessing The Application

Methods to access Screens, and other parts of the application, are covered in the article: A Random Walk Through The LightSwitch Data Model.

 

image

Most Screen navigation is performed by using the Summary control…

 

image

With Show as Link selected in the Properties.

 

Note: When you open a screen, the Shell will first search for an already opened Tab that has the name of the Screen, and make it active (if it cannot find the Tab it will create a new one and open the Screen). All your Tabs (Screens) must have unique names. See this link and this link for help on using SetDisplayNameFromEntity to set unique names for the Tabs.

 

Purchase Source Code

The source code for the completed Shell (the version listed in the Visual Studio Gallery) is:

$19.95

 

Also See:

10 comment(s) so far...


Gravatar

Re: Creating a Minimal LightSwitch Shell

Hi Michael,

I have a question about the LightSwitch Shell Logo Image. This property seems to be available in the default shell. It will let you set an image but I never see the image in the default shell at runtime. Can you provide any guidance for making the logo appear in the default shell? Thanks for all you do for the LightSwitch user community.

Regards,

Michael

By mp on   10/26/2011 9:24 AM
Gravatar

Re: Creating a Minimal LightSwitch Shell

@mp- See this thread for the code to show the logo in a Shell:
http://social.msdn.microsoft.com/Forums/en-US/lightswitch/thread/2d16c638-f833-4c4c-beec-656912a87b8e

By Michael Washington on   10/26/2011 9:38 AM
Gravatar

Re: Creating a Minimal LightSwitch Shell

Question: I need a minimal shel also without the ribbon. I'a handling saving and refresh myself in the screen.
Is this available, or easy to make? or is the BlankShell more suitable for that?

By Rients Hofstede on   1/21/2012 3:04 PM
Gravatar

Re: Creating a Minimal LightSwitch Shell

@Rients Hofstede - You want Blank Shell

By Michael Washington on   1/21/2012 4:08 PM
Gravatar

What about the admin links?

Hi Michael,

If you have removed the links on the left side of the shell, how do you get at the admin screens (users, roles, etc) when the app is deployed?

Thanks

By Yossu on   1/23/2012 9:55 AM
Gravatar

Re: Creating a Minimal LightSwitch Shell

@Yossu - I actually create a seperate LightSwitch application that allows me to perform administration tasks. Also, you can open any screen in code using methods described here:http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/58/A-Random-Walk-Through-The-LightSwitch-Data-Model.aspx

By Michael Washington on   1/23/2012 9:59 AM
Gravatar

What about the admin links?

Hi Michael,

I hadn't thought of a separate app for admin. Seems like a lot of work for it though.

However, it wouldn't be so hard to add buttons to open the admin screens, and just make them only accessible to authorised users. Probably an easier solution.

Thanks

By Yossu on   1/23/2012 10:40 AM
Gravatar

Re: Creating a Minimal LightSwitch Shell

@Yossu - An admin app should only take 2-3 minutes in LightSwitch :) But yes to make a 'clean' solution you can simply add the admin buttons to the main app and have them show only for admins.

By Michael Washington on   1/23/2012 10:41 AM
Gravatar

Re: Creating a Minimal LightSwitch Shell

Hi Michael, I'm using the source version of the minimal Shell.
And I have 2 problems:
1. When I set a this.DisplayName in the InitializeData... event it wil not change then DisplayName of the Screen tab.
This one is very importend to my App. Te second one is less.
2. However the solution builds well, in design of the TextBlockStyle.xaml it generates th following Error:
Onherstelbare fout (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
C:\Users\Rients\Documents\Visual Studio 2010\Projects\MinimalShellExtension_2-0
\MinimalShellExtension\MinimalShellExtension.Client\Presentation\Shells\TextBlockStyle.xaml 7 9
MinimalShellExtension.Client

By Rients Hofstede on   1/24/2012 8:14 AM
Gravatar

Re: Creating a Minimal LightSwitch Shell

@Rients Hofstede - I sent you an email to follow up.

By Michael Washington on   1/24/2012 8:24 AM

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
CAPTCHA image
Enter the code shown above in the box below
Add Comment   Cancel 

Microsoft Visual Studio is a registered trademark of Microsoft Corporation / LightSwitch is a registered trademark of Microsoft Corporation