''' <summary>
''' Raises all information accordingly to the status label.
''' </summary>
''' <remarks></remarks>
Public Class NotifierHandler
''' <summary>
''' Represents the method that will handle the <see cref="NotifierHandler.Notifies">PostData</see> event of <see cref="Notifies" />.
''' </summary>
''' <remarks >
''' Notifies the current session state.
''' </remarks>
Public Event Notifies As EventHandler(Of NotifierEventArghs)
''' <summary>
''' Raises the Notifies event.
''' </summary>
''' <param name="e">The Event Arguments.</param>
Protected Overridable Sub OnNotifier(ByVal e As NotifierEventArghs)
RaiseEvent Notifies(Me, e)
End Sub
Public Sub Exception(ByVal ex As Exception)
Dim message As String = String.Format("ERROR: Unknown Exception ({0}).", ex.Message)
Me.OnNotifier(New NotifierEventArghs(message))
End Sub
''' <summary>
''' Displays an error message that indicates the form authenticity key could not be obtained.
''' </summary>
Public Sub ShowFormAuthKeyFail()
Dim message As String = "Form authenticity key could not be obtained."
Me.OnNotifier(New NotifierEventArghs(message))
End Sub
''' <summary>
''' Displays an error message that indicates the form url is invalid.
''' </summary>
Public Sub ShowUrlInvalid(ByVal Url As String)
Dim message As String = String.Format("The URI string '{0}' is invalid.", Url)
Me.OnNotifier(New NotifierEventArghs(message))
End Sub
''' <summary>
''' Displays an error message that indicates the form Href is invalid.
''' </summary>
Public Sub ShowHrefInvalid(ByVal Href As String)
Dim message As String = String.Format("The relative URI string '{0}' is invalid.", Href)
Me.OnNotifier(New NotifierEventArghs(message))
End Sub
''' <summary>
''' Displays an error message that indicates the request Failed.
''' </summary>
Public Sub ShowRequestFailed(ByVal uri As String)
Dim message As String = String.Format("Failed to create HttpWebRequest for '{0}'.", uri)
Me.OnNotifier(New NotifierEventArghs(message))
End Sub
''' <summary>
''' Displays an error message that indicates the request failed.
''' </summary>
Public Sub ShowRequestFailedReturnedStatus(ByVal uri As String, ByVal status As String)
Dim message As String = String.Format("Request from '{0}' returned Status '{1}'.", uri, status)
Me.OnNotifier(New NotifierEventArghs(message))
End Sub
''' <summary>
''' Displays an error message that indicates the response failed.
''' </summary>
Public Sub ShowResponseFailed(ByVal uri As String)
Dim message As String = String.Format("Failed to get response from '{0}'.", uri)
Me.OnNotifier(New NotifierEventArghs(message))
End Sub
''' <summary>
''' Displays an error message that indicates the response status code is bad.
''' </summary>
Public Sub ShowResponseIsBad(ByVal uri As String, ByVal code As Integer, ByVal status As String)
Dim message As String = String.Format("Request from '{0}' returned StatusCode '{1}' ({2})", uri, code, status)
Me.OnNotifier(New NotifierEventArghs(message))
End Sub
''' <summary>
''' Displays an error message that indicates the login has failed.
''' </summary>
Public Sub ShowLoginError()
Dim message As String = "Invalid user name or email address."
Me.OnNotifier(New NotifierEventArghs(message))
End Sub
End Class