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