Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Collections
- Imports System.Collections.Generic
- Imports System.Text
- Imports System.Windows.Forms
- Imports Authorization
- Public Partial Class frmMain
- Inherits Form
- Public Sub New()
- InitializeComponent()
- End Sub
- #Region "Authorization"
- Private Sub btnAuthorize_Click(sender As Object, e As EventArgs)
- 'Validate that user has entered correct information in textboxes.
- 'Use NFAuth's constructor to your full advantage
- Dim auth As New NFAuth(txtUsername.Text, txtPassword.Text, PROGRAM_ID, PROGRAM_NAME, Me, UpdateSub := AddressOf Auth_UpdateHandler, _
- AuthorizedSub := AddressOf Auth_AuthorizedHandler, UnAuthorizedSub := AddressOf Auth_UnauthorizedHandler, ExceptionSub := AddressOf Auth_ExceptionHandler)
- 'Settings can also be set like this:
- auth.StatusLabel = lblStatus
- 'Authorize asynchronously so it doesn't freeze the GUI
- auth.AuthorizeASync()
- 'Disable your authorize button
- btnAuthorize.Enabled = False
- End Sub
- Private Sub Auth_ExceptionHandler(ex As Exception)
- 'Handle the exception (stuff like Debug.Print() might help with debugging)
- End Sub
- Private Sub Auth_AuthorizedHandler()
- 'Do something when they are authorized
- End Sub
- Private Sub Auth_UnauthorizedHandler()
- btnAuthorize.Enabled = True
- 'Do something for handling unauthorized.
- End Sub
- Private Sub Auth_UpdateHandler()
- 'You can either require the user to update before using or just use the outdated version.
- End Sub
- #End Region
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement