Пример #1
0
        protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state)
        {
            var curState = new WitGetWorkItemsForArtifactsAsyncState {
                Action = this.RunCommand, ArtifactUris = this.ArtifactUris.Get(context), AsOfDate = this.AsOfDate.Get(context), WorkItemStore = this.WorkItemStore.Get(context)
            };
            var arg = curState;

            context.UserState = arg;
            return(arg.Action.BeginInvoke(arg, callback, state));
        }
Пример #2
0
        private IList <int> RunCommand(WitGetWorkItemsForArtifactsAsyncState asyncState)
        {
            var source          = new HashSet <int>();
            var artifactUriList = asyncState.ArtifactUris.Select(x => x.AbsoluteUri).ToArray();

            foreach (var pair in asyncState.WorkItemStore.GetWorkItemIdsForArtifactUris(artifactUriList, asyncState.AsOfDate))
            {
                if (asyncState.Canceled)
                {
                    break;
                }

                if (pair.Value != null)
                {
                    source.UnionWith(pair.Value);
                }
            }

            return(source.ToArray());
        }