
C# ПІДРУЧНИКИ / c# / Premier Press - C# Professional Projects
.pdf
288 Project 1 CREATING A CUSTOMER MAINTENANCE PROJECT
Adding New Dialog Boxes
Consider a situation in which you may need to add dialog boxes to the installation process. For example, you may want to add a dialog box that accepts the user and company name at the time of installation. To do this, perform the following steps:
1. |
Select the Start, Progress, or Finish option in the Install section. |
|
2. |
On the Action menu, click on the Add Dialog option. |
|
|
|
L |
|
The Add Dialog page is displayed.The Add Dialog page provides you |
|
|
|
F |
|
with several options that you can add to the installation process. You can |
|
|
view a short description of each optionYby selecting the option. Figure |
|
|
|
M |
|
12-17 shows the Add Dialog page. |
|
3. |
A |
|
Select the Register User dialog box on the Add Dialog page. |
||
4. |
E |
|
Click on the OK button to add the Register User dialog box. |
||
|
T |
|
FIGURE 12-17 The Add Dialog page
By default, the Register User dialog box gets added last in the list. You can move the newly added dialog box up or down the list as required. Figure 12-18 displays the Register User dialog box added to the user interface editor.
Team-Fly®

DEPLOYING A WINDOWS APPLICATION |
Chapter 12 |
289 |
|
|
|
|
|
FIGURE 12-18 The Register User dialog box added to the user interface editor
The Custom Action Editor
Using the custom editor in Visual Studio .NET, you can modify the installation process to perform some additional tasks on the user’s computer. This implies that you can add custom actions that the installation process performs while installing the application. You can access the custom action editor in the Editor option of the View menu. Figure 12-19 shows the custom action editor.
FIGURE 12-19 The custom action editor

290 Project 1 CREATING A CUSTOMER MAINTENANCE PROJECT
As you can see, the custom action editor contains the Install, Commit, Rollback, and Uninstall folders by default. These folders represent the stages of the installation process. You can add custom actions to any of these folders.
To add custom actions to the installation process, perform the following steps:
1.Select any folder to which you want to add a custom action.
2.On the Action menu, select the Add Custom Action option.
3.The Select Item in Project dialog box is displayed.
4.Select a folder in the Look in: list box.
5.To add a file, an output file, or an assembly that contains the custom action, click on the Add File, Add Output, or Add Component button, respectively.
TIP
Before adding a custom action to the installation process, you must compile your custom action in the form of executable files, such as .dll or .exe, or scripts, such as VBScript (.vbs file) or JScript (.js file).
6. Click on the OK button to add the custom action.
The Launch Conditions Editor
When you install an application, the installation process must follow some conditions. These conditions may include the availability of certain files, the required operating system, or the required registry keys. You can apply these conditions by using the launch conditions editor. Applying conditions ensures the successful installation and deployment of the application. To access the launch conditions editor, access the Editor option on the View menu.
To add a launch condition, perform the following steps:
1.Select the Requirements on Target Machine option in the launch condition editor.
2.On the Action menu, select the Add File Launch Condition option.

DEPLOYING A WINDOWS APPLICATION |
Chapter 12 |
291 |
|
|
|
|
|
You may even choose to add a launch condition for a registry, Windows Installer,
.NET Framework, or Internet Information Services (IIS).
Visual Studio .NET adds two nodes, Search for File1 and Launch Conditions, to the launch conditions editor. Figure 12-20 displays the launch conditions editor.
FIGURE 12-20 The launch conditions editor
The properties of the Search for File1 node allow you to specify the properties of the file to be searched during installation. The properties of the Launch Conditions nodes allow you to specify the message to be displayed if the required file is not found.
Summary
In this chapter, you learned about the basics of deploying a Windows application. Deploying a Windows application allows you to execute a Windows application that you have created on a computer other than the computer on which you created the application. To enable you to deploy an application, Visual Studio .NET provides you with deployment project templates. A deployment project in Visual Studio .NET is a project that enables you to create an installation program to ensure successful deployment of your application on another computer.

292 Project 1 CREATING A CUSTOMER MAINTENANCE PROJECT
Next, you learned about the various deployment project templates available in C#. The simplest way to deploy a Windows application is to convert the application to a CAB file. A CAB file is a zipped form of your project. Another deployment project that Visual Studio .NET provides you is the Setup project. The Setup Project template creates the installer files, called MSI files, that the users can install on their machines to deploy the application.In addition to a CAB or Setup project, you can create a Merge Module project by using the templates provided by Visual Studio .NET. A Merge Module project is used to combine the application files, resource files, registry files, and Setup files in a single package. Visual Studio .NET also provides you with a Setup wizard that you can use to create these deployment projects.
Finally, you learned about the deployment editors, which allow you to specify information, such as the location where you need to deploy the project, the method of deployment, registry information, and so on, while creating a deployment project. By default, Visual Studio .NET contains six types of deployment editors.These editors include the file system, registry, file type, user interface, custom action, and launch conditions editors.

PART IVProfessional Project 2
This page intentionally left blank

Project 2
Creating the
Employee Records
System (ERS)
Project

Project 2 Overview
The Employee Records System (ERS) is a utility that will be used by the human resources department to view the records of employees in the organization. The basic purpose of such a system is to assist the HR personnel in finding details of the employees.
In this project, I will take you through the process of building the ERS application using the TreeView, ListView, and StatusBar controls and interacting with an XML file.
In the previous project, you learned to develop a Windows application for a car maintenance company. In this project, you will learn to create another Windows application, an Employee Records System (ERS) that displays the details of employees.

Chapter 13
Project Case
Study and Design