/// <summary> /// Add new observation /// </summary> /// <param name="param"></param> public async void OnObservationAdd(object param) { await Task.Run(() => { try { ServiceObservationReference.Observation observation = (ServiceObservationReference.Observation)param; _observationBM.AddObservation(_idPatient, observation); DispatchService.Invoke(() => { IsAddView = false; InitializePatient(_idPatient); }); } catch (Exception e) { DispatchService.Invoke(() => ShowServerExceptionWindow(ErrorDescription.ADD_PATIENT_OBSERVATION)); } }); }
/// <summary> /// Add the observation and raises a popup if missing fields /// </summary> private void AddObservation() { if (Weight <= 0 || BloodPressure <= 0) { ShowServerExceptionWindow(ErrorDescription.MISSING_FIELDS); } else { ServiceObservationReference.Observation observation = new ServiceObservationReference.Observation() { BloodPressure = BloodPressure, Weight = Weight, Comment = Comment, Date = DateTime.Now, Pictures = PicturesCollection.Select(x => x.Content).ToArray(), Prescription = PrescriptionCollection.Select(x => x.Content).ToArray() }; Mediator.Notify("Observations_UC", observation); } }