private void OnNewWiimoteDeviceInterfaceFound(object sender, UserModeLib.IWiimoteDeviceInterface NewInterface)
        {
            Application.Current.Dispatcher.Invoke(() => {
                WiimoteDevice NewWiimoteDevice = new WiimoteDevice(NewInterface);

                NewWiimoteDevice.Disconneted += OnWiimoteDeviceDisconneted;
                ConnectedWiimoteDevices.Add(NewWiimoteDevice);
                ConnectedDevicesListBox.Items.Refresh();

                if (ConnectedDevicesListBox.SelectedItem == null)
                {
                    ConnectedDevicesListBox.SelectedItem = NewWiimoteDevice;
                }

                NewWiimoteDevice.Initilize();
            });
        }
Пример #2
0
        public WiimoteDevice(UserModeLib.IWiimoteDeviceInterface DeviceInterface)
        {
            this.DeviceInterface = DeviceInterface;

            DeviceInterface.StatusUpdate  += OnStatusUpdate;
            DeviceInterface.DeviceRemoved += OnDeviceRemoved;

            Mode = new Option <UserModeLib.DriverMode>(DeviceInterface.SetDriverMode);

            EnableWiimoteXAxisAccelerometer = new Option <bool>(DeviceInterface.SetEnableWiimoteXAxisAccelerometer);
            EnableWiimoteYAxisAccelerometer = new Option <bool>(DeviceInterface.SetEnableWiimoteYAxisAccelerometer);
            SwapMouseButtons       = new Option <bool>(DeviceInterface.SetSwapMouseButtons);
            SwapTriggerAndShoulder = new Option <bool>(DeviceInterface.SetSwapTriggerAndShoulder);
            SplitTriggerAxis       = new Option <bool>(DeviceInterface.SetSplitTrigger);
            MapTriggerAsAxis       = new Option <bool>(DeviceInterface.SetMapTriggerAsAxis);
            MapTriggerAsButtons    = new Option <bool>(DeviceInterface.SetMapTriggerAsButtons);

            EnableWiimoteXAxisAccelerometer.PropertyChanged += OnEnableAccelerometerAxisChanged;
            EnableWiimoteYAxisAccelerometer.PropertyChanged += OnEnableAccelerometerAxisChanged;
        }