public Patient OpenPatient(PatientSummary patientSummary) { var local = this; var retVal = X.Instance.CurrentContext.GetValue(sc => { return(new Patient(local._client.OpenPatient(patientSummary._client))); }); return(retVal); }
private async Task ModeUpSelected(F.PatientSummary patientSummary) { //Load text correctly if (patientSummary != null) { patientId.Text = $"({patientSummary.Id}) {patientSummary.LastName}, {patientSummary.FirstName}"; if (patientSummary.Id != AppComThread.Instance.GetValue(sc => sc.Patient?.Id)) { //Close last patient await AppComThread.Instance.ExecuteAsync((sc) => { if (sc.Patient != null) { Debug.WriteLine($"Closing patient {sc.Patient.LastName}"); sc.ClosePatient(); } }); //Mode up selected (if patient exists) if (AppComThread.Instance.GetValue(sc => sc.SetPatient(patientSummary.Id))) { Courses.Clear(); var courseNames = AppComThread.Instance.GetValue(sc => { return(sc.Patient.Courses.Select(c => c.Id).ToList()); }); courseNames.ForEach(Courses.Add); SelectedCourse = Courses.FirstOrDefault(); OnPropertyChanged("Courses"); OnPropertyChanged("SelectedCourse"); OnPropertyChanged("Status"); } } } }