diff options
Diffstat (limited to 'src/Text/Util/TextUIUtil/UIThreadOperationExecutor.cs')
-rw-r--r-- | src/Text/Util/TextUIUtil/UIThreadOperationExecutor.cs | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/src/Text/Util/TextUIUtil/UIThreadOperationExecutor.cs b/src/Text/Util/TextUIUtil/UIThreadOperationExecutor.cs index e1a92bf..592c814 100644 --- a/src/Text/Util/TextUIUtil/UIThreadOperationExecutor.cs +++ b/src/Text/Util/TextUIUtil/UIThreadOperationExecutor.cs @@ -3,43 +3,32 @@ using System.Collections.Generic; using System.ComponentModel.Composition; using Microsoft.VisualStudio.Utilities; -namespace Microsoft.VisualStudio.UI.Text.Commanding.Implementation +namespace Microsoft.VisualStudio.Text.Utilities { [Export(typeof(IUIThreadOperationExecutor))] - internal class UIThreadOperationExecutor : IUIThreadOperationExecutor + internal class UIThreadOperationExecutor : BaseProxyService<IUIThreadOperationExecutor>, IUIThreadOperationExecutor { [ImportImplementations(typeof(IUIThreadOperationExecutor))] - private IEnumerable<Lazy<IUIThreadOperationExecutor, IOrderable>> _unorderedImplementations; + protected override IEnumerable<Lazy<IUIThreadOperationExecutor, IOrderable>> UnorderedImplementations { get; set; } - private IUIThreadOperationExecutor _bestImpl; - - private IUIThreadOperationExecutor BestImplementation + public IUIThreadOperationContext BeginExecute(string title, string defaultDescription, bool allowCancellation, bool showProgress) { - get - { - if (_bestImpl == null) - { - var orderedImpls = Orderer.Order(_unorderedImplementations); - if (orderedImpls.Count == 0) - { - throw new ImportCardinalityMismatchException($"Expected to import at least one export of {typeof(IUIThreadOperationExecutor).FullName}, but got none."); - } - - _bestImpl = orderedImpls[0].Value; - } + return BestImplementation.BeginExecute(title, defaultDescription, allowCancellation, showProgress); + } - return _bestImpl; - } + public IUIThreadOperationContext BeginExecute(UIThreadOperationExecutionOptions executionOptions) + { + return BestImplementation.BeginExecute(executionOptions); } - public IUIThreadOperationContext BeginExecute(string title, string description, bool allowCancel, bool showProgress) + public UIThreadOperationStatus Execute(string title, string defaultDescription, bool allowCancellation, bool showProgress, Action<IUIThreadOperationContext> action) { - return BestImplementation.BeginExecute(title, description, allowCancel, showProgress); + return BestImplementation.Execute(title, defaultDescription, allowCancellation, showProgress, action); } - public UIThreadOperationStatus Execute(string title, string description, bool allowCancel, bool showProgress, Action<IUIThreadOperationContext> action) + public UIThreadOperationStatus Execute(UIThreadOperationExecutionOptions executionOptions, Action<IUIThreadOperationContext> action) { - return BestImplementation.Execute(title, description, allowCancel, showProgress, action); + return BestImplementation.Execute(executionOptions, action); } } -} +}
\ No newline at end of file |