Loading the login form

Instead of going straight to the menu, you must now load the login form as the first form of your application. You can easily do that by first adding a new navigation target in the salesForceApp.Navigationservice class (highlighted as follows).

public static DialogResult showDialog(string DialogName, object Argl) {

DialogResult _dialogResult = 0;

switch (DialogName) {

case "SetupDatasources":

PluginsSetup _PluginsSetup = new PluginsSetup(); _dialogResult = _PluginsSetup.ShowDialog(); _PluginsSetup.Close(); _PluginsSetup.Dispose(); _PluginsSetup = null; break; case "Login":

Login _login = new Login(); _dialogResult = _login.ShowDialog(); _login.Close(); _login.Dispose(); _login = null; break; case "MainMenu":

MainMenu _MainMenu = new MainMenu();

_dialogResult = _MainMenu.ShowDialog();

_MainMenu.Close();

_MainMenu.Dispose();

_MainMenu = null;

break;

As the last step, you will now need to modify the Main() method in the salesForceApp.Application class. This will enable the application to launch the Login form first whenever you start the application.

public class Application {

public static void Main() {

InitializeApp();

NavigationService.ShowDialog("Login", null); DeInitializeApp();

That's all there is to it! Now you can try your Login form by running the SalesForceApp project. The first time, it will prompt you for your password. You can see the record for the master account generated in the UserLogons table if you use the Query Analyzer 3.5 tool to run a query off the SQL Server CE database. On all subsequent runs, you will be required to key in that same username and password to log on.

You've learnt how to transmit data via Bluetooth and Infrared from one device to another in Chapter 5, Building Integrated Services. Just to jog your memory a little, you placed the data for a lead account in a Dataset object, serialized it into an array of bytes, transmitted it across to the other device, and then de-serialized the stream of bytes back into a Dataset object).

It is unsafe to leave your data unprotected over wireless transmission. For instance, Bluetooth technology works over a distance wide enough for an unauthorized device (and an adept hacker) to intercept the stream of data.

The System.Security.Cryptography libraries in the .NET CF provide a number of algorithms that allow you to encrypt and decrypt your data. Unlike the SHA algorithm you've seen earlier, which was one-way, these algorithms are two-way. A key (password) is usually applied during the encryption. An encrypted stream can only be decrypted when the same key is supplied. One of these algorithms is the Rijndael algorithm.

In Rijndael encryption, three pieces of information usually need to be supplied:

• Initialization Vector (IV)

Was this article helpful?

0 0

Post a comment