Esempio n. 1
0
        /// <summary>
        /// Wrapper for Processing Code. Adding Events.
        /// </summary>
        /// <param name="args"></param>
        private void ProcessingWrapper(object state)
        {
            var args    = (EventArgsContainer)state;
            var started = new EventProcessingStartedEventArgs(args);

            Config.Instance.WriteLog(this, $"Invoking ProcessingStarted Event for {args?.Sender?.StringRepresentation} and Event {args?.EventDefinition?.EventType}.", LogType.Info);
            try
            {
                InvokeCancelEvent(ProcessingStarted, started);
            }
            catch (Exception e)
            {
                Config.Instance.WriteLog(this, $"Exception on user defined ProcessingStarted EventHandler: \r\n {e.ToString()}".AttachCallerInformation(), LogType.Error);
            }
            if (started.Cancel)
            {
                Config.Instance.WriteLog(this, $"ProcessingStarted canceled further processing for {args?.Sender?.StringRepresentation} and Event {args?.EventDefinition?.EventType}.", LogType.Info);
            }
            if (started.Cancel)
            {
                return;
            }
            var finished = new EventProcessingFinishedEventArgs(args, started);

            Config.Instance.WriteLog(this, $"Invoking ProcessingFinished Event for {args?.Sender?.StringRepresentation} and Event {args?.EventDefinition?.EventType}.", LogType.Info);
            try
            {
                InvokeCancelEvent(ProcessingFinished, finished);
            }catch (Exception e)
            {
                Config.Instance.WriteLog(this, $"Exception on user defined ProcessingFinished EventHandler: \r\n {e.ToString()}".AttachCallerInformation(), LogType.Error);
            }
            if (finished.Cancel)
            {
                Config.Instance.WriteLog(this, $"ProcessingFinished canceled further processing for {args?.Sender?.StringRepresentation} and Event {args?.EventDefinition?.EventType}.", LogType.Info);
            }
            if (finished.Cancel)
            {
                return;
            }
            Storing(finished);
        }
Esempio n. 2
0
 private void Storing(EventProcessingFinishedEventArgs args)
 {
     Config.Instance.WriteLog(this, $"Calling Store for {args?.EventArgsContainer?.Sender?.StringRepresentation} and Event {args?.EventArgsContainer?.EventDefinition?.EventType}.", LogType.Info);
     Configuration.Config.Instance.Store?.Store(args.EventArgsContainer);
 }