Пример #1
0
        public PulseEmitedDomainEvent(EchoLocation location, float radius,
                                      CruiseRadar source)
        {
            Pulse = new RadarPulse(source, location, radius);

            OnValidate();
        }
Пример #2
0
        /// <summary>
        /// Removes a handkerchief from the hard no list if it was in it.
        /// </summary>
        /// <param name="handkerchief"></param>
        /// <returns></returns>
        public IStatus <Avatar> StopFlaggingHandkerchiefAsHardNo
            (Handkerchief handkerchief)
        {
            var response = new Status <Avatar>();

            try
            {
                if (hardNoHandkerchiefs.Contains(handkerchief))
                {
                    hardNoHandkerchiefs.Remove(handkerchief);
                    AddDomainEvent(new AvatarRemovedHardNoHandkerchiefDomainEvent
                                       (this, handkerchief));

                    CruiseRadar.ReEvaluateClutter();
                }
                else
                {
                    response.AddError
                        ("specified handkerchief not found in hard no list.");
                }
            }
            catch (Exception ex)
            {
                response.AddException(ex);
            }

            return(AvatarValidationStatus(response));
        }
Пример #3
0
        public Avatar(Guid id, DateTimeOffset createdAt, Customer owner,
                      string handle, IEnumerable <Handkerchief> _handkerchiefs) : base
                (id, createdAt)
        {
            // Newly created avatars automatically start cruising.
            Customer      = owner;
            Handle        = handle;
            handkerchiefs = _handkerchiefs.ToHashSet();

            if (CruiseRadar == null)
            {
                CruiseRadar = new CruiseRadar(this, DefaultRadarRange);
            }

            if (cruises == null)
            {
                cruises = new HashSet <Cruise>();
            }

            if (photos == null)
            {
                photos = new HashSet <IPhoto>();
            }


            OnValidate();
        }
Пример #4
0
        public PulseEmitedDomainEvent(double lattitude, double longitude,
                                      float radius, CruiseRadar source)
        {
            var pulseLocation = new EchoLocation(lattitude, longitude);

            Pulse = new RadarPulse(source, pulseLocation, radius);

            OnValidate();
        }
Пример #5
0
        /// <summary>
        /// Adds a handkerchief to the Hard No list which will prevent this
        /// Avatar from seeing Avarats flagging with the specified handkerchief
        /// </summary>
        /// <param name="handkerchief">The valid handkerchief to be flaged</param>
        /// <returns></returns>
        public IStatus <Avatar> FlagHandkerchiefAsHardNo
            (Handkerchief handkerchief)
        {
            var response = new Status <Avatar>();

            try
            {
                hardNoHandkerchiefs.Add(handkerchief);
                AddDomainEvent(new AvatarAddedHardNoHandkerchiefDomainEvent
                                   (this, handkerchief));

                CruiseRadar.ReEvaluateContactsForClutter();
            }
            catch (Exception ex)
            {
                response.AddException(ex);
            }

            return(AvatarValidationStatus(response));
        }