Example #1
0
        private void AddDevice(IDevice device, Gtk.TreeIter iter)
        {
            // choose the deviceInformation to create
            IDeviceInformation deviceInformation = null;

            if (device is IWiimote)
            {
                _ListStore.SetValue(iter, 0, "Wiimote");
                deviceInformation = new WiimoteInformation(this, (IWiimote)device);
            }
            else if (device is IBalanceBoard)
            {
                _ListStore.SetValue(iter, 0, "Balanceboard");
                deviceInformation = new BalanceBoardInformation((IBalanceBoard)device);
            }

            // add a seperator to the form to separate from other deviceInformations
            deviceInformation.Separator = new VSeparator();
            _HBox.PackStart(deviceInformation.Separator);
            deviceInformation.Separator.Show();

            // add the deviceInformation to the form
            _HBox.PackStart(deviceInformation.Widget, false, false, 0);
            deviceInformation.Widget.Show();
            _DeviceInformations.Add(deviceInformation);
            _DeviceNodes[deviceInformation] = iter;

            // register for the event so the deviceInformation can be removed upon disconnection
            device.Disconnected += new EventHandler(DeviceDisconnected);
        }
        private void AddDevice(IDevice device, Gtk.TreeIter iter)
        {
            // choose the deviceInformation to create
            IDeviceInformation deviceInformation = null;
            if(device is IWiimote)
            {
                _ListStore.SetValue(iter, 0, "Wiimote");
                deviceInformation = new WiimoteInformation(this, (IWiimote)device);
            }
            else if(device is IBalanceBoard)
            {
                _ListStore.SetValue(iter, 0, "Balanceboard");
                deviceInformation = new BalanceBoardInformation((IBalanceBoard)device);
            }

            // add a seperator to the form to separate from other deviceInformations
            deviceInformation.Separator = new VSeparator();
            _HBox.PackStart(deviceInformation.Separator);
            deviceInformation.Separator.Show();

            // add the deviceInformation to the form
            _HBox.PackStart(deviceInformation.Widget, false, false, 0);
            deviceInformation.Widget.Show();
            _DeviceInformations.Add(deviceInformation);
            _DeviceNodes[deviceInformation] = iter;

            // register for the event so the deviceInformation can be removed upon disconnection
            device.Disconnected += new EventHandler(DeviceDisconnected);
        }