当前位置: 首页>>代码示例>>C#>>正文


C# PhpCallback.Bind方法代码示例

本文整理汇总了C#中PHP.Core.PhpCallback.Bind方法的典型用法代码示例。如果您正苦于以下问题:C# PhpCallback.Bind方法的具体用法?C# PhpCallback.Bind怎么用?C# PhpCallback.Bind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHP.Core.PhpCallback的用法示例。


在下文中一共展示了PhpCallback.Bind方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateClrThread

		public static bool CreateClrThread(ScriptContext/*!*/context, PhpCallback/*!*/ callback, params object[] args)
		{
			if (callback == null)
				PhpException.ArgumentNull("callback");

			if (!callback.Bind())
				return false;

			object[] copies = (args != null) ? new object[args.Length] : ArrayUtils.EmptyObjects;

			for (int i = 0; i < copies.Length; i++)
				copies[i] = PhpVariable.DeepCopy(args[i]);

            return ThreadPool.QueueUserWorkItem(new Worker(context, copies).Run, callback);
		}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:15,代码来源:CLR.cs

示例2: InvokeFunctionCore

		private object InvokeFunctionCore(string name, params object[] args)
		{
			// check whether this function is allowed to be called
			PhpCallback callback;
			if (allFunctionsRegistered)
			{
				registeredFunctions.TryGetValue(name, out callback);
			}
			else
			{
				if (registeredFunctions.TryGetValue(name, out callback))
				{
					PhpException.Throw(PhpError.Warning, String.Format(Resources.HandlerNotAllowed, name));
					return null;
				}
			}

			// if the callback does not already exists, create it
			if (callback == null)
			{
				// parse name
				int index = name.IndexOf("::");
				switch (index)
				{
					case -1: callback = new PhpCallback(name); break;
					case 0: callback = new PhpCallback(name.Substring(2)); break;
					default: callback = new PhpCallback(name.Substring(0, index), name.Substring(index + 2)); break;
				}

				if (!callback.Bind()) return null;

				registeredFunctions[name] = callback;
			}

			// convert arguments
			for (int i = 0; i < args.Length; i++) args[i] = XsltConvertor.DotNetToPhp(args[i]);

			// invoke!
			return callback.Invoke(args);
		}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:40,代码来源:XsltProcessor.cs

示例3: Start

		public static bool Start(PhpCallback filter, int chunkSize, bool erase)
		{
			if (chunkSize != 0)
				PhpException.ArgumentValueNotSupported("chunkSize", "!= 0");
			if (!erase)
				PhpException.ArgumentValueNotSupported("erase", erase);

			ScriptContext context = ScriptContext.CurrentContext;

			context.BufferedOutput.IncreaseLevel();

			bool result = true;

			// skips filter setting if filter is not specified or valid:
			if (filter != null && (result = filter.Bind()))
				context.BufferedOutput.SetFilter(filter);

			context.IsOutputBuffered = true;
			return result;
		}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:20,代码来源:Output.CLR.cs

示例4: Register

        public static bool Register(NamingContext namingContext, DTypeDesc caller, PhpCallback autoloadFunction, bool throwError, bool prepend)
        {
            if (autoloadFunction == null)
            {
                PhpException.ArgumentNull("autoloadFunction");
                return false;
            }

            if (autoloadFunction.Bind(!throwError, caller, namingContext))
            {
                var context = ScriptContext.CurrentContext;
                if (FindAutoloadFunction(context, autoloadFunction.ToPhpRepresentation()) != null)
                    return false;
                
                if (prepend)
                    context.SplAutoloadFunctions.AddFirst(autoloadFunction);
                else
                    context.SplAutoloadFunctions.AddLast(autoloadFunction);

                return true;
            }
            else
            {
                return false;
            }
        }
开发者ID:dw4dev,项目名称:Phalanger,代码行数:26,代码来源:Autoload.cs

示例5: CheckCallbackDirect

        ///// <summary>
        ///// Invoked from <c>ExtManager</c> in order to call a (user or system) function. See <c>call_user_function</c>,
        ///// <c>call_user_function_ex</c>, <c>zend_call_function</c> Zend API.
        ///// </summary>
        ///// <param name="target">Designation of the function/method to call.</param>
        ///// <param name="args">Arguments to be passed to the function.</param>
        ///// <returns>Return value of the function.</returns>
        ///// <remarks>
        ///// <p>
        ///// Obsolete: The reason why self is <c>ref</c> is that we need Remoting to
        ///// serialize and transfer the new state of the instance back to the caller.
        ///// </p>
        ///// <p>
        ///// The state is not transferred at all for user-classes (that are usually used for callbacks).
        ///// </p>
        ///// </remarks>
        //public object CallFunction(PhpCallback target, ref object[] args)
        //{
        //    this.callbackTarget = target;
        //    this.callbackArgs = args;

        //    callbackInvoked.Set();
        //    callbackHandled.WaitOne();

        //    return this.callbackRetValue;
        //}

		/// <summary>
		/// Checks whether the function/method designated by <paramref name="callback"/> is callable.
		/// </summary>
		/// <param name="callback">The callback.</param>
		/// <returns><B>true</B> if the <paramref name="callback"/> is callable, <B>false</B> otherwise.
		/// </returns>
		public static bool CheckCallbackDirect(PhpCallback callback)
		{
			return callback.Bind(true);
		}
开发者ID:kripper,项目名称:Phalanger,代码行数:37,代码来源:Externals.CLR.cs


注:本文中的PHP.Core.PhpCallback.Bind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。