public void ProcessEvent(EventWrittenEventArgs e) { switch (_eventPairTimerConnections.TryGetDuration(e, out var duration1)) { case DurationResult.Start: ConnectionStart?.Invoke(Events.ConnectionStartEvent.Instance); break; case DurationResult.FinalWithDuration: ConnectionStop?.InvokeManyTimes(_samplingRate.SampleEvery, Events.ConnectionStopEvent.GetFrom(duration1)); break; default: break; } switch (_eventPairTimerRequests.TryGetDuration(e, out var duration2)) { case DurationResult.Start: ConnectionStart?.Invoke(Events.ConnectionStartEvent.Instance); break; case DurationResult.FinalWithDuration: ConnectionStop?.InvokeManyTimes(_samplingRate.SampleEvery, Events.ConnectionStopEvent.GetFrom(duration2)); break; default: break; } if (e.EventId == EventIdConnectionStart) { ConnectionStart?.Invoke(Events.ConnectionStartEvent.ParseFrom(e)); return; } if (e.EventId == EventIdConnectionStop) { ConnectionStop?.Invoke(Events.ConnectionStopEvent.ParseFrom(e)); return; } if (e.EventId == EventIdRequestStart) { RequestStart?.Invoke(Events.RequestStartEvent.ParseFrom(e)); return; } if (e.EventId == EventIdRequestStop) { RequestStop?.Invoke(Events.RequestStopEvent.ParseFrom(e)); return; } if (e.EventId == EventIdConnectionRejected) { ConnectionRejected?.Invoke(Events.ConnectionRejectedEvent.ParseFrom(e)); return; } }
//Solicitud de detener el componente internal void Stop(RequestStop req) { Builder.Output("Deteniendo DbHandler."); StopComponent(); Builder.Output("DbHandler detenido."); MessageBus.Send(new ReplyStop()); }
internal RequestStopEvent(int stationIndex, int maxCars, bool fullSpeed, RequestStop onTime, RequestStop early, RequestStop late) { this.FullSpeed = fullSpeed; this.OnTime = onTime; this.StationIndex = stationIndex; this.Early = early; this.Late = late; this.MaxCars = maxCars; }
public RequestStopEvent(CurrentRoute CurrentRoute, int StationIndex, int MaxCars, bool FullSpeed, RequestStop OnTime, RequestStop Early, RequestStop Late) { currentRoute = CurrentRoute; fullSpeed = FullSpeed; onTime = OnTime; stationIndex = StationIndex; early = Early; late = Late; maxCars = MaxCars; }
/// <summary> /// Call to request stop. /// </summary> public void RequestStop() { try { var r = new RequestStop(); airTrafficController.aqmRequestProcess(r); SetOutput("Stopped"); } catch (AirTrafficControlException aex) { HandleAirTrafficControlException(aex); } UpdateAircraftQueue(); }
/// <inheritdoc/> public override void RequestStop(RequestStop stopRequest) { if (stopRequest.MaxCars != 0 && NumberOfCars > stopRequest.MaxCars) { //Check whether our train length is valid for this before doing anything else Program.Sounds.PlayCarSound(Cars[DriverCar].Sounds.RequestStop[2], 1.0, 1.0, Cars[DriverCar], false); return; } if (Program.RandomNumberGenerator.Next(0, 100) <= stopRequest.Probability) { //We have hit our probability roll if (Program.CurrentRoute.Stations[stopRequest.StationIndex].StopMode == StationStopMode.AllRequestStop || (IsPlayerTrain && Program.CurrentRoute.Stations[stopRequest.StationIndex].StopMode == StationStopMode.PlayerRequestStop)) { //If our train can stop at this station, set it's index accordingly Station = stopRequest.StationIndex; NextStopSkipped = StopSkipMode.None; //Play sound Program.Sounds.PlayCarSound(Cars[DriverCar].Sounds.RequestStop[0], 1.0, 1.0, Cars[DriverCar], false); } else { //We don't meet the conditions for this request stop if (stopRequest.FullSpeed) { //Pass at linespeed, rather than braking as if for stop NextStopSkipped = StopSkipMode.Linespeed; } else { NextStopSkipped = StopSkipMode.Decelerate; } //Play sound Program.Sounds.PlayCarSound(Cars[DriverCar].Sounds.RequestStop[1], 1.0, 1.0, Cars[DriverCar], false); //If message is not empty, add it if (!string.IsNullOrEmpty(stopRequest.PassMessage) && IsPlayerTrain) { MessageManager.AddMessage(stopRequest.PassMessage, MessageDependency.None, GameMode.Normal, MessageColor.White, Program.CurrentRoute.SecondsSinceMidnight + 10.0, null); } return; } //Play sound Program.Sounds.PlayCarSound(Cars[DriverCar].Sounds.RequestStop[0], 1.0, 1.0, Cars[DriverCar], false); //If message is not empty, add it if (!string.IsNullOrEmpty(stopRequest.StopMessage) && IsPlayerTrain) { MessageManager.AddMessage(stopRequest.StopMessage, MessageDependency.None, GameMode.Normal, MessageColor.White, Program.CurrentRoute.SecondsSinceMidnight + 10.0, null); } } else { Program.Sounds.PlayCarSound(Cars[DriverCar].Sounds.RequestStop[1], 1.0, 1.0, Cars[DriverCar], false); if (stopRequest.FullSpeed) { //Pass at linespeed, rather than braking as if for stop NextStopSkipped = StopSkipMode.Linespeed; } else { NextStopSkipped = StopSkipMode.Decelerate; } //Play sound Program.Sounds.PlayCarSound(Cars[DriverCar].Sounds.RequestStop[1], 1.0, 1.0, Cars[DriverCar], false); //If message is not empty, add it if (!string.IsNullOrEmpty(stopRequest.PassMessage) && IsPlayerTrain) { MessageManager.AddMessage(stopRequest.PassMessage, MessageDependency.None, GameMode.Normal, MessageColor.White, Program.CurrentRoute.SecondsSinceMidnight + 10.0, null); } } }
internal void Stop(RequestStop req) { Builder.Output("Deteniendo ClientManager.."); StopComponent(); Builder.Output("ClientManager detenido.."); }
internal void Stop(RequestStop req) { Builder.Output("Deteniendo Notifier."); StopComponent(); Builder.Output("Notifier detenido."); }
private void Process(RequestStop req) { EnsureStarted(); IsRunning = false; }
public async Task <IActionResult> Stop([FromBody] RequestStop model) { var winners = await _service.Stop(model.UserId, model.GameId); return(Ok(winners)); }
/// <summary> /// 引发 <see cref="RequestStop" /> 事件 /// </summary> public virtual void OnRequestStop() { RequestStop?.Invoke(this, EventArgs.Empty); }