First, the introduction of this article, we learn another simple activity--while activities. The while activity will continue to loop until the specified judgment is false.
Next, let's build a simple example. The purpose of this example is to display a 99 multiplication table primarily using the while activity implementation.
Second, create a console Sequence Workflow sample program framework
Follow the steps below to create a console sequential Workflow sample program:
1. Start VS2008, click menu "File" | " New "|" Project, create a console sequential Workflow sample program named WhileActivity.
2. After that, the system automatically opens the Workflow designer interface.
3. Drag the While activity from the toolbox to the Chinese character hint on the right side of the diagram, and get the situation as shown in the illustration.
4. Because a 99 multiplication table is displayed in the console, it is important to use a double loop to achieve this. In other words, we're going to use a nested while activity. On the other hand, we know that there is a connection between the outer loop and the inner loop variable, that is, after each internal loop execution completes, a new initialization operation is performed. Therefore, embedding a while activity directly in a while activity does not achieve the established functionality.
However, there is a workaround, where we can embed a composite activity in a while activity, a activity that allows it to continue to contain (possibly multiple) child activities, such as parallel execution activities (PARALLEL), serial execution activity (Sequence), and so on.
5. To this end, we finally get the following workflow diagram: