public BridgeFrameBuffer(Vector?dpi = null) { _dpi = dpi ?? new Vector(192, 192); var instancePath = Locator.FindDfrDevice(); if (instancePath == null) { throw new Exception("DFR Display Device not found"); } _fd = NativeMethods.CreateFile( instancePath, FileAccess.Write, FileShare.None, IntPtr.Zero, FileMode.Open, FileOptions.None, IntPtr.Zero ); if (_fd == IntPtr.Zero) { throw new Exception("Error: " + Marshal.GetLastWin32Error()); } // At least for now, the DFR display spec is fully known and determined across all devices. // Should this changes, issue an IOCTL to retrieve device spec in the future. }
public FnKeyNotifier(Dispatcher dispatcher) { var instancePath = Locator.FindDfrDevice(); if (instancePath == null) { throw new Exception("DFR Display Device not found"); } _dispatcher = dispatcher; _fd = NativeMethods.CreateFile( instancePath, FileAccess.ReadWrite, FileShare.None, IntPtr.Zero, FileMode.Open, FileOptions.None, IntPtr.Zero ); if (_fd == IntPtr.Zero) { throw new Exception("Error: " + Marshal.GetLastWin32Error()); } ThreadPool.UnsafeQueueUserWorkItem(_ => PollNextFnStatus(), null); }