Ejemplo n.º 1
0
        private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            string strLogFolder = null;

            try
            {
                ConfigEngine config = new ConfigEngine();
                strLogFolder = config.AppConfigFolder;
                config.Log.Error(e.Exception.ToString(), "UnhandledException");
            }
            catch (Exception ex)
            {
                strLogFolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\AutoVer\\";
                try
                {
                    if (!System.IO.Directory.Exists(strLogFolder))
                    {
                        System.IO.Directory.CreateDirectory(strLogFolder);
                    }
                }
                catch
                {
                }
            }
            if ((_frmErrorReporter == null) || !_frmErrorReporter.Visible)
            {
                _frmErrorReporter = new ErrorReporter(strLogFolder);
            }
            _frmErrorReporter.ErrorException = e.Exception;
            _frmErrorReporter.Show();
            _frmErrorReporter.Activate();
        }