示例#1
0
        private void Continue(NativeActivityContext context, Bookmark bookmark, object obj)
        {
            var eventArgs = obj as WorkflowNotificationEventArgs;

            if (eventArgs == null)
            {
                return;
            }

            // Check two things:
            //      1. if the wf author wanted to monitor this event type (create, etc.)
            //      2. if the current action has that event type

            var childCreated = GetOptionalBoolArgument(context, WaitForChildCreated, true) &&
                               string.CompareOrdinal(eventArgs.NotificationType, WorkflowNotificationObserver.NotificationType.ChildCreated) == 0;
            var childEdited = GetOptionalBoolArgument(context, WaitForChildEdited, true) &&
                              string.CompareOrdinal(eventArgs.NotificationType, WorkflowNotificationObserver.NotificationType.ChildEdited) == 0;
            var childDeleted = GetOptionalBoolArgument(context, WaitForChildDeleted, true) &&
                               string.CompareOrdinal(eventArgs.NotificationType, WorkflowNotificationObserver.NotificationType.ChildDeleted) == 0;

            // do not do anything, continue waiting
            if (!childCreated && !childEdited && !childDeleted)
            {
                return;
            }

            // remove the notification from the SN db
            InstanceManager.ReleaseWait(notificationId.Get(context));

            // this lets the workflow move on to the next activity
            context.RemoveBookmark(bookmark);

            // set result values: the child in question and the operation name
            Result.Set(context, new WfContent(eventArgs.Info as string));
            NotificationType.Set(context, eventArgs.NotificationType);
        }