/// <summary> /// Create application event /// </summary> /// <param name="type"></param> /// <param name="context"></param> /// <param name="application"></param> /// <returns></returns> private static ApplicationEventModel Wrap(ApplicationEventType type, RegistryOperationContextModel context, ApplicationInfoModel application) { return(new ApplicationEventModel { EventType = type, Context = context, Application = application }); }
public static string GetText(this ApplicationEventType t) { switch (t) { case ApplicationEventType.NewSensorRegistered: return("Připojil se nový senzor"); case ApplicationEventType.SensorConnectionLost: return($"Žádná data od senzoru za více než {ApplicationEvent.SENSOR_CONNECTION_LOST_INTERVAL / 60 / 1000} minut"); default: throw new NotImplementedException(); } }
public static ApplicationEvent InsertApplicationEvent( this IDbConnection connection, IDbTransaction transaction, Guid applicationId, ApplicationEventType eventType, string message) { if (transaction == null) { throw new ArgumentNullException(nameof(transaction)); } var applicationEvent = new ApplicationEvent { ApplicationId = applicationId, EventType = eventType, Message = message }.SetNew(); connection.Insert(applicationEvent, transaction); return(applicationEvent); }
public void FireWindowsLog(ApplicationEventType eventType, string customMessage = "") { switch (eventType) { case ApplicationEventType.Started: outsEventLog.WriteEntry("Started;" + customMessage, EventLogEntryType.Information, STARTED); break; case ApplicationEventType.Running: outsEventLog.WriteEntry("Running;" + customMessage, EventLogEntryType.Information, RUNNING); break; case ApplicationEventType.Stopped: outsEventLog.WriteEntry("Stopped;" + customMessage, EventLogEntryType.Information, STOPPED); break; case ApplicationEventType.Error: outsEventLog.WriteEntry("Error;" + customMessage, EventLogEntryType.Error, ERRORED); break; default: throw new Exception("Unexpected Case"); } }
public ApplicationEvent(ApplicationEventType type) { Type = type; }