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


C# AsyncDelegate类代码示例

本文整理汇总了C#中AsyncDelegate的典型用法代码示例。如果您正苦于以下问题:C# AsyncDelegate类的具体用法?C# AsyncDelegate怎么用?C# AsyncDelegate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AsyncDelegate类属于命名空间,在下文中一共展示了AsyncDelegate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: BeginInvoke

 public void BeginInvoke(AsyncDelegate del)
 {
     ControllerMainAction mainAction = new SimpleDefaultMainAction(this, del);
     try
     {
         if (!View.IsHandleCreated)
         {
             return;
         }
         View.BeginInvoke(new AsyncDelegate(mainAction.run), null);
     }
     catch (ObjectDisposedException)
     {
         //happens because there is no synchronization between the lifecycle of a form and callbacks of background threads.
         //catch silently
     }
 }
开发者ID:kaduardo,项目名称:cyberduck,代码行数:17,代码来源:AsyncController.cs

示例3: 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

示例4: 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

示例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: Invoke

 public void Invoke(AsyncDelegate del)
 {
     Invoke(del, false);
 }
开发者ID:kaduardo,项目名称:cyberduck,代码行数:4,代码来源:AsyncController.cs

示例7: Read

 private void Read()
 {
     AsyncDelegate read = new AsyncDelegate(ReadAsync);
     BeginInvoke(read);
 }
开发者ID:samfcmc,项目名称:padint,代码行数:5,代码来源:MainForm.cs

示例8: BeginInvoke

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

示例9: Fail

 private void Fail()
 {
     AsyncDelegate fail = new AsyncDelegate(FailAsync);
     BeginInvoke(fail);
 }
开发者ID:samfcmc,项目名称:padint,代码行数:5,代码来源:MainForm.cs

示例10: Freeze

 private void Freeze()
 {
     AsyncDelegate freezeDelegate = new AsyncDelegate(FreezeAsync);
     BeginInvoke(freezeDelegate);
 }
开发者ID:samfcmc,项目名称:padint,代码行数:5,代码来源:MainForm.cs

示例11: Create

 private void Create()
 {
     AsyncDelegate create = new AsyncDelegate(CreateAsync);
     BeginInvoke(create);
 }
开发者ID:samfcmc,项目名称:padint,代码行数:5,代码来源:MainForm.cs

示例12: Connect

 private void Connect()
 {
     AsyncDelegate connect = new AsyncDelegate(ConnectAsync);
     BeginInvoke(connect);
 }
开发者ID:samfcmc,项目名称:padint,代码行数:5,代码来源:MainForm.cs

示例13: Commit

 private void Commit()
 {
     AsyncDelegate commit = new AsyncDelegate(CommitAsync);
     BeginInvoke(commit);
 }
开发者ID:samfcmc,项目名称:padint,代码行数:5,代码来源:MainForm.cs

示例14: 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)
		{
			AsyncDelegate del = new AsyncDelegate(AsyncExecuteWrapper);
			asyncResult = del.BeginInvoke(2, CommandBehavior.Default, 
				callback, stateObject);
			return asyncResult;
		}
开发者ID:epdumitru,项目名称:mysqlib,代码行数:21,代码来源:command.cs

示例15: Recover

 private void Recover()
 {
     AsyncDelegate recover = new AsyncDelegate(RecoverAsync);
     BeginInvoke(recover);
 }
开发者ID:samfcmc,项目名称:padint,代码行数:5,代码来源:MainForm.cs


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