private TaskPromise ExcuteCore() { TaskWrapper wrapper = null; MethodInfo action = this.Action; Object control = this.Controler.GetControlInst(); Object[] parms = this.Parms?.Select(k => k.Value).ToArray(); if (this.Action.ReturnType == null)//不存在返回类型的action { wrapper = this.GetNoneTaskPromise(action, control, parms); } else if (this.Action.ReturnType.IsGenericType && this.Action.ReturnType.GetGenericTypeDefinition() == typeof(Task <>))//存在返回类型为Task<T>的action { wrapper = this.GetGenericDefaultTaskPromise(action, control, parms); } else if (this.Action.ReturnType == typeof(Task))//存在返回类型为Task的action { wrapper = this.GetDefaultTaskPromise(action, control, parms); } else //存在一个正常的返回值的action { wrapper = this.GetResultTaskPromise(action, control, parms); } this.SetTaskPromiseToControl(control, wrapper.Result); //执行 wrapper.Action(); return(wrapper.Result); }