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


C# Request.Respond方法代码示例

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


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

示例1: HandleAsk

		Consumer<Request<Ask>> HandleAsk(Request<Ask> x)
		{
			if (x.Body.AuctionId != Id)
				return null;

			return message =>
				{
					if (_ended)
					{
						x.Respond(new Ended
							{
								AuctionId = Id,
								HighBid = _currentBid,
							});
						return;
					}

					Guid token = CombGuid.Generate();

					x.Respond(new Status
						{
							CurrentBid = _currentBid,
							AuctionId = Id,
							Token = token,
						});

					_inbox.Receive<Request<Buy>>(buy =>
						{
							if (buy.Body.Token != token)
								return null;

							return buyMessage =>
								{
									buyMessage.Respond(new Purchased
										{
											AuctionId = Id,
											Token = token,
											Price = _currentBid,
											Quantity = buy.Body.Quantity,
										});
								};

						}, 1.Seconds(),
						() =>
							{
								// nothing to do on timeout
							});
				};
		}
开发者ID:Nangal,项目名称:Stact,代码行数:49,代码来源:Auction.cs

示例2: HandleStop

 public void HandleStop(Request<Stop> request)
 {
     IEnumerator<ActorRef> next = _inbox.LinkedActors.GetEnumerator();
     if (next.MoveNext())
     {
         AnonymousActor.New(x => x.Loop(loop =>
             {
                 next.Current.Request<Stop>(x)
                     .Receive<Response<Stop>>(response =>
                         {
                             if (next.MoveNext())
                                 loop.Continue();
                             else
                                 request.Respond();
                         });
             }));
     }
 }
开发者ID:Nangal,项目名称:Stact,代码行数:18,代码来源:SupervisorActor.cs

示例3: Cancel

			public void Cancel(Request<Cancel> request)
			{
				request.Respond(new CancelledImpl());
			}
开发者ID:scptre,项目名称:Stact,代码行数:4,代码来源:StateMachineActor_Specs.cs

示例4: SendQuoteRequest

			public void SendQuoteRequest(Request<GetQuote> request)
			{
				Trace.WriteLine("Symbol: " + request.Body.Symbol);
				Symbol = request.Body.Symbol;
				request.Respond(new RequestSent());
			}
开发者ID:scptre,项目名称:Stact,代码行数:6,代码来源:StateMachineActor_Specs.cs

示例5: MyRequestHandler

 void MyRequestHandler(Request<MyRequest> message)
 {
     message.Respond(new MyResponse());
 }
开发者ID:rickj33,项目名称:Stact,代码行数:4,代码来源:CleanUsing_Specs.cs

示例6: HandleBid

		public void HandleBid(Request<Bid> request)
		{
		    request.Respond(request.Body);
		}
开发者ID:Nangal,项目名称:Stact,代码行数:4,代码来源:Auction.cs

示例7: IssueRequest

 private void IssueRequest(Request req)
 {
     var chan = Channels[req.Channel];
     var bank = chan.Banks[req.Bank];
     var state = ConflictState(req);
     long reqDelay = 0;
     chan.NextRequest = After(tCCD);
     if (state != RequestConflictState.Hit)
     {
         if (state == RequestConflictState.Conflict)
         {
             reqDelay += tRP;
         }
         bank.NextConflict = After(reqDelay + tRAS);
         reqDelay += tRCD;
         bank.OpenRow = req.Row;
     }
     reqDelay += tCCD;
     bank.NextRequest = After(reqDelay);
     req.Respond(After(reqDelay + tCL));
 }
开发者ID:nixprime,项目名称:nijikawa,代码行数:21,代码来源:Dram.cs


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