string[] ToStringArray(Models.IdPlane idPlane, Models.TypePlane typePlane, int nbFailures, Models.IdFailureX idFailureX, Models.IdComponentFailureX idComponentFailure) { Random rnd = new Random(); int level = rnd.Next(1, 5); String comm = commment[rnd.Next(commment.Count)]; string[] str = new string[] { idPlane.ToString(), typePlane.Id, nbFailures.ToString(), idFailureX.Id, DateTime.Now.Ticks.ToString(), level.ToString(), comm.Length.ToString(), comm }; return(str); }
void _simulator_ErrorOccured(Models.IdPlane arg1, Models.IdFailureX arg2, Models.TypePlane arg3, Models.IdComponentFailureX arg4) { var stringArr = ToStringArray(arg1, arg3, 0, arg2, arg4); error_report(stringArr); string message = $"Error : {arg2} \n On Component : {arg4} \n On Plane {arg1} \n Of Type {arg3}"; AddError(message); }
private void ManualSimulationDialog_OptionsSelected(List <Models.IdFailureX> arg1, Models.IdPlane arg2) { if (!_isSimulationMode) { string strDuration = DurationTextBox.Text; string strInterval = TimeIntervalTextBox.Text; int duration = 0; int interval = 0; if (!int.TryParse(strDuration, out duration)) { MessageBox.Show("Please enter a valid duration in Seconds"); return; } if (!int.TryParse(strInterval, out interval)) { MessageBox.Show("Please enter a valid interval integer less than."); return; } if (_simulator != null) { _simulator.ErrorOccured -= _simulator_ErrorOccured; _simulator.SimulationFinished -= _simulator_SimulationFinished; } interval = new Random().Next(1, 20); _simulator = new Simulator(arg1, arg2, duration, interval); Simulate(); } else { MessageBox.Show("Simulation going on."); } }