Introduction:
In this article,
we shall see how to create a LightSwitch Desktop application. The LightSwitch applications are introduced for creating a line of
business applications, which are more data-centric.
Creating
LightSwitch Project:
Start the
VS 2010, Select the LightSwitch from Installed Templates and select the
LightSwitch Application as shown below.
Give the name for project as
SampleLSWindowsApplication.
Setting the
Desktop Application:
After
successful creation of LS project go to the Solution Explorer. Right Click the
Solution and select the Properties option.
In the properties window you have to select the
Application Type Menu Tab. In the Application Type Menu Tab, there will be
three types of LightSwitch Application types. To create the Desktop Application
[Windows Application] we have to select the first option i.e. Desktop client,
2-tier deployment.
Adding
DataSource to the LS Application:
After
creating project, the first screen that appears is the DataSource selection
screen.
In that screen, we have to select the Create New Table
option to create the new table.
The second option is for creating the application that
will be using the data source from previously designed.
Adding
Fields to Table:
After
creating table, we have to add the fields to the table. The LightSwitch gives
the nice GUI to create the fields required. We can set the field type and can
set the required field option by selecting the checkbox.
Adding
Screens to the Application:
Adding
screens to the application is pretty cool. Just go to the solution explorer and
there you can see the Screen folder like icon. Right click the icon and choose
the Add Screen option.
We can add the screens from tab tabbed window also.
The below image shows the option to add screens from tabbed windows.
Selecting
Screen Template and Assigning Screen Data:
For
designing the screen, there are some screen templates available in the VS 2010.
So that we can select the screen template for our application. In this sample application,
we have selected List and Details Screen.
The table for the screen has been listed in the Screen
data combo box. If we have created more than one table then we have to select
the appropriate table.
After setting, the Table for the Screen our Light
Switch application is ready for execution.
As our LightSwitch is data-centric
business applications, the same basic CRUD (Create, Read, Update and Delete)
operations will be available as menus.
In this screen, we are having ADD, EDIT, DELETE and
REFRESH buttons. Designing the screen will take some more time. We will see the
Screen design for LightSwitch in the next article.
Summary:
In this
article, simply we have been leant something basic steps to create a
LightSwitch Desktop Application.
Please provide your valuable comments and feedback,
which is boost for me [as an author].