Exemple #1
0
        private async void button1_Click(object sender, EventArgs e)
        {
            string username = "******";
            string password = "******";
            panel1.Enabled = false;
            login_panel.Enabled = false;
            progressBar1.Value = 0;
            panel_doing.BringToFront();
            auth = new OAuth();
            progressBar1.Value = 20;

            var task = auth.authAsync(username, password);
            progressBar1.Value = 50;
            bool result = false;
            try {
                result = await task;       
            }
            catch
            {
                panel1.BringToFront();
                login_panel.BringToFront();
                login_panel.Enabled = true;
                return;
            }
            progressBar1.Value = 100;
            if (result)
            {
                MessageBox.Show("登陆成功");
                Debug.WriteLine(auth.User.name);
                pixivAPI = new pixivAPI(auth);
                panel1.Enabled = true;
                panel1.BringToFront();
                login_panel.BringToFront();
                return;
            }

            MessageBox.Show("登录失败");
            panel1.BringToFront();
            login_panel.BringToFront();
            login_panel.Enabled = true;

        }
Exemple #2
0
 public pixivAPI(OAuth oauth)
 {
     this.oauth = oauth;
 }
Exemple #3
0
 public pixivAPI(OAuth oauth)
 {
     this.oauth = oauth;
 }