File size: 1,257 Bytes
8c763fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using System.Windows;

namespace Microsoft.Management.UI.Internal
{
    /// <summary>
    /// Routed event args which provide the ability to attach an
    /// arbitrary piece of data.
    /// </summary>
    /// <typeparam name="T">There are no restrictions on type T.</typeparam>
    [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
    public class DataRoutedEventArgs<T> : RoutedEventArgs
    {
        private T data;

        /// <summary>
        /// Constructs a new instance of the DataRoutedEventArgs class.
        /// </summary>
        /// <param name="data">The data payload to be stored.</param>
        /// <param name="routedEvent">The routed event.</param>
        public DataRoutedEventArgs(T data, RoutedEvent routedEvent)
        {
            this.data = data;
            this.RoutedEvent = routedEvent;
        }

        /// <summary>
        /// Gets a value containing the data being stored.
        /// </summary>
        public T Data
        {
            get { return this.data; }
        }
    }
}