/// <summary> /// High level device implementation. Allows for parameter-less constructor, /// but will show a warning if parameter-less constructor is used when multiple devices are plugged in! /// </summary> /// <param name="context">DirectOutputExtended object which represents SDK instance. Will create new if not supplied</param> /// <param name="deviceId">Id created device should assume</param> public X52(DirectOutputExtended context = null, IntPtr?deviceId = null) { _context = context ?? new DirectOutputExtended(); if (_context.IsInitialized == false) { _context.Initialize(); } if (deviceId == null) { bool singleAssert = false; bool warningIssued = false; //Try to get first device _context.Enumerate((deviceIntPtr, target) => { if (singleAssert == false) { singleAssert = true; } else if (warningIssued == false) { Console.Error.WriteLine("WARNING: More than one device detected! Last found device will be used!"); warningIssued = true; } return(_thisDevice = deviceIntPtr); }); } else { _thisDevice = (IntPtr)deviceId; } _context.RegisterPageCallback(_thisDevice, (device, page, activated, target) => { if (activated) { pages[page].Refresh(); currPage = page; Console.WriteLine("### Callback values ###"); Console.WriteLine("Device: " + device + " page: " + page + " activated: " + activated + " target: " + target); } }); }
public Page(IntPtr parentDevice, int pageNum, DirectOutputExtended context) { _context = context; _pageNum = pageNum; _parentDevice = parentDevice; }