예제 #1
0
 private void MainDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     lock (selectionLock)
     {
         var grid    = (DataGrid)sender;
         var setting = grid.SelectedItems.Cast <UserSetting>().FirstOrDefault();
         _CurrentUserSetting = setting;
         // Get device attached to user setting.
         _CurrentUserDevice = setting == null
                                 ? new UserDevice()
                                 : SettingsManager.GetDevice(setting.InstanceGuid);
         // Get mappings attached to user setting.
         _CurrentPadSetting = setting == null
                                 ? new PadSetting()
                                 : SettingsManager.GetPadSetting(setting.PadSettingChecksum);
         DPadPanel.SetBinding(_CurrentPadSetting);
         PadListPanel.SetBinding(MappedTo, _CurrentUserSetting);
         GeneralPanel.SetBinding(MappedTo, _CurrentPadSetting);
         AdvancedPanel.SetBinding(_CurrentPadSetting);
         LeftTriggerPanel.SetBinding(_CurrentPadSetting);
         RightTriggerPanel.SetBinding(_CurrentPadSetting);
         LeftThumbXPanel.SetBinding(_CurrentPadSetting);
         LeftThumbYPanel.SetBinding(_CurrentPadSetting);
         RightThumbXPanel.SetBinding(_CurrentPadSetting);
         RightThumbYPanel.SetBinding(_CurrentPadSetting);
         ForceFeedbackPanel.SetBinding(MappedTo, _CurrentPadSetting);
         ForceFeedbackPanel.LeftForceFeedbackMotorPanel.SetBinding(_CurrentPadSetting, 0);
         ForceFeedbackPanel.RightForceFeedbackMotorPanel.SetBinding(_CurrentPadSetting, 1);
         PadFootPanel.SetBinding(MappedTo, _CurrentUserDevice, _CurrentPadSetting);
         SettingsManager.Current.LoadPadSettingsIntoSelectedDevice(MappedTo, _CurrentPadSetting);
         OnSettingChanged?.Invoke(this, new EventArgs <UserSetting>(setting));
     }
 }
예제 #2
0
 public void InitControls(MapTo mappedTo)
 {
     if (ControlsHelper.IsDesignMode(this))
     {
         return;
     }
     // Add controls which must be notified on setting selection change.
     Global.UpdateControlFromStates += Global_UpdateControlFromStates;
     // Hide for this version.
     //PadItemPanel.PadTabControl.Items.Remove(PadItemPanel.XInputTabPage);
     //PadItemPanel.XInputTabPage.Content = null;
     //PadTabControl.TabPages.Remove(MacrosTabPage);
     RemapName                  = GeneralPanel.RemapAllButton.Content as string;
     MappedTo                   = mappedTo;
     _Imager                    = new PadControlImager();
     _Imager.Top                = XboxImage.TopPictureImage;
     _Imager.Front              = XboxImage.FrontPictureImage;
     _Imager.LeftThumbStatus    = XboxImage.LeftThumbContentControl;
     _Imager.RightThumbStatus   = XboxImage.RightThumbContentControl;
     _Imager.LeftTriggerStatus  = XboxImage.LeftTriggerContentControl;
     _Imager.RightTriggerStatus = XboxImage.RightTriggerContentControl;
     _Imager.ImageControl       = XboxImage;
     XboxImage.InitializeImages(imageInfos, _Imager, mappedTo);
     XboxImage.StartRecording = StartRecording;
     XboxImage.StopRecording  = StopRecording;
     // Axis to Button DeadZones
     ButtonsPanel.AxisToButtonADeadZonePanel.MonitorComboBoxWpf          = GeneralPanel.ButtonATextBox;
     ButtonsPanel.AxisToButtonBDeadZonePanel.MonitorComboBoxWpf          = GeneralPanel.ButtonBTextBox;
     ButtonsPanel.AxisToButtonXDeadZonePanel.MonitorComboBoxWpf          = GeneralPanel.ButtonXTextBox;
     ButtonsPanel.AxisToButtonYDeadZonePanel.MonitorComboBoxWpf          = GeneralPanel.ButtonYTextBox;
     ButtonsPanel.AxisToButtonStartDeadZonePanel.MonitorComboBoxWpf      = GeneralPanel.ButtonStartTextBox;
     ButtonsPanel.AxisToButtonBackDeadZonePanel.MonitorComboBoxWpf       = GeneralPanel.ButtonBackTextBox;
     ButtonsPanel.AxisToLeftShoulderDeadZonePanel.MonitorComboBoxWpf     = GeneralPanel.LeftShoulderTextBox;
     ButtonsPanel.AxisToLeftThumbButtonDeadZonePanel.MonitorComboBoxWpf  = GeneralPanel.LeftThumbButtonTextBox;
     ButtonsPanel.AxisToRightShoulderDeadZonePanel.MonitorComboBoxWpf    = GeneralPanel.RightShoulderTextBox;
     ButtonsPanel.AxisToRightThumbButtonDeadZonePanel.MonitorComboBoxWpf = GeneralPanel.RightThumbButtonTextBox;
     ButtonsPanel.AxisToDPadDownDeadZonePanel.MonitorComboBoxWpf         = GeneralPanel.DPadDownTextBox;
     ButtonsPanel.AxisToDPadLeftDeadZonePanel.MonitorComboBoxWpf         = GeneralPanel.DPadLeftTextBox;
     ButtonsPanel.AxisToDPadRightDeadZonePanel.MonitorComboBoxWpf        = GeneralPanel.DPadRightTextBox;
     ButtonsPanel.AxisToDPadUpDeadZonePanel.MonitorComboBoxWpf           = GeneralPanel.DPadUpTextBox;
     // Monitor setting changes.
     SettingsManager.Current.SettingChanged += Current_SettingChanged;
     PadListPanel.SetBinding(MappedTo);
     PadListPanel.MainDataGrid.SelectionChanged += MainDataGrid_SelectionChanged;
 }