Ejemplo n.º 1
0
        public IDictionary <object, object> ExecuteMacro(string uid)
        {
            if (uid == null)
            {
                throw new ArgumentNullException(nameof(uid));
            }

            MacroInstance macroInstance;

            lock (_macros)
            {
                if (!_macros.TryGetValue(uid, out macroInstance))
                {
                    return(new Dictionary <object, object>
                    {
                        ["type"] = WirehomeMessageType.ParameterInvalidException
                    });
                }
            }

            var result = macroInstance.TryExecute();

            _messageBusWrapper.PublishMacroExecutedBusMessage(uid, result);
            return(result);
        }
Ejemplo n.º 2
0
        public WirehomeDictionary ExecuteMacro(string uid)
        {
            if (uid == null)
            {
                throw new ArgumentNullException(nameof(uid));
            }

            MacroInstance macroInstance;

            lock (_macros)
            {
                if (!_macros.TryGetValue(uid, out macroInstance))
                {
                    return(new WirehomeDictionary().WithType(ControlType.ParameterInvalidException));
                }
            }

            var result = macroInstance.TryExecute();

            _messageBusWrapper.PublishMacroExecutedBusMessage(uid, result);
            return(result);
        }