MegaBites-AI/Windows-powershell
0372
1// Copyright (c) Microsoft Corporation.2// Licensed under the MIT License.3 4namespace System.Management.Automation.Remoting.WSMan5{6 /// <summary>7 /// This class channels WSMan server specific notifications to subscribers.8 /// One example is shutting down.9 /// </summary>10 public static class WSManServerChannelEvents11 {12 #region public members13 14 /// <summary>15 /// Event raised when shutting down WSMan server.16 /// </summary>17 public static event EventHandler ShuttingDown;18 19 /// <summary>20 /// Event raised when active sessions in an endpoint are changed.21 /// </summary>22 public static event EventHandler<ActiveSessionsChangedEventArgs> ActiveSessionsChanged;23 24 #endregion public members25 26 #region internal members27 28 /// <summary>29 /// Raising shutting down WSMan server event.30 /// </summary>31 internal static void RaiseShuttingDownEvent()32 {33 ShuttingDown?.Invoke(null, EventArgs.Empty);34 }35 36 /// <summary>37 /// Raising ActiveSessionsChanged event.38 /// </summary>39 internal static void RaiseActiveSessionsChangedEvent(ActiveSessionsChangedEventArgs eventArgs)40 {41 ActiveSessionsChanged?.Invoke(null, eventArgs);42 }43 44 #endregion internal members45 }46 47 /// <summary>48 /// Holds the event arguments when active sessions count changed.49 /// </summary>50 public sealed class ActiveSessionsChangedEventArgs : EventArgs51 {52 /// <summary>53 /// Creates a new ActiveSessionsChangedEventArgs instance.54 /// </summary>55 /// <param name="activeSessionsCount"></param>56 public ActiveSessionsChangedEventArgs(int activeSessionsCount)57 {58 ActiveSessionsCount = activeSessionsCount;59 }60 61 /// <summary>62 /// ActiveSessionsCount.63 /// </summary>64 public int ActiveSessionsCount65 {66 get;67 internal set;68 }69 }70}71 