Esempio n. 1
0
        private void Client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            button1.Enabled = txtUsername.Enabled = txtPassword.Enabled = true;
            try
            {
                if (e.Result.ToLowerInvariant().Contains(txtUsername.Text.ToLowerInvariant().Trim()))
                {
                    if (Options.CurrentOptions.RememberMe)
                    {
                        Options.CurrentOptions.Username = txtUsername.Text.ToLowerInvariant().Trim();
                        Options.CurrentOptions.Password = CryLain.Base64Encode(txtPassword.Text);
                        Options.SaveSettings();
                    }

                    Program.SetMainForm(new ProfileForm(txtUsername.Text));
                    txtUsername.Clear();
                    txtPassword.Clear();
                    this.Close();
                    Program.ShowMainForm();
                }
            }
            catch //(Exception ex)
            {
                MessageBox.Show("Your username and/or password is invalid!", "ERROR: Login", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 2
0
 private void LoadSettings()
 {
     if (File.Exists(Options.SettingsFile))
     {
         if (!string.IsNullOrEmpty(Options.CurrentOptions.Username) && !string.IsNullOrEmpty(Options.CurrentOptions.Password))
         {
             txtPassword.Text = CryLain.Base64Decode(Options.CurrentOptions.Password);
             Authenticate(Options.CurrentOptions.Username, CryLain.Base64Decode(Options.CurrentOptions.Password));
         }
         txtUsername.Text  = Options.CurrentOptions.Username;
         checkBox1.Checked = Options.CurrentOptions.RememberMe;
     }
 }