Пример #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            ISelkieLogger logger = null;

            try
            {
                logger = Container.Resolve <ISelkieLogger>();

                // ReSharper disable once UnusedVariable
                var factory = Container.Resolve <IViewFactory>();
                var main    = factory.CreateView <IMainView>();
                main.ShowDialog();
            }
            catch (Exception exception)
            {
                string message = LogException(logger,
                                              exception);

                MessageBox.Show(message);

                Console.WriteLine(exception);
                Console.WriteLine(exception.StackTrace);

                if (logger != null)
                {
                    logger.Error(message,
                                 exception);
                }
            }
        }
Пример #2
0
        private string LogException(ISelkieLogger logger,
                                    Exception exception)
        {
            string message = "Failed to create components: {0}\r\n\r\n{1}".Inject(exception.Message,
                                                                                  exception.StackTrace);

            logger.Error(message);

            if (exception.InnerException != null)
            {
                message += LogException(logger,
                                        exception.InnerException);
            }

            return(message);
        }
Пример #3
0
        private string LogException(ISelkieLogger logger,
                                    Exception exception)
        {
            string message = "Failed to create components: {0}\r\n\r\n{1}".Inject(exception.Message,
                                                                                  exception.StackTrace);

            logger.Error(message);

            if ( exception.InnerException != null )
            {
                message += LogException(logger,
                                        exception.InnerException);
            }

            return message;
        }