/// <summary>
        /// Call this if you want to receive list of currently active monitors.
        /// What does "active" mean in our context? It means the monitors that are "enabled"
        /// in Desktop properties screen.
        /// </summary>
        /// <returns>list of active monitors</returns>
        public IEnumerable <IDisplay> GetActiveMonitors()
        {
            var displayDevices = GetDisplayDevices();

            // find out resolution parameters for each display device.
            foreach (var displayDevice in displayDevices.Where(
                         x => x.StateFlags.HasFlag(DisplayDeviceStateFlags.AttachedToDesktop)))
            {
                var mode = new DevMode {
                    size = (short)Marshal.SizeOf(typeof(DevMode))
                };

                // -1 means current RESOLUTION for specific display.
                // you can enumerate through 0..N to find supported resolutions.
                var success = XPWrapper.EnumDisplaySettings(displayDevice.DeviceName, -1, ref mode);
                if (!success)
                {
                    continue;
                }

                var origin      = mode.position;
                var resolution  = mode.resolution;
                var refreshRate = mode.displayFrequency;
                var rotation    = mode.displayOrientation;
                var isPrimary   = IsPrimaryDisplay(origin);

                if (isPrimary && !displayDevice.StateFlags.HasFlag(DisplayDeviceStateFlags.PrimaryDevice))
                {
                    throw new Exception("SEEMS LIKE MSDN DOCUMENT LIED, IF THIS ERROR EVER HAPPENS.");
                }

                yield return(new XPDisplay(new DisplaySettings(resolution, origin,
                                                               rotation.ToScreenRotation(), refreshRate, isPrimary, displayDevice.DeviceName)));
            }
        }
        public override IEnumerable <Display> GetActiveDisplays()
        {
            var displayDevices = GetDisplayDevices();

            // find out resolution parameters for each display device.
            foreach (var displayDevice in displayDevices.Where(
                         x => x.StateFlags.HasFlag(DisplayDeviceStateFlags.AttachedToDesktop)))
            {
                var mode = new DevMode {
                    size = (short)Marshal.SizeOf(typeof(DevMode))
                };

                // -1 means current RESOLUTION for specific display.
                // you can enumerate through 0..N to find supported resolutions.
                var success = XPWrapper.EnumDisplaySettings(displayDevice.DeviceName, -1, ref mode);
                if (!success)
                {
                    continue;
                }

                var origin      = mode.position;
                var resolution  = mode.resolution;
                var refreshRate = mode.displayFrequency;
                var rotation    = mode.displayOrientation;

                yield return(new Display
                {
                    Resolution = resolution,
                    Origin = origin,
                    Rotation = rotation.ToScreenRotation(),
                    RefreshRate = refreshRate,
                    Name = displayDevice.DeviceName
                });
            }
        }