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


C# AsyncDelegate.BeginInvoke方法代码示例

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


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

示例1: DoExecuteMessageRequest

        /// <summary>
        /// 同步模式:处理
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public override object DoExecuteMessageRequest(string serviceName, WQMessage msg, bool async)
        {
            //1. 保存DB,返回msg.TranscactionID
            //2. 异步调用同步方法
            //3. 开启守护线程修补失败的
            Log.Write(LogAction.Info, className, "DoExecuteMessageRequest", serviceName, -1, string.Format(startFormat, serviceName, msg.TransactionID));
            Routing routing = Routing(serviceName, msg);
            if (null == routing || routing.EmptyHandlerName.Length > 0)
            {
                return EmptyRouting(serviceName, msg, async);
            }
            int rtn = -1;
            msg.ServiceName = serviceName;
            long pidx = routing.ParentGroupIndex;
            long idx = routing.GroupIndex;
            rtn = MessageDao.Save(serviceName, msg, (int)DealStatus.Dealing, pidx, idx);
            Log.Write(LogAction.Info, className, "DoExecuteMessageRequest", serviceName, -1, msg.TransactionID + ",保存消息返回值:" + rtn);
            if (rtn > 0)
            {
                AsyncDelegate ad = new AsyncDelegate(AsyncExecute);
                ad.BeginInvoke(serviceName, pidx, idx, msg, null, null);
            }
            return (rtn > 0);

        }
开发者ID:kcitwm,项目名称:dova,代码行数:30,代码来源:AsyncRoutingHandler.cs

示例2: BeginExecuteNonQuery

    /// <summary>
    /// Initiates the asynchronous execution of the SQL statement or stored procedure 
    /// that is described by this <see cref="MySqlCommand"/>. 
    /// </summary>
    /// <returns>An <see cref="IAsyncResult"/> that can be used to poll or wait for results, 
    /// or both; this value is also needed when invoking <see cref="EndExecuteNonQuery"/>, 
    /// which returns the number of affected rows. </returns>
    public IAsyncResult BeginExecuteNonQuery()
    {
      if (caller != null)
        Throw(new MySqlException(Resources.UnableToStartSecondAsyncOp));

      caller = new AsyncDelegate(AsyncExecuteWrapper);
      asyncResult = caller.BeginInvoke(2, CommandBehavior.Default, null, null);
      return asyncResult;
    }
开发者ID:Nicholi,项目名称:mysql-connector-net,代码行数:16,代码来源:command.cs

示例3: BeginExecuteReader

    /// <summary>
    /// Initiates the asynchronous execution of the SQL statement or stored procedure 
    /// that is described by this <see cref="MySqlCommand"/> using one of the 
    /// <b>CommandBehavior</b> values. 
    /// </summary>
    /// <param name="behavior">One of the <see cref="CommandBehavior"/> values, indicating 
    /// options for statement execution and data retrieval.</param>
    /// <returns>An <see cref="IAsyncResult"/> that can be used to poll, wait for results, 
    /// or both; this value is also needed when invoking EndExecuteReader, 
    /// which returns a <see cref="MySqlDataReader"/> instance that can be used to retrieve 
    /// the returned rows. </returns>
    public IAsyncResult BeginExecuteReader(CommandBehavior behavior)
    {
      if (caller != null)
        Throw(new MySqlException(Resources.UnableToStartSecondAsyncOp));

      caller = new AsyncDelegate(AsyncExecuteWrapper);
      asyncResult = caller.BeginInvoke(1, behavior, null, null);
      return asyncResult;
    }
开发者ID:Nicholi,项目名称:mysql-connector-net,代码行数:20,代码来源:command.cs

