コード例 #1
0
        async Task ExecuteAsync()
        {
            try
            {
                IListDebugPropertyInfo propertiesList =
                    await _taskExecutor.SubmitAsync(GetPropertiesInfoAsync, _cancelSource.Token,
                                                    nameof(ExecuteAsync),
                                                    typeof(AsyncGetPropertiesOperation));

                uint total = (uint)await _childrenProvider.GetChildrenCountAsync();

                _completionHandler.OnComplete(VSConstants.S_OK, total, propertiesList);
            }
            catch (OperationCanceledException)
            {
                // OnComplete has already been sent from Cancel()
            }
            catch (Exception e)
            {
                Trace.WriteLine($"Error processing async get properties request: {e}");
                _completionHandler.OnComplete(e.HResult, 0, null);
            }
            finally
            {
                _cancelSource.Dispose();
                _cancelSource = null;
            }
        }
コード例 #2
0
        public async Task GetChildrenCountReturnsNumberOfChildrenAsync()
        {
            int childrenCount = await _childrenProvider.GetChildrenCountAsync();

            Assert.That(childrenCount, Is.EqualTo(_children.Count));
        }
コード例 #3
0
 public int GetCount(out uint count)
 {
     count = (uint)_taskExecutor.Run(async() =>
                                     await _childrenProvider.GetChildrenCountAsync());
     return(VSConstants.S_OK);
 }