/// <summary> /// Go button was clicked /// </summary> internal void GoButtonClicked() { if (currentController != null) { if (!currentController.CheckConnection()) { return; } if (!controllerActive) { controllerActive = currentController.Activate(); if (!controllerActive) // Refresh after uncomplete activation - show results of a system check { RefreshStatsListLayout(); } } else { controllerActive = currentController.Deactivate(); BonVoyage.Instance.ResetWindows(); } } else { ScreenMessages.PostScreenMessage(Localizer.Format("#LOC_BV_Warning_ControllerNotValid", 5f)).color = Color.yellow; } }
/// <summary> /// Toggle state of the control window dialog /// </summary> internal void ToggleControlWindow() { controlViewVisible = !controlViewVisible; if (controlViewVisible) { // Check if we are in flight, active vessel has full controll and BV controller and is not shutted down bool active = false; if (HighLogic.LoadedSceneIsFlight) { Vessel vessel = FlightGlobals.ActiveVessel; BVController controller = GetControllerOfVessel(FlightGlobals.ActiveVessel); if (controller != null) { active = (!controller.Shutdown && controller.CheckConnection()); } } if (active && (ControlView == null)) { ShowControlWindow(); } else { controlViewVisible = false; } } else { HideControlWindow(); } }
/// <summary> /// Set current controller /// </summary> /// <param name="c"></param> internal void SetController(BVController controller) { currentController = controller; if (controller != null) { if (currentController.CheckConnection()) { controller.SystemCheck(); } controllerActive = controller.Active; } }