Example #1
0
        /// <summary>
        /// Instantiate a device UI element in the list.
        /// </summary>
        /// <param name="device">The Device which has been connected</param>
        private void AddDevice(Device device)
        {
            if (!devicesByID.ContainsKey(device.ID))
            {
                DeviceUIElement uiDevice = Instantiate(deviceUiElementPrefab);

                uiDevice.transform.SetParent(availableDevicesListContainer, false);

                devicesByID.Add(device.ID, uiDevice);
            }

            // Init the ui element with conncted device values. If the user click on this device when it is already connected, go to the next step.
            devicesByID[device.ID].Init(device, () => { nextButton.onClick.Invoke(); });
        }
Example #2
0
        /// <summary>
        /// Instantiate a device UI element in the list.
        /// </summary>
        /// <param name="device">The Device which has been connected</param>
        private void AddDevice(Device device)
        {
            if (device.ConnectionStatus == ConnectionStatus.Connecting || device.IsConnected || device.Paired)
            {
                return;
            }

            if (!devicesByID.ContainsKey(device.ID))
            {
                DeviceUIElement uiDevice = Instantiate(deviceUiElementPrefab);

                uiDevice.transform.SetParent(availableDevicesListContainer, false);

                devicesByID.Add(device.ID, uiDevice);
            }

            // Init the ui element with connected device values. If the user click on this device when it is already connected, go to the next step.
            devicesByID[device.ID].Init(device, () => { NeuroManager.Instance.ConnectDevice(device, filterPaired: false); });
        }