how to execute windows work flows in pos

3
How to: Windows Workflow Foundation in POS Further reading Microsoft Dynamics AX 2012 for Developers [AX 2012] SDK Download RunOperation Method Tutorial AX Retail Point of Sale allows partners to customize services. Partners can programmatically invoke the same core operations users invoke by pressing a button in the UI. These operations can further be described by a Windows workflow. 1. Create a new Windows workflow project in Visual Studio. 2. Add a new Code Activity (see ItemSaleActivity.cs). 3. Add a new Activity (see ItemSale.xaml). a. The ItemSale.xaml expects an ItemId as an argument and has a default value of “0113”. 4. Build your project and put both the dll and the xaml file in your desired folder. 5. On the main screen, click Tasks then right click on a button and change the action to Windows workflow foundation, set the Path field to reflect the location of your xaml file. 6. To run the workflow, just click the newly added button.

Upload: islam-sultan

Post on 23-Oct-2015

20 views

Category:

Documents


2 download

DESCRIPTION

How to Execute Windows Work Flows in Pos

TRANSCRIPT

Page 1: How to Execute Windows Work Flows in Pos

How to: Windows Workflow Foundation in POS

Further reading Microsoft Dynamics AX 2012 for Developers [AX 2012] SDK Download RunOperation Method

TutorialAX Retail Point of Sale allows partners to customize services. Partners can programmatically invoke the same core operations users invoke by pressing a button in the UI. These operations can further be described by a Windows workflow.

1. Create a new Windows workflow project in Visual Studio.2. Add a new Code Activity (see ItemSaleActivity.cs).3. Add a new Activity (see ItemSale.xaml).

a. The ItemSale.xaml expects an ItemId as an argument and has a default value of “0113”.4. Build your project and put both the dll and the xaml file in your desired folder.5. On the main screen, click Tasks then right click on a button and change the action to Windows

workflow foundation, set the Path field to reflect the location of your xaml file.6. To run the workflow, just click the newly added button.

Page 2: How to Execute Windows Work Flows in Pos

ExampleItemSaleActivity.cs

public class ItemSaleActivity : NativeActivity{ // Define an activity input argument of type string public InArgument<string> ItemId { get; set; }

protected override void Execute(NativeActivityContext context) { IApplication application = context.GetExtension<IApplication>();

if (application != null) { string itemId = context.GetValue(this.ItemId); application.RunOperation(PosisOperations.ItemSale, itemId); } }}

Page 3: How to Execute Windows Work Flows in Pos

ItemSale.xaml

<Activity mc:Ignorable="sap" x:Class="WorkflowDemo.ItemSale" local:ItemSale.itemId="0113" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:local="clr-namespace:WorkflowDemo;assembly=WorkflowDemo" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mv="clr-namespace:Microsoft.VisualBasic;assembly=System" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:s1="clr-namespace:System;assembly=System" xmlns:s2="clr-namespace:System;assembly=System.Xml" xmlns:s3="clr-namespace:System;assembly=System.Core" xmlns:sa="clr-namespace:System.Activities;assembly=System.Activities" xmlns:sad="clr-namespace:System.Activities.Debugger;assembly=System.Activities" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=System" xmlns:scg1="clr-namespace:System.Collections.Generic;assembly=System.ServiceModel" xmlns:scg2="clr-namespace:System.Collections.Generic;assembly=System.Core" xmlns:scg3="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sd="clr-namespace:System.Data;assembly=System.Data" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:st="clr-namespace:System.Text;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <x:Members> <x:Property Name="itemId" Type="InArgument(x:String)" /> </x:Members> <sap:VirtualizedContainerService.HintSize>240,240</sap:VirtualizedContainerService.HintSize> <mva:VisualBasic.Settings>Assembly references and imported namespaces for internal implementation</mva:VisualBasic.Settings> <local:PosOperationActivity sad:XamlDebuggerXmlReader.FileName="ItemSale.xaml" sap:VirtualizedContainerService.HintSize="200,200" ItemId="[[itemId]]" /></Activity>