private void clearMap(HIDButtonMap map) { if (map != null) { map.Clear(); this.RefreshBindings(); } }
private void editChannel() { this.map = this.channel.Mapping; this.mapAlt = this.channel.MappingAlternative; this.channel.SetupMode = true; this.channel.ControlChanged += Channel_ControlChanged; this.RefreshBindings(); }
private void DisposeOldChannel() { if (this.channel != null) { this.channel.SetupMode = false; this.channel.ControlChanged -= Channel_ControlChanged; this.map = null; this.mapAlt = null; } }
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); } }
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(); } }
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; } } }