public int DispatchCancelProcessTask(string ownerSysActivityID, string processID, bool cancelAllBranchProcesses)
		{
			IWfProcess process = WfRuntime.GetProcessByProcessID(processID);

			IWfActivity currentActivity = process.CurrentActivity;

			process.EntrtMaintainingStatus();

			WfRuntime.PersistWorkflows();

			int result = 0;

			DispatchCancelProcessSysTaskProcessBuilder builder = new DispatchCancelProcessSysTaskProcessBuilder(ownerSysActivityID, process.ID, true, cancelAllBranchProcesses);

			SysTaskProcess sysTaskProcess = builder.Build();

			SysTaskProcessRuntime.StartProcess(sysTaskProcess);

			result += sysTaskProcess.Activities.Count;

			return result;
		}
		public int DispatchCancelBranchProcessesTasks(string ownerSysActivityID, string ownerActivityID, bool cancelAllBranchProcesses)
		{
			int result = 0;

			WfProcessCurrentInfoCollection branchProcessesStatus = WfRuntime.GetProcessStatusByOwnerActivityID(ownerActivityID, string.Empty, false);

			foreach (WfProcessCurrentInfo processInfo in branchProcessesStatus)
			{
				DispatchCancelProcessSysTaskProcessBuilder builder = new DispatchCancelProcessSysTaskProcessBuilder(ownerSysActivityID, processInfo.InstanceID, true, cancelAllBranchProcesses);

				SysTaskProcess sysTaskProcess = builder.Build();

				SysTaskProcessRuntime.StartProcess(sysTaskProcess);

				result += sysTaskProcess.Activities.Count;
			}

			return result;
		}
		public void BuildCancelProcessTaskProcessTest()
		{
			IWfProcessDescriptor processDesp = WfProcessTestCommon.CreateSimpleProcessDescriptorWithBranchTemplate();

			IWfProcess process = WfProcessTestCommon.StartupProcess(processDesp);

			MoveToExecutor(process);

			process = WfRuntime.GetProcessByProcessID(process.ID);

			IWfActivity ownerActivity = process.CurrentActivity;

			process.EntrtMaintainingStatus();

			WfRuntime.PersistWorkflows();

			DispatchCancelProcessSysTaskProcessBuilder builder = new DispatchCancelProcessSysTaskProcessBuilder(process.ID, true);

			SysTaskProcess sysTaskProcess = builder.Build();

			Console.WriteLine(sysTaskProcess.Activities.Count);

			Assert.AreEqual(3, sysTaskProcess.Activities.Count);
		}