Exemplo n.º 1
0
 /// <summary>
 /// Retrieves the photo.
 /// </summary>
 /// <param name="person">The person.</param>
 private static void RetrievePhoto(PersonBase person)
 {
     Observable.ToAsync(async () =>
     {
         await DIContainer.Instance.Resolve<PhotoService>().RetrievePersonPhoto(person);
         await ApplicationDispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() => person.NotifyPropertyChange(PhotoProperty)));
     })().Subscribe(r => { }, ex => { });
 }
        /// <summary>
        /// Function to handle boarding status change state.
        /// </summary>
        /// <param name="person">Instance of Person</param>
        /// <param name="boardingStatusChangeState">Boarding status change state information</param>
        private static void HandleBoardingStatusChange(PersonBase person, BoardingStatusChangeState boardingStatusChangeState)
        {
            AudibleAlertManager.PlayBell(person, boardingStatusChangeState);

            // Todo: remove following fix. This is for UI notification.
            person.IsOnboard = !person.IsOnboard;
            person.IsOnboard = !person.IsOnboard;

            person.NotifyPropertyChange(IsOnboardPropertyName);
            person.NotifyPropertyChange(LastEventPropertyName);
            person.NotifyPropertyChange(LastDateTimePropertyName);

            person.HasAlert = person.Alerts.Count > 0;
            person.NotifyPropertyChange(HasAlertProperty);
        }
        /// <summary>
        /// Function to notify UI.
        /// </summary>
        /// <param name="person">Instance of PersonBase</param>
        private void NotifyUI(PersonBase person)
        {
            // Todo: remove following fix.
            person.IsOnboard = !person.IsOnboard;
            person.IsOnboard = !person.IsOnboard;
            person.NotifyPropertyChange(IsOnboardPropertyName);

            if (this.CurrentParty == null)
            {
                this.CurrentParty = DIContainer.Instance.Resolve<PersonsPartyManager>().CurrentParty;
            }

            if (person.PersonType == PersonType.Guest)
            {
                var guest = this.currentParty.Guests.FirstOrDefault(g => g.GuestId.Equals(person.PersonId, StringComparison.OrdinalIgnoreCase));
                if (guest != null)
                {
                    // Todo: remove following fix.
                    guest.IsOnboard = !guest.IsOnboard;
                    guest.IsOnboard = !guest.IsOnboard;

                    guest.NotifyPropertyChange(IsOnboardPropertyName);
                }
            }
            else if (person.PersonType == PersonType.Crewmember)
            {
                var crewmember = this.currentParty.Crew.FirstOrDefault(c => c.CrewmemberId.Equals(person.PersonId, StringComparison.OrdinalIgnoreCase));

                if (crewmember != null)
                {
                    // Todo: remove following fix.
                    crewmember.IsOnboard = !crewmember.IsOnboard;
                    crewmember.IsOnboard = !crewmember.IsOnboard;

                    crewmember.NotifyPropertyChange(IsOnboardPropertyName);
                }
            }
            else if (person.PersonType == PersonType.Visitor)
            {
                var visitor = this.currentParty.Visitors.FirstOrDefault(v => v.VisitorId.Equals(person.PersonId, StringComparison.OrdinalIgnoreCase));

                if (visitor != null)
                {
                    // Todo: remove following fix.
                    visitor.IsOnboard = !visitor.IsOnboard;
                    visitor.IsOnboard = !visitor.IsOnboard;

                    visitor.NotifyPropertyChange(IsOnboardPropertyName);
                }
            }

            this.CurrentParty.SelectedPerson.NotifyPropertyChange(IsOnboardPropertyName);
            this.CurrentParty.NotifyPropertyChange(SelectedPersonPropertyName);
        }