Пример #1
0
 protected virtual void OnSent(SentEventArgs args)
 {
     if (this.Sent != null)
     {
         this.Sent(this, args);
     }
 }
Пример #2
0
 private void OnSent(object sender, SentEventArgs e)
 {
     if (!e.OperationSucceeded)
     {
         Connection conn = e.GetConnection();
         RemoveConnection(conn);
     }
 }
Пример #3
0
		private void Sender_Sent(object sender, SentEventArgs e)
		{
			var token = (SendToken)e.AsyncState;
			int index = Interlocked.Increment(ref _totalCount);

			try
			{
				//同步锁定,以防止异步并发中导致显示信息错位
				Monitor.Enter(_syncRoot);

				token.Context.Output.Write(CommandOutletColor.DarkYellow, "[{0}] ", index);
				token.Context.Output.Write(CommandOutletColor.Green, ResourceUtility.GetString("${Text.Communication.SendCommand.SendSucceed}"), token.Message);
				token.Context.Output.WriteLine(CommandOutletColor.DarkGray, ResourceUtility.GetString("${Text.Communication.SendCommand.Channel}"), e.Channel.ChannelId, e.Channel.LastSendTime);
			}
			finally
			{
				//退出同步锁定
				Monitor.Exit(_syncRoot);

				//设置信号量为非堵塞
				token.WaitHandle.Set();
			}
		}
Пример #4
0
 /// <summary>
 /// Called after network sent data.
 /// </summary>
 /// <param name="sender">The sender instance.</param>
 /// <param name="ev">The <see cref="SentEventArgs"/> instance.</param>
 protected virtual void OnSent(object sender, SentEventArgs ev) => Sent?.Invoke(sender, ev);
Пример #5
0
 /// <inheritdoc cref="API.Network.OnSent(object, SentEventArgs)"/>
 public void OnSent(object _, SentEventArgs ev) => Log.Debug(string.Format(Language.SentData, ev.Data, ev.Length), Instance.Config.IsDebugEnabled);
Пример #6
0
 private void Channel_Sent(object sender, SentEventArgs e)
 {
     this.OnSent(e);
 }
Пример #7
0
		private void Channel_Sent(object sender, SentEventArgs e)
		{
			this.OnSent(e);
		}
Пример #8
0
		protected virtual void OnSent(SentEventArgs args)
		{
			if(this.Sent != null)
				this.Sent(this, args);
		}