Esempio n. 1
0
 public DoorsViewModel(IMessageReaderService messageReaderService, IMessageWriterService messageWriterService, IDoorViewCreationService doorViewCreationService)
 {
     _uiThread                = Thread.CurrentThread;
     _messageWriterService    = messageWriterService;
     _doorViewCreationService = doorViewCreationService;
     messageReaderService.SetTheRoutingKey(RoutingKeys.DoorInformationRoutingKey);
     messageReaderService.DoorInformationMessageReceived += OnInformationMessageReceived;
     messageReaderService.Listen();
 }
        public void SetDoorModel(IDoor door)
        {
            Updating();
            DoorId    = $"{door.Id}";
            DoorLabel = door.Label;
            State     = door.State;
            FinishedUpdating();

            var routingKey = $"{RoutingKeys.SpecificDoorRoutingKey}{door.Id}";

            _messageWriterService.SetTheRoutingKey(routingKey);
            _messageReaderService.SetTheRoutingKey(routingKey);
            _messageReaderService.DoorControlMessageReceived += OnControlMessageReceived;
            _messageReaderService.Listen();
        }