コード例 #1
0
        private void UpdateParentDepthLevelAndInsert(WorkItemWithHistory parent, TaskProgressCallbackMessage value)
        {
            if ((value.MessageType == WorkItemStatus.Closed ||
                 value.MessageType == WorkItemStatus.Canceled ||
                 value.MessageType == WorkItemStatus.Faulted) &&
                parent.CrtDepthLevel > 0)
            {
                parent.CrtDepthLevel--;
            }

            CallbackMessageContent currentCallbackMessage = GetCallbackMessageContent(value, parent);
            int index;

            for (index = parent.MessageHistory.Count - 1; index >= 0; index--)
            {
                if (parent.MessageHistory[index].RecordNumber < currentCallbackMessage.RecordNumber)
                {
                    break;
                }
            }
            parent.MessageHistory.Insert(index + 1, currentCallbackMessage);

            if (value.MessageType == WorkItemStatus.Executing)
            {
                parent.CrtDepthLevel++;
            }
        }
コード例 #2
0
        private void ProcessProgressMessage(TaskProgressCallbackMessage value, WorkItemWithHistory parent)
        {
            if (value.MessageType == WorkItemStatus.Received)
            {
                return;
            }

            if (value.MessageType == WorkItemStatus.Canceled)
            {
                CallbackMessageContent previousMessage = parent.GetLastUpdateMessage();
                if (previousMessage != null && previousMessage.MessageType == WorkItemStatus.Faulted)
                {
                    return;
                }
            }

            UpdateParentDepthLevelAndInsert(parent, value);
        }