Windows-powershell / PowerShell-master /src /System.Management.Automation /engine /remoting /server /WSManChannelEvents.cs
| // 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 | |
| { | |
| /// <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; | |
| /// <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); | |
| } | |
| } | |
| /// <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; | |
| } | |
| } | |
| } | |