public PointerDevice(long pointerID, EPointerType PointerType, bool isPrimary) { PointerID = pointerID; IsPrimary = isPrimary; Type = PointerType; DEVICE_LIST.Add(this); if (DEVICE_LIST.Count <= 0 || IsPrimary) { PrimaryDevice[(int)PointerType] = this; } }
protected static void Update_Primary_Device(EPointerType PointerType) { if (DEVICE_LIST.Count <= 0) { PrimaryDevice[(int)PointerType] = null; } else { // Search for a new primary device. var next = DEVICE_LIST.FirstOrDefault(x => x.IsPrimary && x.Type == PointerType); if (next != default) { PrimaryDevice[(int)PointerType] = next; } else { PrimaryDevice[(int)PointerType] = DEVICE_LIST.FirstOrDefault(x => x.Type == PointerType); } } }