Esempio n. 1
0
        /// <summary>
        ///     Execute an embedded trigger
        /// </summary>
        /// <param name="componeId">
        /// </param>
        /// <param name="triggerEmbeddedBag"></param>
        /// <returns>
        ///     The <see cref="string" />.
        /// </returns>
        public static byte[] ExecuteEmbeddedTrigger(TriggerEmbeddedBag triggerEmbeddedBag)
        {
            try
            {
                eventStop            = new AutoResetEvent(false);
                SyncAsyncEventAction = SyncAsyncActionReceived;
                triggerEmbeddedBag.ActionContext.BubblingObjectBag.SyncronousToken = Guid.NewGuid().ToString();
                EventsEngine.SyncAsyncEventsAddDelegate(
                    triggerEmbeddedBag.ActionContext.BubblingObjectBag.SyncronousToken,
                    SyncAsyncActionReceived);

                EventsEngine.EngineExecuteEmbeddedTrigger(triggerEmbeddedBag);

                eventStop.WaitOne();

                return(_syncronousDataContext);
            }
            catch (Exception ex)
            {
                LogEngine.WriteLog(
                    ConfigurationBag.EngineName,
                    $"Error in {MethodBase.GetCurrentMethod().Name}",
                    Constant.LogLevelError,
                    Constant.TaskCategoriesError,
                    ex,
                    Constant.LogLevelError);
                return(null);
            }
        }