Ejemplo n.º 1
0
        /// <summary>
        /// Update PatientLists when the Practitioner changes
        /// </summary>
        /// <param name="subject"></param>
        /// <returns></returns>
        public async Task UpdateAsync(IObservableSubject subject)
        {
            IsLoading = true;
            if (_practitioner == null || (subject as Practitioner).Id != _practitioner.Id)
            {
                _practitioner = (Practitioner)subject;
                _patients     = await FhirService.GetPatientsOfPractitioner(_practitioner.Id);

                IsLoading = false;
            }
        }
Ejemplo n.º 2
0
        public void Update(IObservableSubject state)
        {
            if (state is CarVehicle car)
            {
                Console.WriteLine(GetType().Name + ": Car status > " + car.Status);
            }

            if (state is TrainSD40 train)
            {
                Console.WriteLine(GetType().Name + ": Train status > " + train.CurrentState);
            }
        }
Ejemplo n.º 3
0
 public void Update(IObservableSubject subject)
 {
     throw new NotImplementedException();
 }
 public MainObserver(MulticastObserver parent, IObservableSubject <T> subject)
 {
     this.parent  = parent;
     this.subject = subject;
 }
 public MulticastObserver(ISignalObserver <R> downstream, IObservableSubject <T> subject)
 {
     this.downstream   = downstream;
     this.mainObserver = new MainObserver(this, subject);
 }
 // 구독 해제.
 public void UnSubscribe(IObservableSubject s)
 {
     s.RemoveObserver(this);
 }
        // 구독 시작. 책에 적힌 방식. 생성과 동시에 옵저버 등록.

        /*
         * public WeatherDisplay(Subject s)
         * {
         *  s.RegisterObserver(this);
         * }
         */

        // 구독 시작. 직관성 있게 개선한 방식.
        public void Subscribe(IObservableSubject s)
        {
            s.RegisterObserver(this);
        }