public void InitializeSettings(SettingsLogic.Settings settings) { try { _settings = settings; // It's possible the settings file doesn't include the options or there is a // conversion exception _moveStick = _settings.Options.GetOption(OptionNames.MoveStick).GetValueAsThumbSticks(); _lookStick = _settings.Options.GetOption(OptionNames.LookStick).GetValueAsThumbSticks(); _mouseLookSensitivity = _settings.Options.GetOption(OptionNames.MouseLookSensitivity).GetValueAsDouble(); _cursorMoveSensitivity = _settings.Options.GetOption(OptionNames.CursorMoveSensitivity).GetValueAsDouble(); _cursorCenterOffsetX = _settings.Options.GetOption(OptionNames.CursorCenterOffsetX).GetValueAsDouble(); _cursorCenterOffsetY = _settings.Options.GetOption(OptionNames.CursorCenterOffsetY).GetValueAsDouble(); } finally { } }
static Settings CreateNewSettings(string displayName) { Settings s = new Settings { DisplayName = displayName, Options = new OptionCollection { new Option { Name = OptionNames.MoveStick, Value = GameController.ThumbSticks.Left.ToString(), ValueType = ValueTypes.ThumbSticks }, new Option { Name = OptionNames.LookStick, Value = GameController.ThumbSticks.Right.ToString(), ValueType = ValueTypes.ThumbSticks }, new Option { Name = OptionNames.MouseLookSensitivity, Value = "50.0", ValueType = ValueTypes.Double }, new Option { Name = OptionNames.CursorMoveSensitivity, Value = "50.0", ValueType = ValueTypes.Double }, new Option { Name = OptionNames.CursorCenterOffsetX, Value = "0.0", ValueType = ValueTypes.Double }, new Option { Name = OptionNames.CursorCenterOffsetY, Value = "0.0", ValueType = ValueTypes.Double } }, KeyBindings = new KeyBindingCollection { // Buttons while no trigger is pressed new KeyBinding{ TriggerModifier= GameController.Triggers.None, Button= GameController.Buttons.A, KeyBoardKey= System.Windows.Input.Key.D1, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.None, Button= GameController.Buttons.B, KeyBoardKey= System.Windows.Input.Key.D2, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.None, Button= GameController.Buttons.X, KeyBoardKey= System.Windows.Input.Key.D3, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.None, Button= GameController.Buttons.Y, KeyBoardKey= System.Windows.Input.Key.D4, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.None, Button= GameController.Buttons.Back, KeyBoardKey= System.Windows.Input.Key.Escape, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.None, Button= GameController.Buttons.Start, KeyBoardKey= System.Windows.Input.Key.M, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.None, Button= GameController.Buttons.LeftShoulder, KeyBoardKey= System.Windows.Input.Key.Tab, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.None, Button= GameController.Buttons.RightShoulder, KeyBoardKey= System.Windows.Input.Key.Attn, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.None, Button= GameController.Buttons.LeftStick, KeyBoardKey= System.Windows.Input.Key.NumLock, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.None, Button= GameController.Buttons.RightStick, KeyBoardKey= System.Windows.Input.Key.Space, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.None, Button= GameController.Buttons.DPadUp, KeyBoardKey= System.Windows.Input.Key.LeftShift, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.None, Button= GameController.Buttons.DPadLeft, KeyBoardKey= System.Windows.Input.Key.LeftAlt, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.None, Button= GameController.Buttons.DPadDown, KeyBoardKey= System.Windows.Input.Key.LeftCtrl, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.None, Button= GameController.Buttons.DPadRight, KeyBoardKey= System.Windows.Input.Key.B, Modifier= System.Windows.Input.ModifierKeys.None }, // Buttons while LeftTrigger is pressed new KeyBinding{ TriggerModifier= GameController.Triggers.Left, Button= GameController.Buttons.A, KeyBoardKey= System.Windows.Input.Key.D5, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Left, Button= GameController.Buttons.B, KeyBoardKey= System.Windows.Input.Key.D6, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Left, Button= GameController.Buttons.X, KeyBoardKey= System.Windows.Input.Key.D7, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Left, Button= GameController.Buttons.Y, KeyBoardKey= System.Windows.Input.Key.D8, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Left, Button= GameController.Buttons.Back, KeyBoardKey= System.Windows.Input.Key.Escape, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Left, Button= GameController.Buttons.Start, KeyBoardKey= System.Windows.Input.Key.M, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Left, Button= GameController.Buttons.LeftShoulder, KeyBoardKey= System.Windows.Input.Key.Tab, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Left, Button= GameController.Buttons.RightShoulder, KeyBoardKey= System.Windows.Input.Key.Attn, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Left, Button= GameController.Buttons.LeftStick, KeyBoardKey= System.Windows.Input.Key.NumLock, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Left, Button= GameController.Buttons.RightStick, KeyBoardKey= System.Windows.Input.Key.Space, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Left, Button= GameController.Buttons.DPadUp, KeyBoardKey= System.Windows.Input.Key.LeftShift, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Left, Button= GameController.Buttons.DPadLeft, KeyBoardKey= System.Windows.Input.Key.LeftAlt, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Left, Button= GameController.Buttons.DPadDown, KeyBoardKey= System.Windows.Input.Key.LeftCtrl, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Left, Button= GameController.Buttons.DPadRight, KeyBoardKey= System.Windows.Input.Key.B, Modifier= System.Windows.Input.ModifierKeys.None }, // Buttons while RightTrigger is pressed new KeyBinding{ TriggerModifier= GameController.Triggers.Right, Button= GameController.Buttons.A, KeyBoardKey= System.Windows.Input.Key.D9, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Right, Button= GameController.Buttons.B, KeyBoardKey= System.Windows.Input.Key.D0, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Right, Button= GameController.Buttons.X, KeyBoardKey= System.Windows.Input.Key.Subtract, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Right, Button= GameController.Buttons.Y, KeyBoardKey= System.Windows.Input.Key.Add, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Right, Button= GameController.Buttons.Back, KeyBoardKey= System.Windows.Input.Key.Escape, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Right, Button= GameController.Buttons.Start, KeyBoardKey= System.Windows.Input.Key.M, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Right, Button= GameController.Buttons.LeftShoulder, KeyBoardKey= System.Windows.Input.Key.Tab, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Right, Button= GameController.Buttons.RightShoulder, KeyBoardKey= System.Windows.Input.Key.Attn, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Right, Button= GameController.Buttons.LeftStick, KeyBoardKey= System.Windows.Input.Key.NumLock, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Right, Button= GameController.Buttons.RightStick, KeyBoardKey= System.Windows.Input.Key.Space, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Right, Button= GameController.Buttons.DPadUp, KeyBoardKey= System.Windows.Input.Key.LeftShift, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Right, Button= GameController.Buttons.DPadLeft, KeyBoardKey= System.Windows.Input.Key.LeftAlt, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Right, Button= GameController.Buttons.DPadDown, KeyBoardKey= System.Windows.Input.Key.LeftCtrl, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Right, Button= GameController.Buttons.DPadRight, KeyBoardKey= System.Windows.Input.Key.B, Modifier= System.Windows.Input.ModifierKeys.None }, // Buttons while Both Triggers are pressed new KeyBinding{ TriggerModifier= GameController.Triggers.Both, Button= GameController.Buttons.A, KeyBoardKey= System.Windows.Input.Key.F2, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Both, Button= GameController.Buttons.B, KeyBoardKey= System.Windows.Input.Key.F3, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Both, Button= GameController.Buttons.X, KeyBoardKey= System.Windows.Input.Key.F4, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Both, Button= GameController.Buttons.Y, KeyBoardKey= System.Windows.Input.Key.F5, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Both, Button= GameController.Buttons.Back, KeyBoardKey= System.Windows.Input.Key.Escape, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Both, Button= GameController.Buttons.Start, KeyBoardKey= System.Windows.Input.Key.M, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Both, Button= GameController.Buttons.LeftShoulder, KeyBoardKey= System.Windows.Input.Key.Tab, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Both, Button= GameController.Buttons.RightShoulder, KeyBoardKey= System.Windows.Input.Key.Attn, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Both, Button= GameController.Buttons.LeftStick, KeyBoardKey= System.Windows.Input.Key.NumLock, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Both, Button= GameController.Buttons.RightStick, KeyBoardKey= System.Windows.Input.Key.Space, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Both, Button= GameController.Buttons.DPadUp, KeyBoardKey= System.Windows.Input.Key.Up, Modifier= System.Windows.Input.ModifierKeys.Shift }, new KeyBinding{ TriggerModifier= GameController.Triggers.Both, Button= GameController.Buttons.DPadLeft, KeyBoardKey= System.Windows.Input.Key.LeftAlt, Modifier= System.Windows.Input.ModifierKeys.None }, new KeyBinding{ TriggerModifier= GameController.Triggers.Both, Button= GameController.Buttons.DPadDown, KeyBoardKey= System.Windows.Input.Key.Down, Modifier= System.Windows.Input.ModifierKeys.Shift }, new KeyBinding{ TriggerModifier= GameController.Triggers.Both, Button= GameController.Buttons.DPadRight, KeyBoardKey= System.Windows.Input.Key.B, Modifier= System.Windows.Input.ModifierKeys.None } } }; return s; }
void LoadSettings() { _settingsCollection = SettingsCollection.LoadSettings(SettingsFileName); _settings = _settingsCollection.GetSettings(Properties.Settings.Default.MostRecentSetting); SettingsProfile.ItemsSource = _settingsCollection.GetSettingsNamesList(); SettingsProfile.SelectedValue = _settings.DisplayName; ucOptions.LoadSettings(_settings); ucKeyBinding.LoadSettings(_settings); }