Foro de elhacker.net

Programación => .NET (C#, VB.NET, ASP) => Mensaje iniciado por: Eleкtro en 1 Septiembre 2014, 21:40 pm



Título: [SOURCE] Elektro RadErrorDialog
Publicado por: Eleкtro en 1 Septiembre 2014, 21:40 pm
Elektro RadErrorDialog



Descripción:

Esto es simplemente un RadForm que diseñé para manejar excepciones cara al end-user, lo pueden añadir a sus proyectos como una plantilla de Item.

Dependencias: Telerik RAD Controls

Si quieren una versión sin dependencias de terceros, es decir, usando los controles de .NET framework, entonces visiten: [SOURCE] Elektro ErrorDialog (http://foro.elhacker.net/buscador-t413792.0.html) Autor: EleKtro



Imágenes:

(http://i.imgur.com/fnN6fAP.png)     (http://i.imgur.com/Ti8JSqa.png)

(http://i.imgur.com/k61XZk9.png)    (http://i.imgur.com/HV0rkv1.png)



Ejemplos de uso:

(Ejemplo de uso básico)
Código
  1.    Private Shadows Sub Shown(sender As Object, e As EventArgs) _
  2.    Handles MyBase.Shown
  3.  
  4.        Try
  5.            Dim Url As New Uri(String.Empty)
  6.  
  7.        Catch ex As Exception
  8.  
  9.            Using ErrorDialog As New RadErrorDialog(ex, sender)
  10.                ErrorDialog.ShowDialog()
  11.            End Using
  12.  
  13.        End Try
  14.  
  15.    End Sub

(Ejemplo de uso avanzado)
Código
  1. Public Class Form1
  2.  
  3.    Public Sub New()
  4.  
  5.        ' This call is required by the designer.
  6.        InitializeComponent()
  7.  
  8.        ' Catches Managed Exceptions.
  9.        AddHandler AppDomain.CurrentDomain.FirstChanceException, AddressOf Application_ManagedException
  10.  
  11.        ' Catches Unhandled Exceptions.
  12.        AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf Application_UnhandledException
  13.  
  14.        ' Catches Thread Exceptions.
  15.        AddHandler Application.ThreadException, AddressOf Application_ThreadException
  16.  
  17.    End Sub
  18.  
  19.    ''' <summary>
  20.    ''' Handles the 'UnhandledException' event of the Application.
  21.    ''' </summary>
  22.    ''' <param name="sender">The source of the event.</param>
  23.    ''' <param name="e">The <see cref="UnhandledExceptionEventArgs"/> instance containing the event data.</param>
  24.    Private Sub Application_UnhandledException(ByVal sender As Object, ByVal e As UnhandledExceptionEventArgs)
  25.  
  26.        Using ErrorDialog As New RadErrorDialog(DirectCast(e.ExceptionObject, Exception), Me)
  27.            ErrorDialog.ShowDialog()
  28.        End Using
  29.  
  30.    End Sub
  31.  
  32.    ''' <summary>
  33.    ''' Handles the 'FirstChanceException' event of the Application.
  34.    ''' </summary>
  35.    ''' <param name="sender">The source of the event.</param>
  36.    ''' <param name="e">The <see cref="Runtime.ExceptionServices.FirstChanceExceptionEventArgs" /> instance containing the event data.</param>
  37.    Private Sub Application_ManagedException(ByVal sender As Object, ByVal e As Runtime.ExceptionServices.FirstChanceExceptionEventArgs)
  38.  
  39.        Using ErrorDialog As New RadErrorDialog(e.Exception, Me)
  40.            ErrorDialog.ShowDialog()
  41.        End Using
  42.  
  43.    End Sub
  44.  
  45.    ''' <summary>
  46.    ''' Handles the 'ThreadException' event of the Application.
  47.    ''' </summary>
  48.    ''' <param name="sender">The source of the event.</param>
  49.    ''' <param name="e">The <see cref="Threading.ThreadExceptionEventArgs"/> instance containing the event data.</param>
  50.    Private Sub Application_ThreadException(sender As Object, e As Threading.ThreadExceptionEventArgs)
  51.  
  52.        Using ErrorDialog As New RadErrorDialog(e.Exception, Me)
  53.            ErrorDialog.ShowDialog()
  54.        End Using
  55.  
  56.    End Sub
  57.  
  58. End Class



Descarga:

http://www.mediafire.com/download/shg634whhdwg3ba/RadErrorDialog.rar


Título: Re: [SOURCE] Elektro RadErrorDialog
Publicado por: XresH en 8 Septiembre 2014, 03:14 am
Excelente aporte, buenos codigos para practicar el .NET, a mi gusto es una excelente forma, aprender aún mas de un x lenguaje, leyendo escrituras de otros programadores.

Saludos.