// ReSharper disable MemberCanBePrivate.Global // ReSharper disable UnusedAutoPropertyAccessor.Global using System; namespace RGB.NET.Core { /// /// /// Represents the information supplied with an -event. /// public class SurfaceLayoutChangedEventArgs : EventArgs { #region Properties & Fields /// /// Gets the that caused the change. Returns null if the change isn't caused by a . /// public IRGBDevice? Devices { get; } /// /// Gets a value indicating if the event is caused by the addition of a new to the . /// public bool DeviceAdded { get; } /// /// Gets a value indicating if the event is caused by the removal of a to the . /// public bool DeviceRemoved { get; } /// /// Gets a value indicating if the event is caused by a changed location or size of one of the on the . /// public bool DeviceChanged { get; } #endregion #region Constructors /// /// /// Initializes a new instance of the class. /// /// The that caused the change. /// A value indicating if the event is caused by the addition of a new to the . /// A value indicating if the event is caused by a changed location of one of the devices on the . private SurfaceLayoutChangedEventArgs(IRGBDevice? devices, bool deviceAdded, bool deviceRemoved, bool deviceChanged) { this.Devices = devices; this.DeviceAdded = deviceAdded; this.DeviceRemoved = deviceRemoved; this.DeviceChanged = deviceChanged; } #endregion #region Factory internal static SurfaceLayoutChangedEventArgs FromAddedDevice(IRGBDevice device) => new(device, true, false, false); internal static SurfaceLayoutChangedEventArgs FromRemovedDevice(IRGBDevice device) => new(device, false, true, false); internal static SurfaceLayoutChangedEventArgs FromChangedDevice(IRGBDevice device) => new(device, false, false, true); internal static SurfaceLayoutChangedEventArgs Misc() => new(null, false, false, false); #endregion } }