private void startStop() { if (accelerator == null) { return; } switch (accelerator.cState) { case OrbitalAccelerator.ConstructionState.IDLE: DialogFactory.Show("The accelerator cannot operate during construction.", "Attention", () => { if (accelerator != null) { accelerator.StartConstruction(); } }, confirmText: "Start", cancelText: "Cancel", context: this); break; case OrbitalAccelerator.ConstructionState.PAUSE: accelerator.StartConstruction(); break; case OrbitalAccelerator.ConstructionState.FINISHED: case OrbitalAccelerator.ConstructionState.ABORTED: break; case OrbitalAccelerator.ConstructionState.DEPLOYING: case OrbitalAccelerator.ConstructionState.CONSTRUCTING: accelerator.StopConstruction(); break; default: throw new ArgumentOutOfRangeException(); } }
private void onAbort() { if (accelerator == null || accelerator.cState == OrbitalAccelerator.ConstructionState.IDLE) { return; } if (accelerator.ConstructedMass > 0) { DialogFactory.Show($"<b>Only {Globals.Instance.RecyclingRatio:P}</b> of resources can be recovered.\n" + "If you don't have enough storage or energy some resources will also be lost.\n" + "<b>Are you sure you want to abort?</b>", "Warning", abort, confirmText: "Abort", cancelText: "Cancel", context: this); } else { abort(); } }