示例#1
0
        ///// <summary>
        ///// 是否已经存在调用者对象
        ///// </summary>
        ///// <param name="InvokeObject"></param>
        ///// <returns></returns>
        //public bool HasInvokeObject(object InvokeObject)
        //{
        //    bool result = false;
        //    var f = this.contexts.Find(delegate(IActionContext ac) { return ac.GetInvokeObjectIndex(InvokeObject) > -1; });
        //    if (f != null)
        //    {
        //        result = true;
        //    }
        //    return result;
        //}
        /// <summary>
        ///
        /// </summary>
        /// <param name="ActionName"></param>
        /// <param name="Type"></param>
        /// <param name="InvokeObject"></param>
        /// <param name="InvokeProcessor"></param>
        /// <param name="Performer"></param>
        /// <returns></returns>
        public bool HasAction(string ActionName, ActionType Type, object InvokeObject, Delegate InvokeProcessor, ActionPerformer Performer = null)
        {
            IAction        newAction = new Action(InvokeObject, ActionName, Type, InvokeProcessor, Performer);
            IActionContext context   = this.MatcherContext(newAction);

            if (context == null)
            {
                return(false);
            }
            else
            {
                if (context.GetInvokeObjectIndex(InvokeObject) > -1)
                {
                    int account = context.GetActionCount(InvokeObject);
                    if (account > 0)
                    {
                        for (int i = 0; i < account; i++)
                        {
                            IAction tmpac = context[InvokeObject, i];
                            if (tmpac != null)
                            {
                                if (tmpac.ActionName == ActionName &&
                                    tmpac.InvokeProcessor == InvokeProcessor)
                                {
                                    return(true);
                                }
                            }
                        }
                    }
                }
                return(false);
                //context.
            }
        }