Learn About Windows Forms Application Development
By Certification Magazine —
1 | 2 |
C. Replace line 03 with the following code: throw new InstallException("The M drive is in use.");
D. Replace line 03 with the following code: InstallException ex = new InstallException(); throw new ApplicationException("The M drive is in use.", ex);
Answer:
C
Tutorial:
You should throw an instance of InstallException. This passes information to the Microsoft Windows Installer and causes the installation to be rolled back.
You should not call the Commit method after you throw the exception. When an exception is thrown, execution is propagated up the call stack until the exception is handled. This means the Commit method will never get called when the exception is thrown.
You should not call the Rollback method after you throw the exception. When an exception is thrown, execution is propagated up the call stack until the exception is handled. This means that the Rollback method will never get called when the exception is thrown.
You should not throw an instance of ApplicationException. This solution will not cause the installation to be rolled back.
Reference:
Error Handling in Custom Actions
MSDN
http://msdn.microsoft.com/en-us/library/xc8bz3y5.aspx
Objective: Enhance usability.
Sub-objective: Perform drag-and-drop operations.
Single answer, multiple-choice
You are developing a Microsoft Windows Forms application that allows electrical engineers to design circuit boards. You create a custom control that represents the design surface. A TreeView control contains nodes that represent electronic components. Users are able to drag components from the TreeView control to the design surface.
You need to handle an event so you can highlight the available areas on the design surface where a component can be dropped. Which event should you handle?
A. GiveFeedback
B. DragEnter
C. QueryContinueDrag
D. DragOver
Answer:
D
Tutorial:
You should handle the DragOver event. This event is raised as the mouse cursor moves over a control during a drag-and-drop operation.
You should not handle the GiveFeedback event. This event is raised when a drag-and-drop operation is started and when the keyboard or mouse button state changes. For example, if a drag-and-drop operation is in progress with the mouse button pressed, the GiveFeedback event gets raised when you release the mouse button.
You should not handle the DragEnter event. This event is raised only when the mouse cursor enters a control during a drag-and-drop operation.
You should not handle the QueryContinueDrag event. This event is raised when the keyboard or mouse button state changes. For example, if a drag-and-drop operation is in progress with the mouse button pressed, the QueryContinueDrag event gets raised when you release the mouse button.
Reference:
Walkthrough: Performing a Drag-and-Drop Operation in Windows Forms
MSDN
http://msdn.microsoft.com/en-us/library/za0zx9y0.aspx
Objective: Configure and deploy applications.
Sub-objective: Install a Windows Presentation Foundation (WPF) browser application by using ClickOnce.
Single answer, multiple-choice
You are planning to deploy a Windows Presentation Foundation (WPF) application. A different version should be deployed on a computer with a 64-bit processor than on a computer with a 32-bit processor. Users must be able to install the application by clicking a link in a browser. The application must support automatic update. You need to create the necessary deployment files. What should you do?
A. For each processor type, create a ClickOnce deployment and set the processorArchitecture attribute of the assemblyIdentity element in the application manifest.
B. Create a ClickOnce deployment with two deployment manifests. Set the processorArchitecture attribute of the assemblyIdentity element in each deployment manifest.
C. For each processor type, create a Windows Installer file and add a link to the Web page.
D. Create a single Windows Installer file.
Answer:
A
Tutorial:
For each processor type, you should create a ClickOnce deployment and set the processorArchitecture attribute of the assemblyIdentity element in the application manifest. A ClickOnce deployment can be installed through a link on a Web page. The deployment is driven by a deployment manifest and an application manifest.
The application manifest is an XML file that describes the application itself and defines dependency information for the application, including the operating system version, processor architecture and language. The assemblyIdentity element allows you to identify dependencies for the installation, including the processor architecture. ClickOnce will examine the system where application is being installed to ensure the dependencies defined in application manifest are met.
You should not create a ClickOnce deployment with two deployment manifests and set the processorArchitecture attribute of the assemblyIdentity element in each deployment manifest. Each ClickOnce deployment has one deployment manifest and one application manifest. Also, dependency information is set in the application manifest.
You should not create a Windows Installer file and add a link for each processor type. A Windows Installer file does not support automatic update. Also, users might attempt to install the wrong version of the application because not all users know whether their processor is 32-bit or 64-bit.
You should not create a single Windows Installer file. A Windows Installer file does not support automatic update.
References:
Element (ClickOnce Application)
MSDN
http://msdn.microsoft.com/en-us/library/cs1kkt20.aspx
Application Deployment Prerequisites
MSDN
http://msdn.microsoft.com/en-us/library/h4k032e1.aspx