示例4: BeginExecuteNonQuery

        /// <summary>
        /// Initiates the asynchronous execution of the SQL statement or stored procedure
        /// that is described by this <see cref="MySqlCommand"/>.
        /// </summary>
        /// <param name="callback">
        /// An <see cref="AsyncCallback"/> delegate that is invoked when the command's
        /// execution has completed. Pass a null reference (<b>Nothing</b> in Visual Basic)
        /// to indicate that no callback is required.</param>
        /// <param name="stateObject">A user-defined state object that is passed to the
        /// callback procedure. Retrieve this object from within the callback procedure
        /// using the <see cref="IAsyncResult.AsyncState"/> property.</param>
        /// <returns>An <see cref="IAsyncResult"/> that can be used to poll or wait for results,
        /// or both; this value is also needed when invoking <see cref="EndExecuteNonQuery"/>,
        /// which returns the number of affected rows. </returns>
        public IAsyncResult BeginExecuteNonQuery(AsyncCallback callback, object stateObject)
        {
            if (caller != null)
                throw new MySqlException("ResourceStrings.UnableToStartSecondAsyncOp");

            caller = new AsyncDelegate(AsyncExecuteWrapper);
            asyncResult = caller.BeginInvoke(2, CommandBehavior.Default,
                callback, stateObject);
            return asyncResult;
        }
开发者ID:yalunwang,项目名称:DotnetSpider,代码行数:24,代码来源:command.cs

示例5: Write

 public static void Write(LogEvent log)
 {
     try
     {
         AsyncDelegate ad = new AsyncDelegate(write);
         ad.BeginInvoke(log, new AsyncCallback(CallbackMethod), ad);
     }
     catch { }
 }
开发者ID:BachelorEric,项目名称:ModelFirst,代码行数:9,代码来源:Log.cs

示例6: OpenAttachmentAsync

        public static void OpenAttachmentAsync(Control Ctrl, int AttachmentID, int ConnectionID)
        {
            Ctrl.UseWaitCursor = true;

            // Create the delegate.
            AsyncDelegate dlgt = new AsyncDelegate(Utils.OpenAttachment);

            // Initiate the asychronous call.  Include an AsyncCallback
            // delegate representing the callback method, and the data
            // needed to call EndInvoke.
            IAsyncResult ar = dlgt.BeginInvoke(Ctrl, AttachmentID, ConnectionID, new AsyncCallback(CallbackMethod), dlgt);
        }
开发者ID:clarencemorse,项目名称:myzilla,代码行数:12,代码来源:Utils.cs

示例7: BeginInvoke

 protected void BeginInvoke(AsyncDelegate del)
 {
     del.BeginInvoke(EndInvoke, del);
 }
开发者ID:wrobeseb,项目名称:parRobot,代码行数:4,代码来源:AbstractController.cs

示例8: BeginExecuteNonQuery

		/// <summary>
		/// Initiates the asynchronous execution of the SQL statement or stored procedure 
		/// that is described by this <see cref="MySqlCommand"/>. 
		/// </summary>
		/// <returns>An <see cref="IAsyncResult"/> that can be used to poll or wait for results, 
		/// or both; this value is also needed when invoking <see cref="EndExecuteNonQuery"/>, 
		/// which returns the number of affected rows. </returns>
		public IAsyncResult BeginExecuteNonQuery()
		{
			AsyncDelegate del = new AsyncDelegate(AsyncExecuteWrapper);
			asyncResult = del.BeginInvoke(2, CommandBehavior.Default, null, null);
			return asyncResult;
		}
开发者ID:epdumitru,项目名称:mysqlib,代码行数:13,代码来源:command.cs

示例9: BeginExecuteReader

		/// <summary>
		/// Initiates the asynchronous execution of the SQL statement or stored procedure 
		/// that is described by this <see cref="MySqlCommand"/> using one of the 
		/// <b>CommandBehavior</b> values. 
		/// </summary>
		/// <param name="behavior">One of the <see cref="CommandBehavior"/> values, indicating 
		/// options for statement execution and data retrieval.</param>
		/// <returns>An <see cref="IAsyncResult"/> that can be used to poll, wait for results, 
		/// or both; this value is also needed when invoking EndExecuteReader, 
		/// which returns a <see cref="MySqlDataReader"/> instance that can be used to retrieve 
		/// the returned rows. </returns>
		public IAsyncResult BeginExecuteReader(CommandBehavior behavior)
		{
			AsyncDelegate del = new AsyncDelegate(AsyncExecuteWrapper);
			asyncResult = del.BeginInvoke(1, behavior, null, null);
			return asyncResult;
		}
开发者ID:epdumitru,项目名称:mysqlib,代码行数:17,代码来源:command.cs

示例10: BeginInvoke

 protected void BeginInvoke(AsyncDelegate del)
 {
     // thread the delegate, as a fire and forget.
     del.BeginInvoke(EndAsync, del);
 }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:5,代码来源:AsyncController.cs


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