Esempio n. 1
0
        /// <summary>
        /// Determines whether the specified result, as an object, inherits from <see cref="PropertyInspectorPayload"/> so that the event name can be set.
        /// </summary>
        /// <param name="result">The result.</param>
        /// <param name="methodInfo">The property inspector method information.</param>
        /// <param name="requestId">The request identifier from the original request.</param>
        /// <returns>The result to be sent to the property inspector.</returns>
        private object TryGetResultWithContext(object result, PropertyInspectorMethodInfo methodInfo, string requestId)
        {
            // attempt to update the event name when the result is a payload
            if (result is PropertyInspectorPayload payload)
            {
                payload.Event     = methodInfo.SendToPropertyInspectorEvent;
                payload.RequestId = requestId;
                return(payload);
            }

            return(result);
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyInspectorMethodCollection"/> class.
 /// </summary>
 /// <param name="type">The <see cref="StreamDeckAction"/> type.</param>
 public PropertyInspectorMethodCollection(Type type)
 {
     // add all methods that are decorated with the attribute
     foreach (var methodInfo in type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
     {
         var attr = methodInfo.GetCustomAttribute <PropertyInspectorMethodAttribute>();
         if (attr != null)
         {
             var piMethodInfo = new PropertyInspectorMethodInfo(methodInfo, attr);
             this.Methods.Add(piMethodInfo.SendToPluginEvent, piMethodInfo);
         }
     }
 }