Пример #1
0
 public static void InitBotClient()
 {
     while (true) {
         try {
             NetworkCredential nc = new NetworkCredential(Properties.Settings.Default.SBFLUsername, Properties.Settings.Default.SBFLPassword);
             BotClient = new SbflClient(nc);
             BotClient.GetGames();
             break;
         } catch (WebException) {
             SettingsForm sf = new SettingsForm();
             if (sf.ShowDialog() != DialogResult.OK)
                 return;
         }
     }
 }
Пример #2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            NetworkCredential nc = new NetworkCredential(txtUsername.Text, txtPassword.Text);

            try {
                SbflClient bc = new SbflClient(nc);
                bc.GetGames();
            } catch (WebException) {
                MessageBox.Show(this, "The specified username and password are not valid.", "SBFL LFG", MessageBoxButtons.OK, MessageBoxIcon.Error);
                DialogResult = DialogResult.None;
                return;
            }

            Properties.Settings.Default.SBFLUsername = nc.UserName;
            Properties.Settings.Default.SBFLPassword = nc.Password;
            Properties.Settings.Default.Save();
        }