blob: 8f1d05fb4c0eb65614f38f5e98a359a96445a8ad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
using System;
namespace Microsoft.VisualStudio.Utilities
{
/// <summary>
/// Represents a single scope of a context of executing potentially long running operation on the UI thread.
/// Scopes allow multiple components running within an operation to share the same context.
/// </summary>
public interface IUIThreadOperationScope : IDisposable
{
/// <summary>
/// Gets or sets whether the operation can be cancelled.
/// </summary>
bool AllowCancellation { get; set; }
/// <summary>
/// Gets user readable operation description.
/// </summary>
string Description { get; set; }
/// <summary>
/// The <see cref="IUIThreadOperationContext" /> owning this scope instance.
/// </summary>
IUIThreadOperationContext Context { get; }
/// <summary>
/// Progress tracker instance to report operation progress.
/// </summary>
IProgress<ProgressInfo> Progress { get; }
}
/// <summary>
/// Represents an update of a progress.
/// </summary>
public struct ProgressInfo
{
/// <summary>
/// A number of already completed items.
/// </summary>
public int CompletedItems { get; }
/// <summary>
/// A total number if items.
/// </summary>
public int TotalItems { get; }
/// <summary>
/// Creates a new instance of the <see cref="ProgressInfo"/> struct.
/// </summary>
/// <param name="completedItems">A number of already completed items.</param>
/// <param name="totalItems">A total number if items.</param>
public ProgressInfo(int completedItems, int totalItems)
{
this.CompletedItems = completedItems;
this.TotalItems = totalItems;
}
}
}
|