1
// -----------------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 // -----------------------------------------------------------------------
5 using System
.Collections
.Generic
;
6 using System
.ComponentModel
.Composition
.Primitives
;
7 using Microsoft
.Internal
;
8 using Microsoft
.Internal
.Collections
;
10 namespace System
.ComponentModel
.Composition
.Hosting
13 /// Provides data for the <see cref="INotifyComposablePartCatalogChanged.Changed"/> and
14 /// <see cref="INotifyComposablePartCatalogChanged.Changing"/> events.
16 public class ComposablePartCatalogChangeEventArgs
: EventArgs
19 /// Initializes a new instance of the <see cref="ComposablePartCatalogChangeEventArgs"/>.
21 /// <param name="addedDefinitions">
22 /// An <see cref="IEnumerable{T}"/> of <see cref="ComposablePartDefinition"/> objects that
23 /// are being added to the <see cref="ComposablePartCatalog"/>.
25 /// <param name="removedDefinitions">
26 /// An <see cref="IEnumerable{T}"/> of <see cref="ComposablePartDefinition"/> objects that
27 /// are being removed from the <see cref="ComposablePartCatalog"/>.
29 /// <param name="atomicComposition">
30 /// A <see cref="AtomicComposition"/> representing all tentative changes that will
31 /// be completed if the change is successful, or discarded if it is not.
32 /// <see langword="null"/> if being applied outside a <see cref="AtomicComposition"/>
33 /// or during a <see cref="INotifyComposablePartCatalogChanged.Changed"/> event.
35 /// <exception cref="ArgumentNullException">
36 /// <paramref name="addedDefinitions"/> or <paramref name="removedDefinitions"/> is <see langword="null"/>.
38 public ComposablePartCatalogChangeEventArgs(IEnumerable
<ComposablePartDefinition
> addedDefinitions
,
39 IEnumerable
<ComposablePartDefinition
> removedDefinitions
, AtomicComposition atomicComposition
)
41 Requires
.NotNull(addedDefinitions
, "addedDefinitions");
42 Requires
.NotNull(removedDefinitions
, "removedDefinitions");
44 this.AddedDefinitions
= addedDefinitions
.AsArray();
45 this.RemovedDefinitions
= removedDefinitions
.AsArray();
46 this.AtomicComposition
= atomicComposition
;
50 /// Gets the identifiers of the parts that have been added.
53 /// An <see cref="IEnumerable{T}"/> of <see cref="ComposablePartDefinition"/> objects that
54 /// have been added to the <see cref="ComposablePartCatalog"/>.
56 public IEnumerable
<ComposablePartDefinition
> AddedDefinitions { get; private set; }
59 /// Gets the identifiers of the parts that have been removed.
62 /// An <see cref="IEnumerable{T}"/> of <see cref="ComposablePartDefinition"/> objects that
63 /// have been removed from from the <see cref="ComposablePartCatalog"/>.
65 public IEnumerable
<ComposablePartDefinition
> RemovedDefinitions { get; private set; }
68 /// Gets the atomicComposition, if any, that this change applies to.
71 /// A <see cref="AtomicComposition"/> that this set of changes applies too.
72 /// It can be <see langword="null"/> if the changes are being applied outside a
73 /// <see cref="AtomicComposition"/> or during a
74 /// <see cref="INotifyComposablePartCatalogChanged.Changed"/> event.
76 /// When the value is non-null it should be used to record temporary changed state
77 /// and actions that will be executed when the atomicComposition is completeed.
79 public AtomicComposition AtomicComposition { get; private set; }