private void login()
        {
            //Set the user credentials.
            myService.setUserCredentials(tb_accountName.Text, tb_password.Password);

            //Remember the username and password (if allowed by the user).
            //They will be saved later, not now because they are not yet varified.
            //Store the user name first without encryption.
            Properties.Settings.Default.UserName = tb_accountName.Text;
            try
            {
                //Encrypt the password before storing it!
                byte[] toEncryptPassword = System.Text.Encoding.Unicode.GetBytes(tb_password.Password);
                byte[] userNameAsEntropy = System.Text.Encoding.Unicode.GetBytes(tb_accountName.Text);
                byte[] encryptedPassword = ProtectedData.Protect(
                    toEncryptPassword,
                    userNameAsEntropy,
                    DataProtectionScope.CurrentUser);
                //Store the encrypted password.
                Properties.Settings.Default.Password =
                    Convert.ToBase64String(encryptedPassword);
            }
            catch (CryptographicException)
            {
                Properties.Settings.Default.Password = "";
                cb_rememberMe.IsChecked = false;
            }

            //Setup the parser.
            parser = new DocumentsFeedParser(myService);
            parser.ListViewUpdated   += new ListViewUpdatedHandler(parser_ListViewUpdated);
            parser.StatusChanged     += new StatusChangedHandler(parser_StatusChanged);
            parser.ProgressChanged   += new ProgressChangedHandler(parser_ProgressChanged);
            parser.NotifyIconUpdated += new NotifyIconUpdatedHandler(parser_NotifyIconUpdated);

            if (cb_rememberMe.IsChecked == false)
            {
                Properties.Settings.Default.UserName = "";
                Properties.Settings.Default.Password = "";
            }

            //Run the parser.
            //True means there are settings need to be saved, i.e. the
            //user name and password.
            parseWorker.RunWorkerAsync(true);

            gb_loginPage.Visibility = Visibility.Hidden;

            //Start the timer.
            timerChecker.Start();
        }
        private void login()
        {
            //Set the user credentials.
            myService.setUserCredentials(tb_accountName.Text, tb_password.Password);

            //Remember the username and password (if allowed by the user).
            //They will be saved later, not now because they are not yet varified.
            //Store the user name first without encryption.
            Properties.Settings.Default.UserName = tb_accountName.Text;
            try
            {
                //Encrypt the password before storing it!
                byte[] toEncryptPassword = System.Text.Encoding.Unicode.GetBytes(tb_password.Password);
                byte[] userNameAsEntropy = System.Text.Encoding.Unicode.GetBytes(tb_accountName.Text);
                byte[] encryptedPassword = ProtectedData.Protect(
                    toEncryptPassword,
                    userNameAsEntropy,
                    DataProtectionScope.CurrentUser);
                //Store the encrypted password.
                Properties.Settings.Default.Password =
                    Convert.ToBase64String(encryptedPassword);
            }
            catch (CryptographicException) 
            {
                Properties.Settings.Default.Password = "";
                cb_rememberMe.IsChecked = false;
            }
            
            //Setup the parser.
            parser = new DocumentsFeedParser(myService);
            parser.ListViewUpdated += new ListViewUpdatedHandler(parser_ListViewUpdated);
            parser.StatusChanged += new StatusChangedHandler(parser_StatusChanged);
            parser.ProgressChanged += new ProgressChangedHandler(parser_ProgressChanged);
            parser.NotifyIconUpdated += new NotifyIconUpdatedHandler(parser_NotifyIconUpdated);

            if (cb_rememberMe.IsChecked == false)
            {
                Properties.Settings.Default.UserName = "";
                Properties.Settings.Default.Password = "";
            }

            //Run the parser.
            //True means there are settings need to be saved, i.e. the
            //user name and password.
            parseWorker.RunWorkerAsync(true);

            gb_loginPage.Visibility = Visibility.Hidden;

            //Start the timer.
            timerChecker.Start();
        }