Beispiel #1
0
        /// <summary>
        /// Gets an array of control parameters for a node, ordered by parameter name.
        /// </summary>
        /// <param name="Node">Optional null reference. If not behind a concentrator, use null.</param>
        /// <returns>Control parameters by parameter name.</returns>
        public async Task <Dictionary <string, ControlParameter> > GetControlParametersByName(IThingReference Node)
        {
            GetControlParametersEventHandler h = this.OnGetControlParameters;

            if (h is null)
            {
                return(this.controlParametersByName);
            }
            else
            {
                ControlParameter[] Parameters = await h(Node);

                if (Parameters is null)
                {
                    return(null);
                }

                Dictionary <string, ControlParameter> Result = new Dictionary <string, ControlParameter>();

                foreach (ControlParameter P in Parameters)
                {
                    Result[P.Name] = P;
                }

                return(Result);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Gets an array of control parameters for a node.
        /// </summary>
        /// <param name="Node">Optional null reference. If not behind a concentrator, use null.</param>
        /// <returns>Control parameters.</returns>
        public Task <ControlParameter[]> GetControlParameters(IThingReference Node)
        {
            GetControlParametersEventHandler h = this.OnGetControlParameters;

            if (h is null)
            {
                return(Task.FromResult <ControlParameter[]>(this.controlParameters));
            }
            else
            {
                return(h(Node));
            }
        }