File size: 2,052 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace System.Management.Automation.Remoting.WSMan
{
    /// <summary>
    /// This class channels WSMan server specific notifications to subscribers.
    /// One example is shutting down.
    /// </summary>
    public static class WSManServerChannelEvents
    {
        #region public members

        /// <summary>
        /// Event raised when shutting down WSMan server.
        /// </summary>
        public static event EventHandler ShuttingDown;

        /// <summary>
        /// Event raised when active sessions in an endpoint are changed.
        /// </summary>
        public static event EventHandler<ActiveSessionsChangedEventArgs> ActiveSessionsChanged;

        #endregion public members

        #region internal members

        /// <summary>
        /// Raising shutting down WSMan server event.
        /// </summary>
        internal static void RaiseShuttingDownEvent()
        {
            ShuttingDown?.Invoke(null, EventArgs.Empty);
        }

        /// <summary>
        /// Raising ActiveSessionsChanged event.
        /// </summary>
        internal static void RaiseActiveSessionsChangedEvent(ActiveSessionsChangedEventArgs eventArgs)
        {
            ActiveSessionsChanged?.Invoke(null, eventArgs);
        }

        #endregion internal members
    }

    /// <summary>
    /// Holds the event arguments when active sessions count changed.
    /// </summary>
    public sealed class ActiveSessionsChangedEventArgs : EventArgs
    {
        /// <summary>
        /// Creates a new ActiveSessionsChangedEventArgs instance.
        /// </summary>
        /// <param name="activeSessionsCount"></param>
        public ActiveSessionsChangedEventArgs(int activeSessionsCount)
        {
            ActiveSessionsCount = activeSessionsCount;
        }

        /// <summary>
        /// ActiveSessionsCount.
        /// </summary>
        public int ActiveSessionsCount
        {
            get;
            internal set;
        }
    }
}