コード例 #1
0
 private void clearMap(HIDButtonMap map)
 {
     if (map != null)
     {
         map.Clear();
         this.RefreshBindings();
     }
 }
コード例 #2
0
 private void editChannel()
 {
     this.map                     = this.channel.Mapping;
     this.mapAlt                  = this.channel.MappingAlternative;
     this.channel.SetupMode       = true;
     this.channel.ControlChanged += Channel_ControlChanged;
     this.RefreshBindings();
 }
コード例 #3
0
 private void DisposeOldChannel()
 {
     if (this.channel != null)
     {
         this.channel.SetupMode       = false;
         this.channel.ControlChanged -= Channel_ControlChanged;
         this.map    = null;
         this.mapAlt = null;
     }
 }
コード例 #4
0
 private void processInputForMap(
     HIDMapping mapping,
     Dictionary <UIElement,
                 Utility.Button> map,
     HIDButtonMap buttonMap,
     UIElement uiElement)
 {
     Utility.Button button;
     if (map.TryGetValue(uiElement, out button))
     {
         buttonMap[button] = mapping;
         FocusManager.TryMoveFocus(FocusNavigationDirection.Next);
         FocusManager.TryMoveFocus(FocusNavigationDirection.Next);
     }
 }
コード例 #5
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();
            }
        }
コード例 #6
0
        private void refreshBindingsForMap(Dictionary <UIElement, Utility.Button> map, HIDButtonMap buttonMap)
        {
            if (buttonMap != null)
            {
                HIDMapping mapping = default(HIDMapping);

                foreach (var item in map)
                {
                    TextBox textBox = item.Key as TextBox;
                    if (textBox == null)
                    {
                        continue;
                    }

                    if (buttonMap.TryGetValue(item.Value, out mapping))
                    {
                        textBox.Text = mapping.DisplayName;
                    }
                    else
                    {
                        textBox.Text = string.Empty;
                    }
                }
            }
            else
            {
                foreach (var item in map)
                {
                    TextBox textBox = item.Key as TextBox;
                    if (textBox == null)
                    {
                        continue;
                    }
                    textBox.Text = string.Empty;
                }
            }
        }