/// <summary> /// Returns a list of all unattached displays on this machine /// </summary> /// <returns>An enumerable list of UnAttachedDisplay</returns> public static IEnumerable <UnAttachedDisplay> GetUnAttachedDisplays() { return (DisplayAdapter.GetDisplayAdapters() .SelectMany(adapter => adapter.GetDisplayDevices(false)) .Where(device => !device.IsAvailable) .Select(device => new UnAttachedDisplay(device))); }
/// <summary> /// Creates a new DisplayDevice /// </summary> /// <param name="devicePath">The device path</param> /// <param name="deviceName">The device name</param> /// <param name="deviceKey">The device driver registry key</param> /// <param name="adapter">The device parent DisplayAdapter</param> /// <param name="isAvailable">true if the device is attached, otherwise false</param> /// <param name="isValid">true if this instance is valid, otherwise false</param> protected DisplayDevice(string devicePath, string deviceName, string deviceKey, DisplayAdapter adapter, bool isAvailable, bool isValid) : this(devicePath, deviceName, deviceKey) { Adapter = adapter; IsAvailable = isAvailable; IsValid = isValid; }
/// <summary> /// Returns a list of all attached displays on this machine /// </summary> /// <returns>An enumerable list of Displays</returns> public static IEnumerable <Display> GetDisplays() { return (DisplayAdapter.GetDisplayAdapters() .SelectMany(adapter => adapter.GetDisplayDevices(true)) .Where(device => device.IsAvailable) .Select(device => new Display(device))); }
internal static DisplayDevice FromDeviceInformation(DisplayAdapter adapter, Native.DeviceContext.Structures.DisplayDevice sourceDevice, Native.DeviceContext.Structures.DisplayDevice targetDevice) { return(new DisplayDevice(targetDevice.DeviceId, targetDevice.DeviceString, targetDevice.DeviceKey, adapter, sourceDevice.DeviceName, targetDevice.DeviceName, targetDevice.StateFlags.HasFlag(DisplayDeviceStateFlags.AttachedToDesktop), true)); }
/// <summary> /// Creates a new DisplayDevice /// </summary> /// <param name="devicePath">The device path</param> /// <param name="deviceName">The device name</param> /// <param name="deviceKey">The device driver registry key</param> /// <param name="adapter">The device parent DisplayAdapter</param> /// <param name="displayName">The device source display name</param> /// <param name="displayFullName">The device target display name</param> /// <param name="isAvailable">true if the device is attached, otherwise false</param> /// <param name="isValid">true if this instance is valid, otherwise false</param> protected DisplayDevice( string devicePath, string deviceName, string deviceKey, DisplayAdapter adapter, string displayName, string displayFullName, bool isAvailable, bool isValid) : this(devicePath, deviceName, deviceKey, adapter, isAvailable, isValid) { DisplayName = displayName; DisplayFullName = displayFullName; }