/// <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
     });
 }
예제 #2
0
        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();
            }
        }
예제 #3
0
        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);
        }
예제 #4
0
        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");
            }
        }
예제 #5
0
 public ApplicationEvent(ApplicationEventType type)
 {
     Type = type;
 }