Exemplo n.º 1
0
        public void Handle(FarmChangedEvent message)
        {
            FarmMillerDto dto = message.FarmMillerDto;

            IFarmMillerViewModel current = AvailableFarms.FirstOrDefault(x => x.FarmId == dto.FarmId);

            if (current == null)
            {
                m_Logger.Warn("[FarmChangedEvent] " +
                              "Could not find Farm '{0}' with Id '{1}' ".Inject(dto.FarmName,
                                                                                dto.FarmId) +
                              "in AvailableFarms and ignoring it!");

                return;
            }

            current.FarmType   = dto.FarmType;
            current.FarmName   = dto.FarmName;
            current.FieldsCode = dto.FieldsCode;
            current.Harvested  = dto.Harvested;
            current.MillerId   = dto.MillerId;
            current.MillerName = dto.MillerName;

            AvailableFarms.Refresh();
        }
Exemplo n.º 2
0
        public void Handle(FarmChangedEvent message)
        {
            FarmId     = message.FarmMillerDto.FarmId;
            FieldsCode = message.FarmMillerDto.FieldsCode;
            FarmName   = message.FarmMillerDto.FarmName;
            Harvested  = message.FarmMillerDto.Harvested;
            FarmType   = message.FarmMillerDto.FarmType;
            MillerId   = message.FarmMillerDto.MillerId;
            MillerName = message.FarmMillerDto.MillerName;

            SelectedMiller            = Millers.FirstOrDefault(x => x.Id == MillerId);
            SelectedAvailableFarmType = Enum.GetName(typeof(FarmType),
                                                     FarmType);

            NotifyOfPropertyChange("");
        }
Exemplo n.º 3
0
        private void PublishFarmChangedEvent(IFarm farm,
                                             IMiller miller)
        {
            var dto = new FarmMillerDto
            {
                FarmId     = farm.Id,
                FieldsCode = farm.FieldsCode,
                FarmName   = farm.Name,
                Harvested  = farm.Harvested,
                FarmType   = farm.FarmType,
                MillerId   = miller.Id,
                MillerName = miller.Name
            };

            var changed = new FarmChangedEvent
            {
                FarmMillerDto = dto
            };

            m_EventAggregator.PublishOnBackgroundThread(changed);
        }