public frmAdmin() { InitializeComponent(); try { Provider = Membership.Provider; } catch(System.Configuration.Provider.ProviderException ex) { ExceptionViewComponent wExceptionViewer = new ExceptionViewComponent(); wExceptionViewer.ButtonsYesNoVisible = DevExpress.XtraBars.BarItemVisibility.Always; wExceptionViewer.Title = "Error de configuracion "; wExceptionViewer.Show(wExceptionViewer.Title, ex.Message, string.Empty, false); } this.Text = string.Concat(this.Text, " version ", Assembly.GetExecutingAssembly().GetName().Version.ToString()); SetEnabledItems(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { Application.Run(new frmAdmin()); } catch (Exception wException) { ExceptionViewComponent wExceptionViewer = new ExceptionViewComponent(); wExceptionViewer.ButtonsYesNoVisible = DevExpress.XtraBars.BarItemVisibility.Always; wExceptionViewer.Title = "Error no manejado"; wExceptionViewer.Title = string.Concat(wExceptionViewer.Title, " : ", wException.Source); DialogResult wResult = wExceptionViewer.Show(wExceptionViewer.Title, wException.Message, Fwk.Exceptions.ExceptionHelper.GetAllMessageException(wException), false); if (wResult == DialogResult.OK) Application.Exit(); } }
/// <summary> /// metodo que resuelve el msg a mostrar para ex no manejadas /// </summary> /// <param name="o"></param> public static void HandleUnhandledException(Object o) { string wError; Exception wException = o as Exception; if (wException != null) wError = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(wException); else wError = o.ToString(); System.Text.StringBuilder wStringBuilder = new System.Text.StringBuilder(5000); wStringBuilder.Append(@"Se detectaron anomalías en la aplicacion por favor chequee los siguientes errores: "); wStringBuilder.Append(Environment.NewLine); wStringBuilder.Append(Environment.NewLine); wStringBuilder.Append(@"{0}"); wStringBuilder.Append(Environment.NewLine); wStringBuilder.Append("¿Desea salir de la aplicación?"); wError = string.Format(wStringBuilder.ToString(), wError); ExceptionViewComponent wExceptionViewer = new ExceptionViewComponent(); wExceptionViewer.ButtonsYesNoVisible = DevExpress.XtraBars.BarItemVisibility.Always; wExceptionViewer.Title = "Error no manejado"; if (wException != null) { wExceptionViewer.Title = string.Concat(wExceptionViewer.Title, " : ", wException.Source); } #region Log del error en la base de datos o dicha configuracion bool wLogError = logError; if (logError) { //Si el error es del propio frqmework de logging no intentar loguear y evitaar asi la recursividad del error if (Fwk.Exceptions.ExceptionHelper.GetFwkExceptionTypes(wException) == Fwk.Exceptions.FwkExceptionTypes.TechnicalException) if (((Fwk.Exceptions.TechnicalException)wException).ErrorId == "9004") wLogError = false; } #endregion DialogResult wResult = wExceptionViewer.Show(wExceptionViewer.Title, wError, string.Empty, wLogError); if (wResult == DialogResult.OK) Application.Exit(); }