public GameBoard(Vector2 _pos) { //Initalizing other variables position = _pos; //Assigning run once event initEvent = RunOnce; //All the game-related initalization has now moved to the NewGame method }
private void OnInitLow(InitEvent e) { if (e.IsOwner) { this.AccessRight = AccessRight.Owner; } else if (e.CanEdit) { this.AccessRight = AccessRight.Edit; } new MetaChangedEvent(e.Owner, e.Plays, e.CurrentWoots, e.TotalWoots, e.WorldName) .RaiseIn(this.BotBits); }
private void On(InitEvent e) { this.OwnPlayer = e.Player; this.OwnPlayer.Connected = true; this.OwnPlayer.Username = e.Username; this.OwnPlayer.ConnectUserId = ConnectionManager.Of(this.BotBits).ConnectUserId; this.OwnPlayer.Smiley = e.Smiley; this.OwnPlayer.AuraShape = e.AuraShape; this.OwnPlayer.AuraColor = e.AuraColor; this.OwnPlayer.Badge = e.Badge; this.OwnPlayer.ChatColor = e.ChatColor; this.OwnPlayer.X = e.SpawnX; this.OwnPlayer.Y = e.SpawnY; this.OwnPlayer.CrewMember = e.CrewMember; this.OwnPlayer.GoldBorder = true; }
protected void btIniciar_Click(object sender, EventArgs e) { mpePanel.Hide(); if (TicketToInitId.Get() <= 0) { return; } var date = dtHora.SelectedDate; if (!date.HasValue) { ThrowMustEnter("FECHA"); } var ticket = DAOFactory.TicketDAO.FindById(TicketToInitId.Get()); TicketToInitId.Set(-1); SetStartDate(ticket, SecurityExtensions.ToDataBaseDateTime(date.Value)); var messageSaver = new MessageSaver(DAOFactory); var ciclo = new CicloLogisticoHormigon(ticket, DAOFactory, messageSaver); var evento = new InitEvent(DateTime.UtcNow); try { ciclo.ProcessEvent(evento); ShowInfo(CultureManager.GetSystemMessage("CLOG_START_SENT") + ticket.Vehiculo.Interno); Bind(); if (TieneDocumentosVencidos.Get()) { messageSaver.Save(MessageCode.CicloLogisticoIniciadoDocumentosInvalidos.GetMessageCode(), ticket.Vehiculo, evento.Date.AddSeconds(1), null, string.Empty); } } catch (NoVehicleException) { ShowError(new ApplicationException(CultureManager.GetError("TICKET_NO_VEHICLE_ASSIGNED"))); } catch //AlreadyOpenException, QueueException, Exception { ShowError(new ApplicationException(CultureManager.GetError("CLOG_MESSAGE_NOT_SENT") + ticket.Vehiculo.Interno)); } }
private void Log(string message, LogLevel level) { if (!_isInit) { _isInit = true; InitEvent?.Invoke(); } var entry = new LogEntry { Timestamp = DateTime.Now, Message = message, LogLevel = level }; LogEvent?.Invoke(entry); }
private void ControlarInicioDistribucionPorMensaje(string code, Event generico) { if (Coche.Empresa.InicioDistribucionPorMensaje && code == Coche.Empresa.InicioDistribucionCodigoMensaje && DaoFactory.ViajeDistribucionDAO.FindEnCurso(Coche) == null) { var distribucion = DaoFactory.ViajeDistribucionDAO.FindPendiente(new[] { Coche.Empresa.Id }, new[] { -1 }, new[] { Coche.Id }, DateTime.Today, DateTime.Today.AddDays(1)); if (distribucion != null) { var evento = new InitEvent(generico.Tiempo); var ciclo = new CicloLogisticoDistribucion(distribucion, DaoFactory, new MessageSaver(DaoFactory)); ciclo.ProcessEvent(evento); } } }
protected override void OnExecute(Timer timer) { STrace.Trace(ComponentName, "Inicio de la tarea"); var desde = DateTime.UtcNow; var hasta = desde.AddMinutes(1); var empresas = DaoFactory.EmpresaDAO.GetList(); foreach (var empresa in empresas) { var centrosDeCosto = DaoFactory.CentroDeCostosDAO.GetList(new[] { empresa.Id }, new[] { -1 }, new[] { -1 }); foreach (var centroDeCosto in centrosDeCosto) { if (centroDeCosto.InicioAutomatico) { STrace.Trace(ComponentName, string.Format("Inicio Automático habilitado para: {0} - ({1})", centroDeCosto.Descripcion, empresa.RazonSocial)); var tareas = DaoFactory.ViajeDistribucionDAO.GetList(new[] { empresa.Id }, new[] { -1 }, // LINEAS new[] { -1 }, // TRANSPORTISTAS new[] { -1 }, // DEPARTAMENTOS new[] { centroDeCosto.Id }, new[] { -1 }, // SUBCENTROS DE COSTO new[] { -1 }, // VEHICULOS new[] { (int)ViajeDistribucion.Estados.Pendiente }, desde, hasta) .Where(v => v.Vehiculo != null); STrace.Trace(ComponentName, string.Format("Cantidad de tareas pendientes: {0}", tareas.Count())); foreach (var viaje in tareas) { var evento = new InitEvent(DateTime.UtcNow); var ciclo = new CicloLogisticoDistribucion(viaje, DaoFactory, new MessageSaver(DaoFactory)); ciclo.ProcessEvent(evento); STrace.Trace(ComponentName, string.Format("Viaje Iniciado - Código: {0} - Id: {1} ", viaje.Codigo, viaje.Id)); } } } } STrace.Trace(ComponentName, "Fin de la tarea"); }
private void OnInit(InitEvent e) { this.Owner = e.Owner; this.WorldName = e.WorldName; this.Plays = e.Plays; this.Token = Utils.Rot13(e.EncryptedToken); this.TutorialRoom = e.TutorialRoom; this.GravityMultiplier = e.GravityMultiplier; this.CurrentWoots = e.CurrentWoots; this.TotalWoots = e.TotalWoots; this.BackgroundColor = e.BackgroundColor; this.Visible = e.Visible; this.HideLobby = e.HideLobby; this.AllowSpectating = e.AllowSpectating; this.Description = e.RoomDescription; this.ZombieLimit = e.ZombieLimit; this.CurseLimit = e.CurseLimit; this.InitComplete = true; }
/// <summary> /// 要素を追加 /// </summary> public void Add(GameObject gameObject, int count = 1) { for (var i = 0; i < count; i++) { var index = _items.Count; // 初期化処理 InitEvent?.Invoke(gameObject); gameObject.transform.parent = transform; var pos = gameObject.transform.position; pos.z = transform.position.z; gameObject.transform.position = pos; var item = new RingLayoutItem(gameObject.transform as RectTransform, index); item.Button?.onClick.AddListener(() => ClickEvent?.Invoke(index)); _items.Add(item); } Reposition(); }
public string StartRoute(int routeId) { var ticket = DaoFactory.ViajeDistribucionDAO.FindById(routeId); var ciclo = new CicloLogisticoDistribucion(ticket, DaoFactory, new MessageSaver(DaoFactory)); var evento = new InitEvent(DateTime.UtcNow); try { ciclo.ProcessEvent(evento); return("CLOG_START_SENT"); } catch (NoVehicleException) { return("TICKET_NO_VEHICLE_ASSIGNED"); } catch (Exception ex) //AlreadyOpenException, QueueException, Exception { return("CLOG_MESSAGE_NOT_SENT" + ex.Message.ToString() + ex.StackTrace.ToString()); } }
protected override void Initialize(InitEvent initEvent) { var genericTypes = base.WrappedActorType.BaseType.GetGenericArguments(); if (genericTypes.Length == 1) { var grainStateType = Type.GetType($"OrleansModel.GrainState`1[{genericTypes[0]}]"); var grainState = Activator.CreateInstance(grainStateType); FieldInfo field = base.WrappedActorInstance.GetType().GetField("GrainState", BindingFlags.Public | BindingFlags.Instance); if (field != null) { field.SetValue(base.WrappedActorInstance, grainState); } ((IStatefulGrain)base.WrappedActorInstance).SetStorage(new InMemoryStorage()); } ((Grain)base.WrappedActorInstance).PrimaryKey = (Guid)initEvent.PrimaryKey; }
protected override void Initialize(InitEvent evt) { base.Initialize(evt); if (_config.SeedUrls.Count == 0) { var context = Context; Task.Run(() => { Log.Info("No Cluster Found Run Setup"); var result = this.ShowDialog <IInitialDialog, string?>()(); switch (result) { case "Setup": UICall(() => _dockingManager.ActivateWindow("ConfigurationView")); context.System.EventStream.Publish(StartConfigurationSetup.Get); break; } }); } }
private void On(InitEvent e) { this.Owner = e.Owner; this.WorldName = e.WorldName; this.Plays = e.Plays; this.Campaign = e.Campaign; this.GravityMultiplier = e.GravityMultiplier; this.Favorites = e.Favorites; this.Likes = e.Likes; this.BackgroundColor = e.BackgroundColor; this.Visible = e.Visible; this.HideLobby = e.HideLobby; this.AllowSpectating = e.AllowSpectating; this.Description = e.RoomDescription; this.ZombieLimit = e.ZombieLimit; this.CurseLimit = e.CurseLimit; this.CrewId = e.CrewId; this.CrewName = e.CrewId; this.WorldStatus = e.WorldStatus; this.MinimapEnabled = e.MinimapEnabled; this.LobbyPreviewEnabled = e.LobbyPreviewEnabled; this.InitComplete = true; }
private async void WaitForInitEvent() { await InitEvent.Of(BotBits).WaitOneAsync(); connectResult.SetResult(true); }
private void On(InitEvent e) { this.Reindex(); }
private void OnInit(InitEvent e) { new Init2SendMessage() .SendIn(this.BotBits); }
private void OnLow(InitEvent e) { new WorldResizeEvent(e.WorldWidth, e.WorldHeight) .RaiseIn(this.BotBits); }
public void Init(InitEvent e) { }
public async Task HandleAsync(AddInitEventCommand command) { using var session = this._sessionFactory.Create(); var initEvent = new InitEvent(command.ServerId, command.EndedAt); await session.AddAsync(initEvent); }
protected override void Initialize(InitEvent evt) { // ReSharper disable once PossiblyImpureMethodCallOnReadonlyVariable _processManager.Tell(new RegisterProcessList(Self, ImmutableArray <string> .Empty.Add(_config.Client).Add(_config.Kernel))); }
protected override HandleResults OnDeviceHandleMessage(TextEvent message) { var employee = GetChofer(message.UserIdentifier); var pos = message.GeoPoint; if (pos == null) { var pp = DaoFactory.LogPosicionDAO.GetLastOnlineVehiclePosition(Coche); pos = GPSPoint.Factory(message.GetDateTime(), pp == null ? (float)0.0 : (float)pp.Latitud, pp == null ? (float)0.0 : (float)pp.Longitud); } MessageSaver.Save(message, MessageCode.TextEvent.GetMessageCode(), Dispositivo, Coche, employee, pos.Date, pos, message.Text); if (Coche.Empresa.IntegrationServiceEnabled) { var text = message.Text.Trim().ToUpperInvariant(); var ruta = DaoFactory.ViajeDistribucionDAO.FindEnCurso(Coche); if (ruta != null && text.Contains(Coche.Empresa.IntegrationServicePrefixConfirmation)) { var sosTicket = DaoFactory.SosTicketDAO.FindByCodigo(ruta.Codigo); if (sosTicket != null) { text = text.Replace(Coche.Empresa.IntegrationServicePrefixConfirmation, string.Empty); var intService = new IntegrationService(DaoFactory); if (sosTicket.Patente.ToUpperInvariant().Contains(text)) { intService.ConfirmaPatente(sosTicket, true); } else { intService.ConfirmaPatente(sosTicket, false); } } } } if (Coche.Empresa.AsignoDistribucionPorMensaje) { var text = message.Text.Trim().ToUpperInvariant(); STrace.Trace("AsignoDistribucionPorMensaje", string.Format("Text: {0}", text)); var prefijo = Coche.Empresa.AsignoDistribucionPrefijoMensaje.Trim().ToUpperInvariant(); if (text.Contains(prefijo)) { STrace.Trace("AsignoDistribucionPorMensaje", string.Format("Empresa: {0} - Coche: {1} - Msj: {2}", Coche.Empresa.Id, Coche.Id, text)); var mensaje = MessageSender.Create(Dispositivo, new MessageSaver(DaoFactory)) .AddCommand(MessageSender.Comandos.SubmitTextMessage); var viajeEnCurso = DaoFactory.ViajeDistribucionDAO.FindEnCurso(Coche); if (viajeEnCurso == null) { var codigoRuta = DateTime.Today.ToString("yyMMdd") + "|" + text.Replace(prefijo, string.Empty).Trim(); var viaje = DaoFactory.ViajeDistribucionDAO.FindByCodigo(Coche.Empresa.Id, Coche.Linea.Id, codigoRuta); if (viaje != null) { if (viaje.Estado == ViajeDistribucion.Estados.Pendiente) { viaje.Vehiculo = Coche; DaoFactory.ViajeDistribucionDAO.SaveOrUpdate(viaje); var ciclo = new CicloLogisticoDistribucion(viaje, DaoFactory, new MessageSaver(DaoFactory)); var evento = new InitEvent(DateTime.UtcNow); ciclo.ProcessEvent(evento); mensaje = mensaje.AddMessageText("RUTA " + codigoRuta + " INICIADA"); STrace.Trace("AsignoDistribucionPorMensaje", string.Format("RUTA {0} INICIADA", codigoRuta)); } else { mensaje = mensaje.AddMessageText("NO ES POSIBLE INICIAR LA RUTA " + codigoRuta); STrace.Trace("AsignoDistribucionPorMensaje", string.Format("NO ES POSIBLE INICIAR LA RUTA {0}", codigoRuta)); } } else { mensaje = mensaje.AddMessageText("RUTA " + codigoRuta + " NO ENCONTRADA"); STrace.Trace("AsignoDistribucionPorMensaje", string.Format("RUTA {0} NO ENCONTRADA", codigoRuta)); } } else { mensaje = mensaje.AddMessageText("USTED YA TIENE ASIGNADA UNA RUTA INICIADA"); STrace.Trace("AsignoDistribucionPorMensaje", string.Format("USTED YA TIENE ASIGNADA UNA RUTA INICIADA")); } mensaje.Send(); } } return(HandleResults.Success); }
private void On(InitEvent e) { this.World = GetWorld(e.PlayerIOMessage, e.WorldWidth, e.WorldHeight); }
void RunOnce() { /*Put initalization actions that only need to be run once after the gameboard is created here*/ //Initalizing tile color holder colorHolder = TileColorHolder.Instance; //Remove itself from the initEvent delegate initEvent -= RunOnce; }
protected abstract void Initialize(InitEvent initEvent);
protected virtual void OnInit(InitEventArgs ies) { Console.WriteLine($"{ies.SpiderInfo}初始化完毕"); InitEvent?.Invoke(this, ies); }
/// <summary> /// Processes the message /// </summary> /// <param name="connectionBase">The connection base</param> /// <param name="message">The playerio message</param> /// <param name="handled">Whether the message was already handled</param> public void Process(ConnectionBase connectionBase, Message message, bool handled) { WorldConnection worldCon = (WorldConnection)connectionBase; World world = new World(connectionBase.Client, message); string username = message.GetString(9); int userId = message.GetInt(6); WorldPlayer connected = new WorldPlayer(worldCon, username, userId); FluidClient client = connectionBase.Client; if (client.GetConnectionType(client.ConnectionUserId) != PlayerType.Guest) { PlayerObject playerObject = connectionBase.Client.LoadMyPlayerObject(); connected.Face = playerObject.Smiley; connected.HasBuildersClub = playerObject.IsInBuildersClub; connected.HasChat = playerObject.CanChat; connected.IsFriendsWithYou = false; connected.IsGuardian = playerObject.IsGuardian; connected.IsModerator = playerObject.IsModerator; } else { connected.Face = FaceID.Smile; connected.HasBuildersClub = false; connected.HasChat = false; connected.IsFriendsWithYou = false; connected.IsGuardian = false; connected.IsModerator = false; } connected.X = message.GetInt(7); connected.Y = message.GetInt(8); bool decodingPotions = true; for (uint i = message.Count - 1; i >= 0; i--) { if (message[i] is string) { if (string.Compare(message.GetString(i), "pe", false) == 0) { decodingPotions = true; continue; } else if (string.Compare(message.GetString(i), "ps", false) == 0) { break; } } if (decodingPotions) { int potionCount = message.GetInt(i); int potionType = message.GetInt(i--); worldCon.Potions.SetPotionCount((Potion)potionType, potionCount); } } if (!handled) { worldCon.World = world; worldCon.Players.Add(connected); worldCon.Me = connected; } InitEvent initEvent = new InitEvent(); initEvent.Raw = message; initEvent.World = world; initEvent.ConnectedPlayer = connected; connectionBase.RaiseServerEvent <InitEvent>(initEvent); }
public static IEvent GetEvent(DAOFactory daoFactory, GPSPoint inicio, string codigo, Int32?idPuntoDeInteres, Int64 extraData, Int64 extraData2, Int64 extraData3, Coche vehiculo, Empleado chofer) { IEvent evento = null; int cod; if (int.TryParse(codigo, out cod) && cod > 0 && cod < 20) { evento = new ManualEvent(inicio.Date, inicio.Lat, inicio.Lon, codigo); } else if (codigo == MessageCode.InsideGeoRefference.GetMessageCode() && idPuntoDeInteres.HasValue) { evento = new GeofenceEvent(inicio.Date, idPuntoDeInteres.Value, GeofenceEvent.EventoGeofence.Entrada, inicio.Lat, inicio.Lon, chofer); } else if (codigo == MessageCode.OutsideGeoRefference.GetMessageCode() && idPuntoDeInteres.HasValue) { evento = new GeofenceEvent(inicio.Date, idPuntoDeInteres.Value, GeofenceEvent.EventoGeofence.Salida, inicio.Lat, inicio.Lon, chofer); } else if (codigo == MessageCode.TolvaDeactivated.GetMessageCode()) { evento = new TolvaEvent(inicio.Date, TolvaEvent.EstadoTolva.Off, inicio.Lat, inicio.Lon); } else if (codigo == MessageCode.TolvaActivated.GetMessageCode()) { evento = new TolvaEvent(inicio.Date, TolvaEvent.EstadoTolva.On, inicio.Lat, inicio.Lon); } else if (codigo == MessageCode.MixerStopped.GetMessageCode()) { evento = new TrompoEvent(inicio.Date, TrompoEvent.SentidoTrompo.Detenido, TrompoEvent.VelocidadTrompo.Undefined, inicio.Lat, inicio.Lon); } else if (codigo == MessageCode.MixerClockwiseFast.GetMessageCode()) { evento = new TrompoEvent(inicio.Date, TrompoEvent.SentidoTrompo.HorarioDerecha, TrompoEvent.VelocidadTrompo.Fast, inicio.Lat, inicio.Lon); } else if (codigo == MessageCode.MixerClockwiseSlow.GetMessageCode()) { evento = new TrompoEvent(inicio.Date, TrompoEvent.SentidoTrompo.HorarioDerecha, TrompoEvent.VelocidadTrompo.Slow, inicio.Lat, inicio.Lon); } else if (codigo == MessageCode.MixerClockwise.GetMessageCode()) { evento = new TrompoEvent(inicio.Date, TrompoEvent.SentidoTrompo.HorarioDerecha, TrompoEvent.VelocidadTrompo.Undefined, inicio.Lat, inicio.Lon); } else if (codigo == MessageCode.MixerCounterClockwiseFast.GetMessageCode()) { evento = new TrompoEvent(inicio.Date, TrompoEvent.SentidoTrompo.AntihorarioIzquierda, TrompoEvent.VelocidadTrompo.Fast, inicio.Lat, inicio.Lon); } else if (codigo == MessageCode.MixerCounterClockwiseSlow.GetMessageCode()) { evento = new TrompoEvent(inicio.Date, TrompoEvent.SentidoTrompo.AntihorarioIzquierda, TrompoEvent.VelocidadTrompo.Slow, inicio.Lat, inicio.Lon); } else if (codigo == MessageCode.MixerCounterClockwise.GetMessageCode()) { evento = new TrompoEvent(inicio.Date, TrompoEvent.SentidoTrompo.AntihorarioIzquierda, TrompoEvent.VelocidadTrompo.Undefined, inicio.Lat, inicio.Lon); } else if (codigo == MessageCode.GarminTextMessageCannedResponse.GetMessageCode()) { // extraData = ID Device // extraData2 = ID Entrega / ID Ruta // extraData3 = Codigo Mensaje STrace.Debug(typeof(EventFactory).FullName, Convert.ToInt32(extraData), "extraData=" + extraData + " extraData2=" + extraData2 + " extraData3=" + extraData3); var veh = daoFactory.CocheDAO.FindMobileByDevice(Convert.ToInt32(extraData)); if (veh != null && veh.Empresa.IntegrationServiceEnabled) { var intService = new IntegrationService(daoFactory); if (veh.Empresa.IntegrationServiceCodigoMensajeAceptacion == extraData3.ToString()) { var distribucion = daoFactory.ViajeDistribucionDAO.FindById(Convert.ToInt32(extraData2)); if (distribucion != null) { var enCurso = daoFactory.ViajeDistribucionDAO.FindEnCurso(veh); if (enCurso == null) { intService.ResponseAsigno(distribucion, true); var eventoInicio = new InitEvent(inicio.Date); var ciclo = new CicloLogisticoDistribucion(distribucion, daoFactory, new MessageSaver(daoFactory)); ciclo.ProcessEvent(eventoInicio); } else { intService.ResponsePreasigno(distribucion, true); } } return(null); } else if (veh.Empresa.IntegrationServiceCodigoMensajeRechazo == extraData3.ToString()) { var distribucion = daoFactory.ViajeDistribucionDAO.FindById(Convert.ToInt32(extraData2)); distribucion.Vehiculo = null; daoFactory.ViajeDistribucionDAO.SaveOrUpdate(distribucion); var enCurso = daoFactory.ViajeDistribucionDAO.FindEnCurso(veh); if (enCurso == null) { intService.ResponseAsigno(distribucion, false); } else { intService.ResponsePreasigno(distribucion, false); } return(null); } } if (extraData2 == 0) { return(null); } var entrega = daoFactory.EntregaDistribucionDAO.FindById(Convert.ToInt32(extraData2)); var mensajeVo = daoFactory.MensajeDAO.GetByCodigo(extraData3.ToString("#0"), veh.Empresa, veh.Linea); try { var mensaje = daoFactory.MensajeDAO.FindById(mensajeVo.Id); try { var descriptiva = " - " + entrega.Viaje.Codigo + " - " + entrega.Descripcion; var ms = new MessageSaver(daoFactory); var log = ms.Save(null, Convert.ToString(extraData3), veh.Dispositivo, veh, chofer, inicio.Date, inicio, descriptiva, entrega.Viaje, entrega); try { entrega.MensajeConfirmacion = log as LogMensaje; daoFactory.EntregaDistribucionDAO.SaveOrUpdate(entrega); } catch (Exception) { } if (mensaje.TipoMensaje.DeConfirmacion) { evento = new GarminEvent(inicio.Date, extraData2, inicio.Lat, inicio.Lon, EntregaDistribucion.Estados.Completado, chofer); } else if (mensaje.TipoMensaje.DeRechazo) { evento = new GarminEvent(inicio.Date, extraData2, inicio.Lat, inicio.Lon, EntregaDistribucion.Estados.NoCompletado, chofer); } else { STrace.Error(typeof(CicloLogisticoFactory).FullName, Convert.ToInt32(extraData), "Respuesta de mensaje de Canned Response inválida sin tipo de mensaje adecuado para la ocasión. (" + extraData2 + "-" + extraData + ")"); } } catch (Exception e) { STrace.Exception(typeof(EventFactory).FullName, e, "E#2 Vehicle=" + veh.Id + " entrega=" + (entrega == null ? "null" : entrega.Id.ToString("#0")) + " mensajeVo=" + mensajeVo.Id + " mensaje=" + (mensaje == null ? "null" : mensaje.Id.ToString("#0"))); } } catch (Exception e) { STrace.Exception(typeof(EventFactory).FullName, e, "E#1 Vehicle=" + veh.Id + " entrega=" + (entrega == null ? "null" : entrega.Id.ToString("#0")) + " mensajeVo=" + (mensajeVo == null ? "null" : mensajeVo.Id.ToString("#0"))); } } else if (codigo == MessageCode.ValidacionRuteo.GetMessageCode()) { var deviceId = inicio.DeviceId; var vehicle = daoFactory.CocheDAO.FindMobileByDevice(deviceId); if (vehicle != null) { var ruta = daoFactory.ViajeDistribucionDAO.FindEnCurso(vehicle); if (ruta != null) { evento = new RouteEvent(inicio.Date, ruta.Id, inicio.Lat, inicio.Lon, RouteEvent.Estados.Enviado); } } } else if (codigo == MessageCode.GarminETAReceived.GetMessageCode()) { if (vehiculo.HasActiveStop()) { var activeStop = vehiculo.GetActiveStop(); if (activeStop > 0) { var edDAO = daoFactory.EntregaDistribucionDAO; var vdDAO = daoFactory.ViajeDistribucionDAO; var detalle = edDAO.FindById(activeStop); if (detalle != null) { var utcnow = DateTime.UtcNow; var fechora = vehiculo.EtaEstimated(); var minutos = fechora != null && fechora > utcnow?fechora.Value.Subtract(utcnow).TotalMinutes : 0; var texto = String.Format(CultureManager.GetLabel("GARMIN_STOP_ETA_ARRIVAL"), minutos, fechora); if (minutos > 0) { using (var transaction = SmartTransaction.BeginTransaction()) { try { try { new MessageSaver(daoFactory).Save(null, codigo, vehiculo.Dispositivo, vehiculo, chofer, DateTime.UtcNow, null, texto, detalle.Viaje, detalle); } catch (Exception ex) { STrace.Exception(typeof(EventFactory).FullName, ex, vehiculo.Dispositivo.Id, String.Format("Exception doing MessageSaver.Save({0})", texto)); throw ex; } try { detalle.GarminETA = fechora; detalle.GarminETAInformedAt = utcnow; vdDAO.SaveOrUpdate(detalle.Viaje); } catch (Exception ex) { STrace.Exception(typeof(EventFactory).FullName, ex, vehiculo.Dispositivo.Id, String.Format("Exception doing MessageSaver.Save({0})", texto)); throw ex; } transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); throw ex; } } } } else { STrace.Error(typeof(EventFactory).FullName, vehiculo.Dispositivo.Id, String.Format("Processing GarminETAReceived cannot be processed because EntregaDistribucion #{0} is null.", activeStop)); } } else { STrace.Error(typeof(EventFactory).FullName, vehiculo.Dispositivo.Id, "Processing GarminETAReceived cannot be processed because ActiveStop # is not valid."); } } } else { var stopstatus = TranslateStopStatus(codigo); if (stopstatus != -1) { evento = new GarminEvent(inicio.Date, extraData, inicio.Lat, inicio.Lon, stopstatus, chofer); } } return(evento); }
public void AddInitEvent(InitEvent myHandler) { command.NewSongInit += myHandler; }
protected override void Initialize(InitEvent evt) => Context.Child("Fan-Control").Tell(new ClockEvent(ClockState.Start));
public void Init() { InitEvent?.Invoke(this, null); }
private void On(InitEvent e) { this.Liked = e.Liked; this.Favorited = e.Favorited; this.CanEdit = e.CanEdit; }
protected virtual void Process(InitEvent data) { }