private static void Tba_EnergyChange(string energyId, TbaPopup popup) { ui.Write($"Changing energy to {energyId}"); linac.StopBeam(); var current = linac.GetMachineStateCopy(); switch (energyId) { case "6 MV": current.Energy = Autodrive.Linacs.Energy._6X; break; case "15 MV": current.Energy = Autodrive.Linacs.Energy._15X; break; case "6 MeV": current.Energy = Autodrive.Linacs.Energy._6MeV; break; case "9 MeV": current.Energy = Autodrive.Linacs.Energy._9MeV; break; case "12 MeV": current.Energy = Autodrive.Linacs.Energy._12MeV; break; case "15 MeV": current.Energy = Autodrive.Linacs.Energy._15MeV; break; case "18 MeV": current.Energy = Autodrive.Linacs.Energy._18MeV; break; } linac.SetMachineState(current); popup.ResetEvent.Set(); //Allow to move on }