public override void Render(TextBlock textBlock) { textBlock.Inlines.Clear(); this.RenderIntro(textBlock); if (situationReport.TestsOrdered > 0) { textBlock.Inlines.Add($"Yesterday, you ordered {situationReport.TestsOrdered} tests.\n"); if (situationReport.PositiveOrdered.Count == 0) { textBlock.Inlines.Add("All returned negative"); } else if (situationReport.PositiveOrdered.Count == 1) { textBlock.Inlines.Add("One retuned positive: "); CaseRenderer.RenderCases(textBlock.Inlines, situationReport.PositiveOrdered); } else { textBlock.Inlines.Add("Some of them were positive: "); CaseRenderer.RenderCases(textBlock.Inlines, situationReport.PositiveOrdered); } textBlock.Inlines.Add(".\n\n"); } textBlock.Inlines.Add(new Run("Sentinel testing:\n") { FontWeight = FontWeights.Bold }); if (situationReport.PositiveSentinel.Count == 0) { textBlock.Inlines.Add("Sentinel testing did not reveal any cases.\n"); } else if (situationReport.PositiveSentinel.Count == 1) { textBlock.Inlines.Add("One person had symptoms and was tested positive: "); CaseRenderer.RenderCases(textBlock.Inlines, situationReport.PositiveSentinel); textBlock.Inlines.Add(".\n"); } else { textBlock.Inlines.Add("Some people were tested because they had symptoms, and they tested positive: "); CaseRenderer.RenderCases(textBlock.Inlines, situationReport.PositiveSentinel); textBlock.Inlines.Add(".\n"); } }
public override void Render(TextBlock textBlock) { textBlock.Inlines.Clear(); textBlock.Inlines.Add(Person.Name); textBlock.Inlines.Add(new LineBreak()); textBlock.Inlines.Add(new LineBreak()); textBlock.Inlines.Add("Test status: "); switch (Person.LastTestResult) { case PCRTestResult.None: if (Person.City.OrderedTests.Contains(Person)) { textBlock.Inlines.Add("Test results will be available tomorrow.\n"); } else { textBlock.Inlines.Add("Never tested. "); Hyperlink testLink = new Hyperlink(new Run("(test)")); textBlock.Inlines.Add(testLink); textBlock.Inlines.Add(new LineBreak()); testLink.Click += (sender, args) => { Person.Test(); MainWindow.Instance.DocumentBrowser.Refresh(); }; } break; case PCRTestResult.Positive: textBlock.Inlines.Add($"Confirmed positive (on day {Person.LastTestDate}).\n"); break; case PCRTestResult.Negative: textBlock.Inlines.Add($"Tested negative (on day {Person.LastTestDate}). "); Hyperlink retestLink = new Hyperlink(new Run("(retest)")); textBlock.Inlines.Add(retestLink); textBlock.Inlines.Add(new LineBreak()); retestLink.Click += (sender, args) => { Person.Test(); MainWindow.Instance.DocumentBrowser.Refresh(); }; break; } textBlock.Inlines.Add("Clinical status: "); Hyperlink checkStatusLink = null; if (Person.LastDiseaseStatusCheckAt < 0) { textBlock.Inlines.Add("Unknown. "); checkStatusLink = new Hyperlink(new Run("(ask for status)")); } else { switch (Person.LastKnownDiseaseStatus) { case DiseaseStage.Susceptible: textBlock.Inlines.Add($"Healthy and susceptible (on day {Person.LastDiseaseStatusCheckAt}). "); checkStatusLink = new Hyperlink(new Run("(ask again)")); break; case DiseaseStage.Asymptomatic: case DiseaseStage.AsymptomaticInfectious1: case DiseaseStage.AsymptomaticInfectious2: textBlock.Inlines.Add($"Asymptomatic (on day {Person.LastDiseaseStatusCheckAt}). "); checkStatusLink = new Hyperlink(new Run("(ask again)")); break; case DiseaseStage.Mild: textBlock.Inlines.Add($"Mild disease (on day {Person.LastDiseaseStatusCheckAt}). "); checkStatusLink = new Hyperlink(new Run("(ask again)")); break; case DiseaseStage.Severe: textBlock.Inlines.Add($"Severe disease (on day {Person.LastDiseaseStatusCheckAt}). "); checkStatusLink = new Hyperlink(new Run("(ask again)")); break; case DiseaseStage.Immune: textBlock.Inlines.Add("Immune.\n"); break; case DiseaseStage.Dead: textBlock.Inlines.Add("Dead.\n"); break; } } if (checkStatusLink != null) { textBlock.Inlines.Add(checkStatusLink); textBlock.Inlines.Add(new LineBreak()); checkStatusLink.Click += (sender, args) => { Person.CheckDiseaseStatus(); MainWindow.Instance.DocumentBrowser.Refresh(); }; } textBlock.Inlines.Add("Quarantine status: "); if (Person.Quarantined) { textBlock.Inlines.Add("Quarantined at home.\n"); } else { textBlock.Inlines.Add("Free. "); Hyperlink quarantineLink = new Hyperlink(new Run("(quarantine)")); textBlock.Inlines.Add(quarantineLink); textBlock.Inlines.Add(new LineBreak()); quarantineLink.Click += (sender, args) => { Person.Quarantine(); MainWindow.Instance.DocumentBrowser.Refresh(); }; } if (Person.LastTracedAt == -1) { textBlock.Inlines.Add("Contract tracing not done yet. "); Hyperlink traceLink = new Hyperlink(new Run("(trace)")); textBlock.Inlines.Add(traceLink); traceLink.Click += (sender, args) => { Person.Trace(); MainWindow.Instance.DocumentBrowser.Refresh(); }; } else { textBlock.Inlines.Add("Contracts traced on day " + Person.LastTracedAt + ": "); Hyperlink retraceLink = new Hyperlink(new Run("(retrace)")); textBlock.Inlines.Add(retraceLink); textBlock.Inlines.Add(new LineBreak()); retraceLink.Click += (sender, args) => { Person.Trace(); MainWindow.Instance.DocumentBrowser.Refresh(); }; textBlock.Inlines.Add(Person.Name + " lives with their family in " + Person.Residence.Name + ". The family consists of "); CaseRenderer.RenderCases(textBlock.Inlines, Person.Residence.Family.Where(ppl => ppl != Person).ToList()); textBlock.Inlines.Add(".\n\n"); if (Person.AgeCategory == AgeCategory.Child) { textBlock.Inlines.Add("This is a child."); } else { textBlock.Inlines.Add(Person.Name + " works at " + Person.Workplace.Name + ", where they met:\n"); foreach (Day day in Person.History.Take(Person.LastTracedAt).Reverse <Day>().Take(10)) { textBlock.Inlines.Add(" Day " + day.Date + ": "); CaseRenderer.RenderCases(textBlock.Inlines, day.Contacts.Where(cc => cc.WhereTheyMet is Workplace).Select(c => c.TargetContact).ToList()); textBlock.Inlines.Add(new LineBreak()); } } } }