- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
FIRST WORKFLOW in Visual C#.NET
CHAPTER 2 FIRST WORKFLOW Paint Data Matrix In Visual C# Using Barcode generator for .NET Control to generate, create DataMatrix image in .NET applications. www.OnBarcode.comDataMatrix Reader In Visual C# Using Barcode recognizer for Visual Studio .NET Control to read, scan read, scan image in Visual Studio .NET applications. www.OnBarcode.comcontrol the name Step2 and the description Step 2 in process. Add a handler like you did with the Step1 Code activity. Within the ExecuteCode handler for the Step2 Code activity, add a message box with a prompt of Step2 : Private Sub Step2_ExecuteCode(ByVal sender As System.Object, ByVal e As System.EventArgs) MsgBox("Step2") End Sub Finally, run the application. The Step1 message box appears first. If you don t click OK, the workflow will pause and wait until the message box is clicked. After the message box is clicked, the Step2 message box will appear. This shows that the workflow is sequential. No other external action was necessary to move the workflow from step one to step two. The best way to see what s happening is to step through the code line by line using the debugger. Set a breakpoint on the line of code creating the specific workflow activities within the Sub Main of the Module1.vb file: workflowInstance = workflowRuntime.CreateWorkflow(GetType(Workflow1)) Also, set a breakpoint on the second message box within the Workflow1 class. When you step through the code, you ll see the first code to be executed is the constructor (Sub New) of the Workflow1 class. While in the constructor, the Sub InitializeComponent is called. This sub creates all the necessary class instances to support the workflow. Although you created the workflow within the designer and you drew it out, this sub actually creates the instances and uses them. Once again, this shows that you can use the workflow namespaces and classes without the designers, but the designers build all this code for you. This sub also adds the necessary handlers that the designer automatically generated earlier. When the code execution comes back to the Sub Main, the workflow is started, then the workflow waits. Once the workflow begins to wait, the first activity within the workflow begins, because this is a Sequential workflow. That workflow fires the execute code handler because the activity was a Code activity. The first message box appears. Then, when you click OK, the breakpoint within the Step2_ExecuteCode sub in the Workflow1 class is executed, and the breakpoint at the second message box is hit. Finally, after you click OK on the message box, the End Sub of the Sub Main back in Module1 is encountered. The flow of control is as follows: 1. Sub Main begins. 2. Handlers are added. 3. An instance of the Workflowinstance class is created. 4. The specific workflow is assigned to the Workflowinstance (sequential in this case): a. The Workflow1 class constructor is executed. b. All properties of all activities within Workflow1 are set. 5. Workflowinstance is started. 6. Sub Main waits for the activities within the workflow to finish. Painting Code 128 In Visual C#.NET Using Barcode creation for .NET Control to generate, create Code 128 image in Visual Studio .NET applications. www.OnBarcode.comEncode ECC200 In Visual C# Using Barcode generator for .NET Control to generate, create DataMatrix image in VS .NET applications. www.OnBarcode.comCHAPTER 2 FIRST WORKFLOW
QR Code ISO/IEC18004 Creation In C# Using Barcode creator for Visual Studio .NET Control to generate, create Quick Response Code image in .NET applications. www.OnBarcode.comGenerate Barcode In Visual C# Using Barcode maker for VS .NET Control to generate, create Barcode image in VS .NET applications. www.OnBarcode.com7. Each activity within the workflow is processed in this case, the ExecuteCode handler of each Code activity. 8. Sub Main completes. Paint EAN13 In Visual C# Using Barcode encoder for VS .NET Control to generate, create UPC - 13 image in VS .NET applications. www.OnBarcode.comDrawing MSI Plessey In Visual C# Using Barcode creator for VS .NET Control to generate, create MSI Plessey image in VS .NET applications. www.OnBarcode.comPassing Parameters to VB .NET Workflow
ECC200 Generation In None Using Barcode creation for Font Control to generate, create Data Matrix ECC200 image in Font applications. www.OnBarcode.comDraw Data Matrix In .NET Using Barcode generator for VS .NET Control to generate, create ECC200 image in VS .NET applications. www.OnBarcode.comOne of the many workflows that needs to be implemented might need to have values passed into it. This might include needing to know the user name of a user, or to know a document name that is to be approved or not approved. The workflow can accept input parameters, which are defined within the workflow file as public write-only properties, or the workflow can provide back output parameters that are defined within the workflow file as read-only properties. The first step is to define the parameters that you want passed to the workflow as public write-only properties. Add two private integer variables to the Workflow1 class, one called InputValue1, and one called InputValue2. Define two public write-only properties, one called Input1 and the other called Input2. Then define the output parameter by defining a private integer called OutputResult, and a public read-only property called OutputValue. Here s the resulting code: Private InputValue1 As Integer Private InputValue2 As Integer Private OutputResult As Integer Public WriteOnly Property Input1() As Integer Set(ByVal value As Integer) InputValue1 = value End Set End Property Public WriteOnly Property Input2() As Integer Set(ByVal value As Integer) InputValue2 = value End Set End Property Public ReadOnly Property OutputValue() As Integer Get Return OutputResult End Get End Property Next, add OutputResult = InputValue1 + InputValue2 to the Step1_ExecuteCode sub before the message box: Private Sub Step1_ExecuteCode(ByVal sender As System.Object, ByVal e As System.EventArgs) OutputResult = InputValue1 + InputValue2 MsgBox("Step1") End Sub This line of code adds the local variables for the input parameters together and assigns the result to the local variable for the output parameter. Open the Module1.vb file and add a new ANSI/AIM Code 39 Decoder In C#.NET Using Barcode reader for .NET Control to read, scan read, scan image in .NET applications. www.OnBarcode.comEncode Code 128A In None Using Barcode creator for Font Control to generate, create Code 128A image in Font applications. www.OnBarcode.comQR Code ISO/IEC18004 Maker In Java Using Barcode encoder for Java Control to generate, create QR Code 2d barcode image in Java applications. www.OnBarcode.comEAN / UCC - 14 Drawer In Java Using Barcode drawer for Java Control to generate, create GTIN - 128 image in Java applications. www.OnBarcode.comDecode Quick Response Code In Visual Studio .NET Using Barcode decoder for .NET Control to read, scan read, scan image in VS .NET applications. www.OnBarcode.comPrint EAN13 In None Using Barcode generator for Online Control to generate, create EAN13 image in Online applications. www.OnBarcode.comEncode Barcode In Visual Studio .NET Using Barcode maker for ASP.NET Control to generate, create Barcode image in ASP.NET applications. www.OnBarcode.comDraw Barcode In None Using Barcode creator for Online Control to generate, create Barcode image in Online applications. www.OnBarcode.comPaint Data Matrix 2d Barcode In Java Using Barcode drawer for Android Control to generate, create DataMatrix image in Android applications. www.OnBarcode.comANSI/AIM Code 39 Encoder In Objective-C Using Barcode maker for iPad Control to generate, create USS Code 39 image in iPad applications. www.OnBarcode.com |
|