Ejemplo n.º 1
0
        public async Task <Unit> Handle(OpenSwitchCommand request, CancellationToken cancellationToken)
        {
            Logger.LogInformation($"[SwitchCommandHandler::TurnOffSwitchCommand] Sending {request.Command.ToString()} command to {request.Gid}");

            CeContracts.ISwitchStatusCommandingContract switchStatusCommandingClient = SwitchStatusCommandingClient.CreateClient();
            try
            {
                await switchStatusCommandingClient.SendOpenCommand(request.Gid);
            }
            catch (Exception ex)
            {
                Logger.LogError("[SwitchCommandHandler::TurnOffSwitchCommand] SwitchCommandHandler failed on TurnOffSwitch handler.", ex);
                throw;
            }

            //return null;
            return(new Unit());
        }
Ejemplo n.º 2
0
        public async Task <Unit> Handle(CloseSwitchCommand request, CancellationToken cancellationToken)
        {
            Logger.LogDebug($"[SwitchCommandHandler::TurnOnSwitchCommand] Sending {request.Command.ToString()} command to {request.Gid}");

            CeContracts.ISwitchStatusCommandingContract switchStatusCommandingClient = SwitchStatusCommandingClient.CreateClient();

            try
            {
                //commandingProxy.SendSwitchCommand(request.Gid, (int)request.Command);
                await switchStatusCommandingClient.SendCloseCommand(request.Gid);
            }
            catch (Exception ex)
            {
                Logger.LogError("[SwitchCommandHandler::TurnOnSwitchCommand] Failed on TurnOnSwitch handler.", ex);
                throw;
            }

            //return null;
            return(new Unit());
        }