Test Foro de elhacker.net SMF 2.1

Programación => Programación General => .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 (VBNET) [Seleccionar]
    Private Shadows Sub Shown(sender As Object, e As EventArgs) _
    Handles MyBase.Shown

        Try
            Dim Url As New Uri(String.Empty)

        Catch ex As Exception

            Using ErrorDialog As New RadErrorDialog(ex, sender)
                ErrorDialog.ShowDialog()
            End Using

        End Try

    End Sub


(Ejemplo de uso avanzado)
Código (VBNET) [Seleccionar]
Public Class Form1

    Public Sub New()

        ' This call is required by the designer.
        InitializeComponent()

        ' Catches Managed Exceptions.
        AddHandler AppDomain.CurrentDomain.FirstChanceException, AddressOf Application_ManagedException

        ' Catches Unhandled Exceptions.
        AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf Application_UnhandledException

        ' Catches Thread Exceptions.
        AddHandler Application.ThreadException, AddressOf Application_ThreadException

    End Sub

    ''' <summary>
    ''' Handles the 'UnhandledException' event of the Application.
    ''' </summary>
    ''' <param name="sender">The source of the event.</param>
    ''' <param name="e">The <see cref="UnhandledExceptionEventArgs"/> instance containing the event data.</param>
    Private Sub Application_UnhandledException(ByVal sender As Object, ByVal e As UnhandledExceptionEventArgs)

        Using ErrorDialog As New RadErrorDialog(DirectCast(e.ExceptionObject, Exception), Me)
            ErrorDialog.ShowDialog()
        End Using

    End Sub

    ''' <summary>
    ''' Handles the 'FirstChanceException' event of the Application.
    ''' </summary>
    ''' <param name="sender">The source of the event.</param>
    ''' <param name="e">The <see cref="Runtime.ExceptionServices.FirstChanceExceptionEventArgs" /> instance containing the event data.</param>
    Private Sub Application_ManagedException(ByVal sender As Object, ByVal e As Runtime.ExceptionServices.FirstChanceExceptionEventArgs)

        Using ErrorDialog As New RadErrorDialog(e.Exception, Me)
            ErrorDialog.ShowDialog()
        End Using

    End Sub

    ''' <summary>
    ''' Handles the 'ThreadException' event of the Application.
    ''' </summary>
    ''' <param name="sender">The source of the event.</param>
    ''' <param name="e">The <see cref="Threading.ThreadExceptionEventArgs"/> instance containing the event data.</param>
    Private Sub Application_ThreadException(sender As Object, e As Threading.ThreadExceptionEventArgs)

        Using ErrorDialog As New RadErrorDialog(e.Exception, Me)
            ErrorDialog.ShowDialog()
        End Using

    End Sub

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.