private void HandleButtonCommand(GameControllerButtonCommand command, GameControllerUpdateNotification notification) { int index; switch (command) { case GameControllerButtonCommand.UnPark: if (notification == GameControllerUpdateNotification.CommandUp) { if (ParkCommand.CanExecute(null)) { if (IsParked) { ParkCommand.Execute(null); } } } break; case GameControllerButtonCommand.ParkToHome: if (notification == GameControllerUpdateNotification.CommandUp) { if (ParkCommand.CanExecute(null)) { if (!IsParked) { ParkCommand.Execute(null); } } } break; case GameControllerButtonCommand.Sync: if (notification == GameControllerUpdateNotification.CommandUp) { if (SyncCommand.CanExecute(null)) { SyncCommand.Execute(null); } } break; case GameControllerButtonCommand.IncrementPreset: index = Settings.SlewRatePresets.IndexOf(Settings.SlewRatePreset); if (index < Settings.SlewRatePresets.Count - 1) { Settings.SlewRatePreset = Settings.SlewRatePresets[index + 1]; } break; case GameControllerButtonCommand.DecrementPreset: index = Settings.SlewRatePresets.IndexOf(Settings.SlewRatePreset); if (index > 0) { Settings.SlewRatePreset = Settings.SlewRatePresets[index - 1]; } break; case GameControllerButtonCommand.EmergencyStop: if (notification == GameControllerUpdateNotification.CommandUp) { if (StopSlewCommand.CanExecute(SlewButton.Stop)) { StopSlewCommand.Execute(SlewButton.Stop); } } break; case GameControllerButtonCommand.North: HandleSlewButton(SlewButton.North, notification); break; case GameControllerButtonCommand.South: HandleSlewButton(SlewButton.South, notification); break; case GameControllerButtonCommand.East: HandleSlewButton(SlewButton.East, notification); break; case GameControllerButtonCommand.West: HandleSlewButton(SlewButton.West, notification); break; case GameControllerButtonCommand.ReverseRA: if (notification == GameControllerUpdateNotification.CommandUp) { Settings.ReverseRA = !Settings.ReverseRA; } break; case GameControllerButtonCommand.ReverseDec: if (notification == GameControllerUpdateNotification.CommandUp) { Settings.ReverseDec = !Settings.ReverseDec; } break; case GameControllerButtonCommand.SiderealRate: HandleStartStopTrackingButton(TrackingMode.Sidereal, notification); break; case GameControllerButtonCommand.LunarRate: HandleStartStopTrackingButton(TrackingMode.Lunar, notification); break; case GameControllerButtonCommand.SolarRate: HandleStartStopTrackingButton(TrackingMode.Solar, notification); break; case GameControllerButtonCommand.CustomRate: HandleStartStopTrackingButton(TrackingMode.Custom, notification); break; case GameControllerButtonCommand.StopTracking: HandleStartStopTrackingButton(TrackingMode.Stop, notification); break; } }