TAILIEUCHUNG - Apress Introducing dot NET 4 0 with Visual Studio 2010_3

Quan điểm thiết kế cho các sơ đồ có vẻ hơi khác so với các quy trình công việc tuần tự. Các vòng tròn màu xanh lá cây chỉ ra nơi mà công việc này bắt đầu. Chúng ta cần tạo ra một hoạt động mới để đọc đầu vào từ người sử dụng. Tạo một lớp mới gọi là ReadInput. | 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
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.