Пример #1
0
        public void EndFramework(out bool abort, out string abortReason)
        {
            abortReason = String.Empty;
            abort       = false;

            EndAllModules();

            var results = new List <Result>();

            ComponentRegistry
            .Instance
            .ResolveAll <IApplicationEndTask>()
            .ForEach(
                endTask => Exceptions.ExecuteIgnoringException(() => results.Add(endTask.End()))
                );

            if (results.Any(r => r.Failure))
            {
                var textBuilder = new ParagraphBuilder();
                results.ForEach(
                    result => {
                    result.ErrorMessages.ForEach(
                        notification => textBuilder.AppendSentence(notification));
                    textBuilder.AppendParagraphBreak();
                }
                    );
                abort       = true;
                abortReason = textBuilder.ToString();
            }

            EndAllModules();
            ComponentRegistry.Instance.Dispose();
        }