public override void OnReceivedMessage(Message message) { switch (message.Route) { case (int)MessageDestination.DECISION_CHOICE_MADE: // A choice was made { Decision choice = (Decision)message.Data; // Fetch the time from the time controller TimeController timeController = Controller.GetSimulationComponent <TimeController>(); float timestamp = timeController.GetCurrentTime(); float remainder = timeController.GetRemainingTime(); // Log the entry into the feedback feedback.LogEntry(choice.Result, choice.DisplayText, choice.Feedback, timestamp, remainder); } break; case (int)MessageDestination.SIMULATION_END: // The simulation ended { // Get a unique file name string fileName = GetFileName(); StreamWriter writer = new StreamWriter(fileName, false); feedback.WriteFeedbackToFile(writer); writer.Close(); // Clear the feedback for the simulation feedback.Clear(); } break; } }
public void Save() { Validations.ValidateAll().OnSuccess(async() => { Validations.ClearAll(); Feedback.Clear(); var option = await ProjectService.Update(new UpdateProjectCommand { Name = Name, Description = Description, }); option.MatchSome(x => { ToastService.ShowSuccess("Updated Successfully"); Feedback.Process(x); }); option.MatchNone(x => Feedback.Process(x)); }); }