tailieunhanh - Introducing dot NET 4 0 with Visual Studio_2

Tham khảo tài liệu 'introducing dot net 4 0 with visual studio_2', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | CHAPTER 6 WINDOWS WORKFLOW FOUNDATION 4 Figure 6-13. New flowchart workflow 3. The design view for flowcharts looks slightly different than sequential workflows. The green circle indicates where the workflow starts. We need to create a new activity to read input from the user. Create a new class called Readinput. 4. Enter the following using statement using 5. Now enter the following code public class Readinput CodeActivity int32 protected override Int32 Execute CodeActivityContext context . . return 6. Save the class and compile the application. 7. Open . 8. Drag a WriteLine activity beneath the green circle and change the Display Name to What is your age and set the Text to What is your age 147 CHAPTER 6 WINDOWS WORKFLOW FOUNDATION 4 9. Drag the new Readinput activity beneath the What is your age activity and change the display name to Read input. 10. Create a new variable called age of type Int32. 11. On the Readinput activity set the Result property to age. The next thing to do is determine if the customer is old enough to see the film which in this case will always have an 18 rating . Flow chart workflows have a new type of activity not found in sequential workflows called FlowDecision. 1. Drag a FlowDecision activity beneath the read input block and change the condition to Age 18. There are obviously two possibilities to this expression Customer is old enough so they can see the film FlowDecision condition true . Customer is too young so shouldn t be seeing any movies FlowDecision condition false . 2. To simulate the customer failing age verification drag a WriteLine activity to the right of the flow decision and change the display name and text to Sorry not old enough. 3. Drag another WriteLine activity beneath the flow decision and change the display name and text to Age validation successful. 4. We now need to link up the activities we have just created. Move the mouse over the green circle .

TỪ KHÓA LIÊN QUAN