Exemplo n.º 1
0
 public static HIDInputWrapper FromChannel(HIDInputChannel channel)
 {
     if (channel == null)
     {
         return(null);
     }
     return(new HIDInputWrapper(channel));
 }
Exemplo n.º 2
0
        private async Task refreshList()
        {
            await this.manager.RefreshDeviceListAsync();

            this.hidDevicesBox.ItemsSource = this.manager.AvailableDevices;
            if (this.manager.CurrentChannel != null)
            {
                for (int i = 0; i < this.manager.AvailableDevices.Count; i++)
                {
                    if (this.manager.AvailableDevices[i].Id == this.manager.CurrentChannel.DeviceInfo.Id)
                    {
                        this.channel = this.manager.CurrentChannel;
                        this.hidDevicesBox.SelectedIndex = i;
                        this.editChannel();
                        break;
                    }
                }
            }
        }
Exemplo n.º 3
0
        private async void hidDevicesBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DeviceInformation deviceInfo = this.hidDevicesBox.SelectedItem as DeviceInformation;

            if (this.channel != null && deviceInfo != null && this.channel.DeviceId == deviceInfo.Id)
            {
                return;
            }

            this.DisposeOldChannel();

            if (deviceInfo != null)
            {
                this.channel = await this.manager.ConnectAsync(deviceInfo);

                if (this.channel == null)
                {
                    this.map     = null;
                    this.mapAlt  = null;
                    this.channel = null;
                    this.RefreshBindings();

                    await this.services.MessageService.ShowMessage(resources.GetString("hidConnectError"), resources.GetString("errorCaption"));

                    return;
                }

                editChannel();

                EmulatorManager.Current.Emulator.GameController.SetHIDChannel(
                    HIDInputWrapper.FromChannel(this.channel)
                    );
            }
            else
            {
                this.map     = null;
                this.mapAlt  = null;
                this.channel = null;
                this.RefreshBindings();
            }
        }
Exemplo n.º 4
0
 private HIDInputWrapper(HIDInputChannel channel)
 {
     this.channel = channel;
     this.state   = new EmulatorComponent.ControllerState();
 }