StrataFrame Security Documentation Send comments on this topic.
Showing the Initial Login Form

Glossary Item Box

Showing the Login Form

Showing the initial login form within a StrataFrame application is accomplished through the MicroFour.StrataFrame.Security.Login class. This class has a LoginFormType property that accepts the System.Type of the form that will be shown as the login form. This form type defaults to MicroFour.StrataFrame.Security.LoginForm and can be set to any custom login form that implements the MicroFour.StrataFrame.Security.ILoginForm interface.

Once the LoginFormType has been set (or left to the default value), you can call the Login.ShowLoginAndAuthUser() method to show the login form and authenticate a user into the system. The method will return a Boolean value indicating whether the end-user was authenticated or he/she canceled out of the form and the application should exit.

The ShowLoginAndInitForm() Method

The ShowLoginAndInitMainForm() method within the AppMain.vb (Program.cs) file is provided to give a location to show the initial login form for the application. The following sample shows how to show the login form for the application.

Sample - Showing the Initial Login Form [Visual Basic]
Imports MicroFour.StrataFrame.Security.BusinessObjects
...
Private Shared Sub ShowLoginAndInitMainForm( _
	ByVal e As ShowLoginAndInitFormEventArgs)
	
	'-- Set the login form type to the appropriate form type (optional)
	Login.LoginFormType = GetType(MyLoginForm)

	'-- Show the login form and set the return value back to e.ShowMainForm
	'   The true value passed to the method tells the method to allow the
	'   end-user to cancel the login form, which will return False from the 
	'   method.
	e.ShowMainForm = Login.ShowLoginAndAuthUser(True) 
End Sub

Sample - Showing the Initial Login Form [C#]
using MicroFour.StrataFrame.Security;
...
private static void ShowLoginAndInitMainForm(ShowLoginAndInitFormEventArgs e)
{
	
	//-- Set the login form type to the appropriate form type (optional)
	Login.LoginFormType = typeof(MyLoginForm);

	//-- Show the login form and set the return value back to e.ShowMainForm
	//   The true value passed to the method tells the method to allow the
	//   end-user to cancel the login form, which will return False from the 
	//   method.
	e.ShowMainForm = Login.ShowLoginAndAuthUser(true);
}