Beispiel #1
0
        protected void LogException(SerializedException ex, bool debug)
        {
            if (CollectExceptions)
            {
                exceptionCollector.Add(ex);
            }

            if (debug)
            {
                LogEnvironment.LogDebugEvent(null, ex.ToString(), (int)LogSeverity.Error, null);
            }
            else
            {
                LogEnvironment.LogEvent(ex.ToString(), LogSeverity.Error);
            }
        }
        /// <summary>
        /// Decreases the number of open items and raises the PackageFinished event when done
        /// </summary>
        /// <param name="success">indicates whether the processing of the current task was successful</param>
        /// <param name="ex">the exception that has ocurred during processing</param>
        public void DecreaseOpenItems(bool success, SerializedException ex)
        {
            lock (localResourceLock)
            {
                if (openTaskCount > 0)
                {
                    Successful &= success;
                    openTaskCount--;
                    if (ex != null)
                    {
                        LogEnvironment.LogEvent(ex.ToString(), LogSeverity.Error);
                    }

                    if (openTaskCount == 0)
                    {
                        OnPackageFinished(new PackageFinishedEventArgs
                        {
                            Package = this,
                            Tasks   = subTasks.Cast <IProcessTask>().ToArray()
                        });
                    }
                }
            }
        }