コード例 #1
0
        public RegisteredTrigger GetRegisteredTrigger(string senderId, string triggerId)
        {
            RegisteredTriggerSenders registeredSenderTriggers = RegisteredTriggerSenders.Find(x => x.SenderId.Equals(senderId));

            if (registeredSenderTriggers == null)
            {
                return(null);
            }
            RegisteredTrigger registeredTrigger = registeredSenderTriggers.RegisteredTriggers.Find(x => x.TriggerId.Equals(triggerId));

            return(registeredTrigger);
        }
コード例 #2
0
        public static void Trigger(string senderId, string triggerId)
        {
            Configs           configs           = ConfigsTools.GetConfigs <Configs>();
            RegisteredTrigger registeredTrigger = configs.GetRegisteredTrigger(senderId, triggerId);

            if (registeredTrigger != null)
            {
                foreach (RegisteredTriggerAction action in registeredTrigger.Actions)
                {
                    Type       theType     = System.Reflection.Assembly.GetExecutingAssembly().GetType("NotifyToAction." + action.TypeName);
                    var        theInstance = Activator.CreateInstance(theType);
                    MethodInfo theMethod   = theType.GetMethod(action.MethodName);
                    if (action.MethodParameters == null)
                    {
                        theMethod.Invoke(theInstance, null);
                    }
                    else
                    {
                        theMethod.Invoke(theInstance, action.MethodParameters.ToArray());
                    }
                }
            }
        }