public bool Login() { CookieContainer test = new CookieContainer(); Yandex yandex = new Yandex(login, password); ProgressChanged(1); yandex.Authorize(); ProgressChanged(1); test = yandex.cookies; Cookies cs = new Cookies(); cs.Write(test, GlobalVariables.apppath + @"\coockies.txt"); ProgressChanged(1); return(true); }
private void button1_Click(object sender, EventArgs e) { CookieContainer test = new CookieContainer(); button1.Enabled = false; button2.Enabled = false; button3.Enabled = false; label3.Text = ""; label4.Text = ""; try { Yandex yandex = new Yandex(textBox1.Text, textBox2.Text); yandex.Authorize(); test = yandex.cookies; Cookies cs = new Cookies(); cs.Write(test, GlobalVariables.apppath + @"\coockies.txt"); YandexInfo yi = new YandexInfo(); mw.username.Text = yi.GetUserName(); mw.useravatar.Load(yi.GetUserAvatar()); closeapp = false; this.Close(); } catch (Exceptions ex) { MessageBox.Show(ex.Message); } catch (YandexExceptions) { if (textBox1.Text == "") { label3.Text = "Поле пустое!"; } if (textBox2.Text == "") { label4.Text = "Поле пустое!"; } } finally { button1.Enabled = true; button2.Enabled = true; button3.Enabled = true; } }